From owner-dev-commits-src-main@freebsd.org Mon Jan 18 00:39:39 2021 Return-Path: Delivered-To: dev-commits-src-main@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 81F214DC263; Mon, 18 Jan 2021 00:39:39 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DJtGM2vk2z4jCf; Mon, 18 Jan 2021 00:39:39 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-oi1-x234.google.com with SMTP id f132so16052611oib.12; Sun, 17 Jan 2021 16:39:39 -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=hbZK9LfgzusrRWYbRPy6Vr5nF5xPR1zlz+lVslXaBZI=; b=PZL5RELkP3VIgCGz8zW99bNaFx1qrVfXnYZFOJKfgnQVA+UMUp4jrY+BVWf/hqZoHd wBBrHitLpg+uVL7pZFPfxT1K0N/z2wrJRmt36sM58nIG88ZRvB6yhG8DmS4RMUE9KrlF GQMNM8VpA3yRZOmNhHf83KPM9gQ+BlvxgHJBUHri3OCy87WWRIADxhD1byajk/7UqCWx pd75KZwPxgs7a8UgpL8bdOJiZUZb8/z7DmAF9SkxjhtoSHUptp5zD0aZ33MBa6eYdo5O apAm8PjsWOkXRkOyFNt3RNdosDRqo1q4eLwRwZqxykT4n7EO6w+05dJ7RiIak/oyAGoE wVYg== 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=hbZK9LfgzusrRWYbRPy6Vr5nF5xPR1zlz+lVslXaBZI=; b=QvEwlWmQbVSf+3zbPnuy58a0wqIU63KlXP5Cm6LxG9iG9jHfEbsLYFlW/AmL9Uf2u3 Z06TKLDoJ63/FX3enU5R00N92u0e0a1IB8MZS9k/EqPfLc+qpAuX2a5fGQ7xYumm3sNg 8OjKldUjExFUvLfEqssyAcOSyn09+C1tHekJBgCoRrwTJNgXlzsCreQYeZyTzymWq4Uz tnEkkqtUUDaYD1pOsNHDUukyDAxuPkCXl5vuAgbaokSNLKY6agmZHPFAxgme8NDfcEy4 4pX4nJqyBDkpNhCnh0dT3hdAxQp7rLHjoRF+yE/Bg5IXxFi+919T0rBoOFjkixR6bjk1 vMGw== X-Gm-Message-State: AOAM533GAq2hWogAyN1cHgKIdD3ezoDNXmf0m3N/TFHW9aXFHRPw3nxS XkRtFb2x4i3dWDM0nAY3N+0/uljdlsh9LqnDymcCkSRy X-Google-Smtp-Source: ABdhPJxzD0sJzpw9cBFPW/YazfgVGO1jxLU6GI2mJ2/B+mLqCxAw0qbIxIHkL8/YVEReUzmUtpHiCBUpGFOZwxRtDzM= X-Received: by 2002:aca:4dd4:: with SMTP id a203mr28076oib.173.1610930377787; Sun, 17 Jan 2021 16:39:37 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a4a:a187:0:0:0:0:0 with HTTP; Sun, 17 Jan 2021 16:39:37 -0800 (PST) In-Reply-To: <202101172216.10HMGH1D076854@gitrepo.freebsd.org> References: <202101172216.10HMGH1D076854@gitrepo.freebsd.org> From: Oliver Pinter Date: Mon, 18 Jan 2021 01:39:37 +0100 Message-ID: Subject: Re: git: 1caed70c6264 - main - loader: update gfx module To: Toomas Soome Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4DJtGM2vk2z4jCf X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 00:39:39 -0000 On Sunday, January 17, 2021, Toomas Soome wrote: > The branch main has been updated by tsoome: > > URL: https://cgit.FreeBSD.org/src/commit/?id= > 1caed70c62646a5978bbeb4562bc3ae2dabc874a > > commit 1caed70c62646a5978bbeb4562bc3ae2dabc874a > Author: Toomas Soome > AuthorDate: 2021-01-17 22:09:18 +0000 > Commit: Toomas Soome > CommitDate: 2021-01-17 22:15:36 +0000 > > loader: update gfx module > > Update from illumos review process. > Add more comments, drop memory buffer from blt functions. > --- > stand/common/gfx_fb.c | 118 ++++++++++++++++++++++++++++++ > ++------------------ > 1 file changed, 76 insertions(+), 42 deletions(-) > > diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c > index 9342521fd0cf..d98e6d1bae4b 100644 > --- a/stand/common/gfx_fb.c > +++ b/stand/common/gfx_fb.c > @@ -29,6 +29,61 @@ > * $FreeBSD$ > */ > > +/* > + * The workhorse here is gfxfb_blt(). It is implemented to mimic UEFI > + * GOP Blt, and allows us to fill the rectangle on screen, copy > + * rectangle from video to buffer and buffer to video and video to video. > + * Such implementation does allow us to have almost identical > implementation > + * for both BIOS VBE and UEFI. > + * > + * ALL pixel data is assumed to be 32-bit BGRA (byte order Blue, Green, > Red, > + * Alpha) format, this allows us to only handle RGB data and not to worry > + * about mixing RGB with indexed colors. > + * Data exchange between memory buffer and video will translate BGRA > + * and native format as following: > + * > + * 32-bit to/from 32-bit is trivial case. > + * 32-bit to/from 24-bit is also simple - we just drop the alpha channel. > + * 32-bit to/from 16-bit is more complicated, because we nee to handle > + * data loss from 32-bit to 16-bit. While reading/writing from/to video, > we > + * need to apply masks of 16-bit color components. This will preserve > + * colors for terminal text. For 32-bit truecolor PMG images, we need to > + * translate 32-bit colors to 15/16 bit colors and this means data loss. > + * There are different algorithms how to perform such color space > reduction, > + * we are currently using bitwise right shift to reduce color space and > so far > + * this technique seems to be sufficient (see also gfx_fb_putimage(), the > + * end of for loop). > + * 32-bit to/from 8-bit is the most troublesome because 8-bit colors are > + * indexed. From video, we do get color indexes, and we do translate > + * color index values to RGB. To write to video, we again need to > translate > + * RGB to color index. Additionally, we need to translate between VGA and > + * console colors. > + * > + * Our internal color data is represented using BGRA format. But the > hardware > + * used indexed colors for 8-bit colors (0-255) and for this mode we do > + * need to perform translation to/from BGRA and index values. > + * > + * - paletteentry RGB <-> index - > + * BGRA BUFFER <----/ \ - VIDEO > + * \ / > + * - RGB (16/24/32) - > + * > + * To perform index to RGB translation, we use palette table generated > + * from when we set up 8-bit mode video. We cannot read palette data from > + * the hardware, because not all hardware supports reading it. > + * > + * BGRA to index is implemented in rgb_to_color_index() by searching > + * palette array for closest match of RBG values. > + * > + * Note: In 8-bit mode, We do store first 16 colors to palette registers > + * in VGA color order, this serves two purposes; firstly, > + * if palette update is not supported, we still have correct 16 colors. > + * Secondly, the kernel does get correct 16 colors when some other boot > + * loader is used. However, the palette map for 8-bit colors is using > + * console color ordering - this does allow us to skip translation > + * from VGA colors to console colors, while we are reading RGB data. > + */ > + > #include > #include > #include > @@ -257,7 +312,7 @@ rgb_to_color_index(uint8_t r, uint8_t g, uint8_t b) > int diff; > > color = 0; > - best = NCMAP * NCMAP * NCMAP; > + best = 255 * 255 * 255; This change was intended to change from a named constant to magic number? > for (k = 0; k < NCMAP; k++) { > diff = r - pe8[k].Red; > dist = diff * diff; > @@ -337,7 +392,6 @@ gfx_mem_wr4(uint8_t *base, size_t size, uint32_t o, > uint32_t v) > *(uint32_t *)(base + o) = v; > } > > -/* Our GFX Block transfer toolkit. */ > static int gfxfb_blt_fill(void *BltBuffer, > uint32_t DestinationX, uint32_t DestinationY, > uint32_t Width, uint32_t Height) > @@ -409,6 +463,8 @@ static int gfxfb_blt_fill(void *BltBuffer, > case 4: > gfx_mem_wr4(destination, size, off, data); > break; > + default: > + return (EINVAL); > } > off += bpp; > } > @@ -430,7 +486,7 @@ gfxfb_blt_video_to_buffer(void *BltBuffer, uint32_t > SourceX, uint32_t SourceY, > uint32_t x, sy, dy; > uint32_t bpp, pitch, copybytes; > off_t off; > - uint8_t *source, *destination, *buffer, *sb; > + uint8_t *source, *destination, *sb; > uint8_t rm, rp, gm, gp, bm, bp; > bool bgra; > > @@ -468,36 +524,21 @@ gfxfb_blt_video_to_buffer(void *BltBuffer, uint32_t > SourceX, uint32_t SourceY, > ffs(gm) - 1 == 8 && gp == 8 && > ffs(bm) - 1 == 8 && bp == 0; > > - if (bgra) { > - buffer = NULL; > - } else { > - buffer = malloc(copybytes); > - if (buffer == NULL) > - return (ENOMEM); > - } > - > for (sy = SourceY, dy = DestinationY; dy < Height + DestinationY; > sy++, dy++) { > off = sy * pitch + SourceX * bpp; > source = gfx_get_fb_address() + off; > + destination = (uint8_t *)BltBuffer + dy * Delta + > + DestinationX * sizeof (*p); > > if (bgra) { > - destination = (uint8_t *)BltBuffer + dy * Delta + > - DestinationX * sizeof (*p); > + bcopy(source, destination, copybytes); > } else { > - destination = buffer; > - } > - > - bcopy(source, destination, copybytes); > - > - if (!bgra) { > for (x = 0; x < Width; x++) { > uint32_t c = 0; > > - p = (void *)((uint8_t *)BltBuffer + > - dy * Delta + > - (DestinationX + x) * sizeof (*p)); > - sb = buffer + x * bpp; > + p = (void *)(destination + x * sizeof > (*p)); > + sb = source + x * bpp; > switch (bpp) { > case 1: > c = *sb; > @@ -511,6 +552,8 @@ gfxfb_blt_video_to_buffer(void *BltBuffer, uint32_t > SourceX, uint32_t SourceY, > case 4: > c = *(uint32_t *)sb; > break; > + default: > + return (EINVAL); > } > > if (bpp == 1) { > @@ -527,7 +570,6 @@ gfxfb_blt_video_to_buffer(void *BltBuffer, uint32_t > SourceX, uint32_t SourceY, > } > } > > - free(buffer); > return (0); > } > > @@ -544,7 +586,7 @@ gfxfb_blt_buffer_to_video(void *BltBuffer, uint32_t > SourceX, uint32_t SourceY, > uint32_t x, sy, dy; > uint32_t bpp, pitch, copybytes; > off_t off; > - uint8_t *source, *destination, *buffer; > + uint8_t *source, *destination; > uint8_t rm, rp, gm, gp, bm, bp; > bool bgra; > > @@ -582,13 +624,6 @@ gfxfb_blt_buffer_to_video(void *BltBuffer, uint32_t > SourceX, uint32_t SourceY, > ffs(gm) - 1 == 8 && gp == 8 && > ffs(bm) - 1 == 8 && bp == 0; > > - if (bgra) { > - buffer = NULL; > - } else { > - buffer = malloc(copybytes); > - if (buffer == NULL) > - return (ENOMEM); > - } > for (sy = SourceY, dy = DestinationY; sy < Height + SourceY; > sy++, dy++) { > off = dy * pitch + DestinationX * bpp; > @@ -597,6 +632,7 @@ gfxfb_blt_buffer_to_video(void *BltBuffer, uint32_t > SourceX, uint32_t SourceY, > if (bgra) { > source = (uint8_t *)BltBuffer + sy * Delta + > SourceX * sizeof (*p); > + bcopy(source, destination, copybytes); > } else { > for (x = 0; x < Width; x++) { > uint32_t c; > @@ -615,35 +651,33 @@ gfxfb_blt_buffer_to_video(void *BltBuffer, uint32_t > SourceX, uint32_t SourceY, > off = x * bpp; > switch (bpp) { > case 1: > - gfx_mem_wr1(buffer, copybytes, > + gfx_mem_wr1(destination, copybytes, > off, (c < 16) ? > cons_to_vga_colors[c] : c); > break; > case 2: > - gfx_mem_wr2(buffer, copybytes, > + gfx_mem_wr2(destination, copybytes, > off, c); > break; > case 3: > - gfx_mem_wr1(buffer, copybytes, > + gfx_mem_wr1(destination, copybytes, > off, (c >> 16) & 0xff); > - gfx_mem_wr1(buffer, copybytes, > + gfx_mem_wr1(destination, copybytes, > off + 1, (c >> 8) & 0xff); > - gfx_mem_wr1(buffer, copybytes, > + gfx_mem_wr1(destination, copybytes, > off + 2, c & 0xff); > break; > case 4: > - gfx_mem_wr4(buffer, copybytes, > + gfx_mem_wr4(destination, copybytes, > x * bpp, c); > break; > + default: > + return (EINVAL); > } > } > - source = buffer; > } > - > - bcopy(source, destination, copybytes); > } > > - free(buffer); > return (0); > } > > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main- > unsubscribe@freebsd.org" > From owner-dev-commits-src-main@freebsd.org Mon Jan 18 01:41:48 2021 Return-Path: Delivered-To: dev-commits-src-main@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 790894DD812; Mon, 18 Jan 2021 01:41:48 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DJvf433W6z4m16; Mon, 18 Jan 2021 01:41:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C0AA3542; Mon, 18 Jan 2021 01:41:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10I1fmf2047486; Mon, 18 Jan 2021 01:41:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10I1fmlI047472; Mon, 18 Jan 2021 01:41:48 GMT (envelope-from git) Date: Mon, 18 Jan 2021 01:41:48 GMT Message-Id: <202101180141.10I1fmlI047472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 25c2c952e3f6 - main - jail: Add proper prison locking in mqfs_prison_remove. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25c2c952e3f64ec1a59033c0e2dc870a6c818a84 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 01:41:48 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=25c2c952e3f64ec1a59033c0e2dc870a6c818a84 commit 25c2c952e3f64ec1a59033c0e2dc870a6c818a84 Author: Jamie Gritton AuthorDate: 2021-01-18 01:37:03 +0000 Commit: Jamie Gritton CommitDate: 2021-01-18 01:41:09 +0000 jail: Add proper prison locking in mqfs_prison_remove. --- sys/kern/uipc_mqueue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c index fc888023a40f..309fa3423fbd 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -1562,14 +1562,16 @@ static int mqfs_prison_remove(void *obj, void *data __unused) { const struct prison *pr = obj; - const struct prison *tpr; + struct prison *tpr; struct mqfs_node *pn, *tpn; int found; found = 0; TAILQ_FOREACH(tpr, &allprison, pr_list) { + prison_lock(tpr); if (tpr->pr_root == pr->pr_root && tpr != pr && tpr->pr_ref > 0) found = 1; + prison_unlock(tpr); } if (!found) { /* From owner-dev-commits-src-main@freebsd.org Mon Jan 18 03:03:50 2021 Return-Path: Delivered-To: dev-commits-src-main@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 062264DF9B9; Mon, 18 Jan 2021 03:03:50 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DJxSj6H90z4qhp; Mon, 18 Jan 2021 03:03:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C70824EAA; Mon, 18 Jan 2021 03:03:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10I33nto055232; Mon, 18 Jan 2021 03:03:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10I33nvq055231; Mon, 18 Jan 2021 03:03:49 GMT (envelope-from git) Date: Mon, 18 Jan 2021 03:03:49 GMT Message-Id: <202101180303.10I33nvq055231@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 448de00de556 - main - mount_nfs: update man page description for oneopenown MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 448de00de556753575ec0a2e705712e7c606e680 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 03:03:50 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=448de00de556753575ec0a2e705712e7c606e680 commit 448de00de556753575ec0a2e705712e7c606e680 Author: Rick Macklem AuthorDate: 2021-01-18 03:00:41 +0000 Commit: Rick Macklem CommitDate: 2021-01-18 03:00:41 +0000 mount_nfs: update man page description for oneopenown A recent email discussion indicated that a large accumulation of NFSv4 Opens was occurring on a mount. This appears to have been caused by a shared library within the mount being used by several processes, such that there is always at least one of these processes running. A new Open was created by each process and were not closed, since all the Opens were never closed. This is alleviated by using the "oneopenown" mount option. This man page update attempts to indicate the use of "oneopenown" for this case. This is a content change. Reported by: j.david.lists@gmail.com Reviewed by: 0mp MFC: 1 month Differential Revision: https://reviews.freebsd.org/D28215 --- sbin/mount_nfs/mount_nfs.8 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8 index b2c561bc5cc8..76e009817d8b 100644 --- a/sbin/mount_nfs/mount_nfs.8 +++ b/sbin/mount_nfs/mount_nfs.8 @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd December 21, 2020 +.Dd January 17, 2021 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -217,6 +217,19 @@ Make a minor version 1 or 2 of the NFS Version 4 protocol mount use a single OpenOwner for all Opens. This may be useful for a server with a very low limit on OpenOwners, such as AmazonEFS. +It may be required when an accumulation of NFS version 4 Opens occurs, +as indicated by the +.Dq Opens +count displayed by +.Xr nfsstat 8 +with the +.Fl c +and +.Fl E +command-line options. +A common case for an accumulation of Opens is a shared library within +the NFS mount that is used by several +processes, where at least one of these processes is always running. This option cannot be used for an NFS Version 4, minor version 0 mount. As such, this option requires the .Cm minorversion From owner-dev-commits-src-main@freebsd.org Mon Jan 18 07:17:52 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AD0424E33E9 for ; Mon, 18 Jan 2021 07:17:52 +0000 (UTC) (envelope-from tsoome@me.com) Received: from pv50p00im-ztdg10012101.me.com (pv50p00im-ztdg10012101.me.com [17.58.6.49]) (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 4DK35p4zZXz3JtB for ; Mon, 18 Jan 2021 07:17:50 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by pv50p00im-ztdg10012101.me.com (Postfix) with ESMTPSA id 4977E84016F; Mon, 18 Jan 2021 07:17:47 +0000 (UTC) From: Toomas Soome Message-Id: <4CC2ED16-9C4A-4821-BAB0-F1B01C525EFD@me.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: git: 1caed70c6264 - main - loader: update gfx module Date: Mon, 18 Jan 2021 09:17:44 +0200 In-Reply-To: Cc: Toomas Soome , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Oliver Pinter References: <202101172216.10HMGH1D076854@gitrepo.freebsd.org> X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-18_07:2021-01-15, 2021-01-18 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2101180042 X-Rspamd-Queue-Id: 4DK35p4zZXz3JtB X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.50 / 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)[+ip4:17.58.0.0/16:c]; FREEMAIL_FROM(0.00)[me.com]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; DKIM_TRACE(0.00)[me.com:+]; DMARC_POLICY_ALLOW(-0.50)[me.com,quarantine]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[me.com]; ASN(0.00)[asn:714, ipnet:17.58.0.0/20, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[17.58.6.49:from]; DWL_DNSWL_NONE(0.00)[me.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[me.com:s=1a1hai]; FREEFALL_USER(0.00)[tsoome]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; SPAMHAUS_ZRD(0.00)[17.58.6.49:from:127.0.2.255]; RECEIVED_SPAMHAUS_PBL(0.00)[80.235.52.148:received]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[17.58.6.49:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[17.58.6.49:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 07:17:52 -0000 > On 18. Jan 2021, at 02:39, Oliver Pinter = wrote: >=20 >=20 >=20 > On Sunday, January 17, 2021, Toomas Soome > wrote: > The branch main has been updated by tsoome: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D1caed70c62646a5978bbeb4562bc3ae2= dabc874a = >=20 > commit 1caed70c62646a5978bbeb4562bc3ae2dabc874a > Author: Toomas Soome > AuthorDate: 2021-01-17 22:09:18 +0000 > Commit: Toomas Soome > CommitDate: 2021-01-17 22:15:36 +0000 >=20 > loader: update gfx module >=20 > Update from illumos review process. > Add more comments, drop memory buffer from blt functions. > --- > stand/common/gfx_fb.c | 118 = ++++++++++++++++++++++++++++++++------------------ > 1 file changed, 76 insertions(+), 42 deletions(-) >=20 > diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c > index 9342521fd0cf..d98e6d1bae4b 100644 > --- a/stand/common/gfx_fb.c > +++ b/stand/common/gfx_fb.c > @@ -29,6 +29,61 @@ > * $FreeBSD$ > */ >=20 > +/* > + * The workhorse here is gfxfb_blt(). It is implemented to mimic UEFI > + * GOP Blt, and allows us to fill the rectangle on screen, copy > + * rectangle from video to buffer and buffer to video and video to = video. > + * Such implementation does allow us to have almost identical = implementation > + * for both BIOS VBE and UEFI. > + * > + * ALL pixel data is assumed to be 32-bit BGRA (byte order Blue, = Green, Red, > + * Alpha) format, this allows us to only handle RGB data and not to = worry > + * about mixing RGB with indexed colors. > + * Data exchange between memory buffer and video will translate BGRA > + * and native format as following: > + * > + * 32-bit to/from 32-bit is trivial case. > + * 32-bit to/from 24-bit is also simple - we just drop the alpha = channel. > + * 32-bit to/from 16-bit is more complicated, because we nee to = handle > + * data loss from 32-bit to 16-bit. While reading/writing from/to = video, we > + * need to apply masks of 16-bit color components. This will preserve > + * colors for terminal text. For 32-bit truecolor PMG images, we need = to > + * translate 32-bit colors to 15/16 bit colors and this means data = loss. > + * There are different algorithms how to perform such color space = reduction, > + * we are currently using bitwise right shift to reduce color space = and so far > + * this technique seems to be sufficient (see also gfx_fb_putimage(), = the > + * end of for loop). > + * 32-bit to/from 8-bit is the most troublesome because 8-bit colors = are > + * indexed. =46rom video, we do get color indexes, and we do = translate > + * color index values to RGB. To write to video, we again need to = translate > + * RGB to color index. Additionally, we need to translate between VGA = and > + * console colors. > + * > + * Our internal color data is represented using BGRA format. But the = hardware > + * used indexed colors for 8-bit colors (0-255) and for this mode we = do > + * need to perform translation to/from BGRA and index values. > + * > + * - paletteentry RGB <-> index - > + * BGRA BUFFER <----/ \ - VIDEO > + * \ / > + * - RGB (16/24/32) - > + * > + * To perform index to RGB translation, we use palette table = generated > + * from when we set up 8-bit mode video. We cannot read palette data = from > + * the hardware, because not all hardware supports reading it. > + * > + * BGRA to index is implemented in rgb_to_color_index() by searching > + * palette array for closest match of RBG values. > + * > + * Note: In 8-bit mode, We do store first 16 colors to palette = registers > + * in VGA color order, this serves two purposes; firstly, > + * if palette update is not supported, we still have correct 16 = colors. > + * Secondly, the kernel does get correct 16 colors when some other = boot > + * loader is used. However, the palette map for 8-bit colors is using > + * console color ordering - this does allow us to skip translation > + * from VGA colors to console colors, while we are reading RGB data. > + */ > + > #include > #include > #include > @@ -257,7 +312,7 @@ rgb_to_color_index(uint8_t r, uint8_t g, uint8_t = b) > int diff; >=20 > color =3D 0; > - best =3D NCMAP * NCMAP * NCMAP; > + best =3D 255 * 255 * 255; >=20 > This change was intended to change from a named constant to magic = number?=20 yes, one thing is that NCMAP is wrong named constant to be used in this = context. We want to start with large enough value > 255^2 + 255^2 + = 255^2, where 255 is max value of RGB component. In that sense even = UINT32_MAX is ok, but I think, 255 * 255 * 255 is visually better = (better than UINT8_MAX * UINT8_MAX * UINT8_MAX). rgds, toomas > =20 > for (k =3D 0; k < NCMAP; k++) { > diff =3D r - pe8[k].Red; > dist =3D diff * diff; > @@ -337,7 +392,6 @@ gfx_mem_wr4(uint8_t *base, size_t size, uint32_t = o, uint32_t v) > *(uint32_t *)(base + o) =3D v; > } >=20 > -/* Our GFX Block transfer toolkit. */ > static int gfxfb_blt_fill(void *BltBuffer, > uint32_t DestinationX, uint32_t DestinationY, > uint32_t Width, uint32_t Height) > @@ -409,6 +463,8 @@ static int gfxfb_blt_fill(void *BltBuffer, > case 4: > gfx_mem_wr4(destination, size, off, = data); > break; > + default: > + return (EINVAL); > } > off +=3D bpp; > } > @@ -430,7 +486,7 @@ gfxfb_blt_video_to_buffer(void *BltBuffer, = uint32_t SourceX, uint32_t SourceY, > uint32_t x, sy, dy; > uint32_t bpp, pitch, copybytes; > off_t off; > - uint8_t *source, *destination, *buffer, *sb; > + uint8_t *source, *destination, *sb; > uint8_t rm, rp, gm, gp, bm, bp; > bool bgra; >=20 > @@ -468,36 +524,21 @@ gfxfb_blt_video_to_buffer(void *BltBuffer, = uint32_t SourceX, uint32_t SourceY, > ffs(gm) - 1 =3D=3D 8 && gp =3D=3D 8 && > ffs(bm) - 1 =3D=3D 8 && bp =3D=3D 0; >=20 > - if (bgra) { > - buffer =3D NULL; > - } else { > - buffer =3D malloc(copybytes); > - if (buffer =3D=3D NULL) > - return (ENOMEM); > - } > - > for (sy =3D SourceY, dy =3D DestinationY; dy < Height + = DestinationY; > sy++, dy++) { > off =3D sy * pitch + SourceX * bpp; > source =3D gfx_get_fb_address() + off; > + destination =3D (uint8_t *)BltBuffer + dy * Delta + > + DestinationX * sizeof (*p); >=20 > if (bgra) { > - destination =3D (uint8_t *)BltBuffer + dy * = Delta + > - DestinationX * sizeof (*p); > + bcopy(source, destination, copybytes); > } else { > - destination =3D buffer; > - } > - > - bcopy(source, destination, copybytes); > - > - if (!bgra) { > for (x =3D 0; x < Width; x++) { > uint32_t c =3D 0; >=20 > - p =3D (void *)((uint8_t *)BltBuffer + > - dy * Delta + > - (DestinationX + x) * sizeof (*p)); > - sb =3D buffer + x * bpp; > + p =3D (void *)(destination + x * = sizeof (*p)); > + sb =3D source + x * bpp; > switch (bpp) { > case 1: > c =3D *sb; > @@ -511,6 +552,8 @@ gfxfb_blt_video_to_buffer(void *BltBuffer, = uint32_t SourceX, uint32_t SourceY, > case 4: > c =3D *(uint32_t *)sb; > break; > + default: > + return (EINVAL); > } >=20 > if (bpp =3D=3D 1) { > @@ -527,7 +570,6 @@ gfxfb_blt_video_to_buffer(void *BltBuffer, = uint32_t SourceX, uint32_t SourceY, > } > } >=20 > - free(buffer); > return (0); > } >=20 > @@ -544,7 +586,7 @@ gfxfb_blt_buffer_to_video(void *BltBuffer, = uint32_t SourceX, uint32_t SourceY, > uint32_t x, sy, dy; > uint32_t bpp, pitch, copybytes; > off_t off; > - uint8_t *source, *destination, *buffer; > + uint8_t *source, *destination; > uint8_t rm, rp, gm, gp, bm, bp; > bool bgra; >=20 > @@ -582,13 +624,6 @@ gfxfb_blt_buffer_to_video(void *BltBuffer, = uint32_t SourceX, uint32_t SourceY, > ffs(gm) - 1 =3D=3D 8 && gp =3D=3D 8 && > ffs(bm) - 1 =3D=3D 8 && bp =3D=3D 0; >=20 > - if (bgra) { > - buffer =3D NULL; > - } else { > - buffer =3D malloc(copybytes); > - if (buffer =3D=3D NULL) > - return (ENOMEM); > - } > for (sy =3D SourceY, dy =3D DestinationY; sy < Height + = SourceY; > sy++, dy++) { > off =3D dy * pitch + DestinationX * bpp; > @@ -597,6 +632,7 @@ gfxfb_blt_buffer_to_video(void *BltBuffer, = uint32_t SourceX, uint32_t SourceY, > if (bgra) { > source =3D (uint8_t *)BltBuffer + sy * Delta + > SourceX * sizeof (*p); > + bcopy(source, destination, copybytes); > } else { > for (x =3D 0; x < Width; x++) { > uint32_t c; > @@ -615,35 +651,33 @@ gfxfb_blt_buffer_to_video(void *BltBuffer, = uint32_t SourceX, uint32_t SourceY, > off =3D x * bpp; > switch (bpp) { > case 1: > - gfx_mem_wr1(buffer, copybytes, > + gfx_mem_wr1(destination, = copybytes, > off, (c < 16) ? > cons_to_vga_colors[c] : = c); > break; > case 2: > - gfx_mem_wr2(buffer, copybytes, > + gfx_mem_wr2(destination, = copybytes, > off, c); > break; > case 3: > - gfx_mem_wr1(buffer, copybytes, > + gfx_mem_wr1(destination, = copybytes, > off, (c >> 16) & 0xff); > - gfx_mem_wr1(buffer, copybytes, > + gfx_mem_wr1(destination, = copybytes, > off + 1, (c >> 8) & 0xff); > - gfx_mem_wr1(buffer, copybytes, > + gfx_mem_wr1(destination, = copybytes, > off + 2, c & 0xff); > break; > case 4: > - gfx_mem_wr4(buffer, copybytes, > + gfx_mem_wr4(destination, = copybytes, > x * bpp, c); > break; > + default: > + return (EINVAL); > } > } > - source =3D buffer; > } > - > - bcopy(source, destination, copybytes); > } >=20 > - free(buffer); > return (0); > } >=20 > _______________________________________________ > dev-commits-src-main@freebsd.org = mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main = > To unsubscribe, send any mail to = "dev-commits-src-main-unsubscribe@freebsd.org = " From owner-dev-commits-src-main@freebsd.org Mon Jan 18 07:53:26 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E6C2B4E3E7F; Mon, 18 Jan 2021 07:53:26 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DK3tt6BVTz3M1G; Mon, 18 Jan 2021 07:53:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C756610922; Mon, 18 Jan 2021 07:53:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10I7rQC9031807; Mon, 18 Jan 2021 07:53:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10I7rQ4L031806; Mon, 18 Jan 2021 07:53:26 GMT (envelope-from git) Date: Mon, 18 Jan 2021 07:53:26 GMT Message-Id: <202101180753.10I7rQ4L031806@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 36bcc44e2c57 - main - Add ddb 'show timecounter' command. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36bcc44e2c578dd016940c9c5068c348e1d77f99 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 07:53:27 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=36bcc44e2c578dd016940c9c5068c348e1d77f99 commit 36bcc44e2c578dd016940c9c5068c348e1d77f99 Author: Konstantin Belousov AuthorDate: 2021-01-18 07:25:36 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-18 07:51:48 +0000 Add ddb 'show timecounter' command. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/kern/kern_tc.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index cc3219a885ab..07841fd5ca0e 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -2187,3 +2187,33 @@ tc_fill_vdso_timehands32(struct vdso_timehands32 *vdso_th32) return (enabled); } #endif + +#include "opt_ddb.h" +#ifdef DDB +#include + +DB_SHOW_COMMAND(timecounter, db_show_timecounter) +{ + struct timehands *th; + struct timecounter *tc; + u_int val1, val2; + + th = timehands; + tc = th->th_counter; + val1 = tc->tc_get_timecount(tc); + __compiler_membar(); + val2 = tc->tc_get_timecount(tc); + + db_printf("timecounter %p %s\n", tc, tc->tc_name); + db_printf(" mask %#x freq %ju qual %d flags %#x priv %p\n", + tc->tc_counter_mask, (uintmax_t)tc->tc_frequency, tc->tc_quality, + tc->tc_flags, tc->tc_priv); + db_printf(" val %#x %#x\n", val1, val2); + db_printf("timehands adj %#jx scale %#jx ldelta %d off_cnt %d gen %d\n", + (uintmax_t)th->th_adjustment, (uintmax_t)th->th_scale, + th->th_large_delta, th->th_offset_count, th->th_generation); + db_printf(" offset %jd %jd boottime %jd %jd\n", + (intmax_t)th->th_offset.sec, (uintmax_t)th->th_offset.frac, + (intmax_t)th->th_boottime.sec, (uintmax_t)th->th_boottime.frac); +} +#endif From owner-dev-commits-src-main@freebsd.org Mon Jan 18 10:24:08 2021 Return-Path: Delivered-To: dev-commits-src-main@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 828514E78A6; Mon, 18 Jan 2021 10:24:08 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DK7Dm34Ddz3kZF; Mon, 18 Jan 2021 10:24:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C0BA12859; Mon, 18 Jan 2021 10:24:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IAO8wn026819; Mon, 18 Jan 2021 10:24:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IAO8C9026818; Mon, 18 Jan 2021 10:24:08 GMT (envelope-from git) Date: Mon, 18 Jan 2021 10:24:08 GMT Message-Id: <202101181024.10IAO8C9026818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ulrich Spörlein Subject: git: f850fd249668 - main - grep: fix LINKS in Makefile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: uqs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f850fd249668fa82a315353c6d5a147c1b305612 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 10:24:08 -0000 The branch main has been updated by uqs: URL: https://cgit.FreeBSD.org/src/commit/?id=f850fd249668fa82a315353c6d5a147c1b305612 commit f850fd249668fa82a315353c6d5a147c1b305612 Author: Martin Tournoij AuthorDate: 2021-01-17 22:03:04 +0000 Commit: Ulrich Spörlein CommitDate: 2021-01-18 10:22:48 +0000 grep: fix LINKS in Makefile zstdegrep was listed twice, instead of zstdfgrep Pull Request: https://github.com/freebsd/freebsd-src/pull/450 --- usr.bin/grep/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/grep/Makefile b/usr.bin/grep/Makefile index 3210dffd71fb..a6f61b4f9f01 100644 --- a/usr.bin/grep/Makefile +++ b/usr.bin/grep/Makefile @@ -23,7 +23,7 @@ LINKS= ${BINDIR}/zgrep ${BINDIR}/zfgrep \ ${BINDIR}/zgrep ${BINDIR}/xzfgrep \ ${BINDIR}/zgrep ${BINDIR}/zstdgrep \ ${BINDIR}/zgrep ${BINDIR}/zstdegrep \ - ${BINDIR}/zgrep ${BINDIR}/zstdegrep + ${BINDIR}/zgrep ${BINDIR}/zstdfgrep LINKS+= ${BINDIR}/grep ${BINDIR}/egrep \ ${BINDIR}/grep ${BINDIR}/fgrep \ From owner-dev-commits-src-main@freebsd.org Mon Jan 18 12:32:25 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7A9C24EA83D; Mon, 18 Jan 2021 12:32:25 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKB4n32Xnz3sVg; Mon, 18 Jan 2021 12:32:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5ACE313EEB; Mon, 18 Jan 2021 12:32:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10ICWPvd095362; Mon, 18 Jan 2021 12:32:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10ICWP2O095361; Mon, 18 Jan 2021 12:32:25 GMT (envelope-from git) Date: Mon, 18 Jan 2021 12:32:25 GMT Message-Id: <202101181232.10ICWP2O095361@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 7c7c231c1424 - main - netgraph/ng_tag: permit variable length data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c7c231c14246a709270bf3f3a4593208e84d01a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 12:32:25 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=7c7c231c14246a709270bf3f3a4593208e84d01a commit 7c7c231c14246a709270bf3f3a4593208e84d01a Author: Lutz Donnerhacke AuthorDate: 2021-01-02 13:58:17 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-01-18 12:23:22 +0000 netgraph/ng_tag: permit variable length data ng_tag(4) operate on arbitrary data of mbuf_tags(9). Those structures are padded to the next multiple of the alignment by the compiler. Hence a valid argument has be at most as long as the data received. PR: 241462 Reviewed by: kp Approved by: kp (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22140 --- sys/netgraph/ng_tag.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/netgraph/ng_tag.c b/sys/netgraph/ng_tag.c index 364a0bd83dc0..d46c463fc53a 100644 --- a/sys/netgraph/ng_tag.c +++ b/sys/netgraph/ng_tag.c @@ -363,9 +363,8 @@ ng_tag_rcvmsg(node_p node, item_p item, hook_p lasthook) hook_p hook; /* Sanity check. */ - if (msg->header.arglen < sizeof(*hp) - || msg->header.arglen != - NG_TAG_HOOKIN_SIZE(hp->tag_len)) + if (msg->header.arglen < sizeof(*hp) || + msg->header.arglen < NG_TAG_HOOKIN_SIZE(hp->tag_len)) ERROUT(EINVAL); /* Find hook. */ @@ -385,9 +384,8 @@ ng_tag_rcvmsg(node_p node, item_p item, hook_p lasthook) hook_p hook; /* Sanity check. */ - if (msg->header.arglen < sizeof(*hp) - || msg->header.arglen != - NG_TAG_HOOKOUT_SIZE(hp->tag_len)) + if (msg->header.arglen < sizeof(*hp) || + msg->header.arglen < NG_TAG_HOOKOUT_SIZE(hp->tag_len)) ERROUT(EINVAL); /* Find hook. */ From owner-dev-commits-src-main@freebsd.org Mon Jan 18 13:19:26 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1637E4EB837; Mon, 18 Jan 2021 13:19:26 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKC7206Jxz3vfT; Mon, 18 Jan 2021 13:19:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAF9B148BC; Mon, 18 Jan 2021 13:19:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IDJPlP048356; Mon, 18 Jan 2021 13:19:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IDJPHR048355; Mon, 18 Jan 2021 13:19:25 GMT (envelope-from git) Date: Mon, 18 Jan 2021 13:19:25 GMT Message-Id: <202101181319.10IDJPHR048355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: c3e75b6c1a02 - main - netgraph/ng_one2main: Clarification in comments about copy mode The original comment suggests an optimization, which was proven wrong. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3e75b6c1a02d36b9b6c62511725ab5d3d94fdb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 13:19:26 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=c3e75b6c1a02d36b9b6c62511725ab5d3d94fdb0 commit c3e75b6c1a02d36b9b6c62511725ab5d3d94fdb0 Author: Lutz Donnerhacke AuthorDate: 2021-01-18 13:10:34 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-01-18 13:10:34 +0000 netgraph/ng_one2main: Clarification in comments about copy mode The original comment suggests an optimization, which was proven wrong. Reported by: nc Reviewed by: kp, nc Approved by: kp (mentor) Differential Revision: https://reviews.freebsd.org/D23727 --- sys/netgraph/ng_one2many.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_one2many.c b/sys/netgraph/ng_one2many.c index 501575155e99..aa224e78bb9d 100644 --- a/sys/netgraph/ng_one2many.c +++ b/sys/netgraph/ng_one2many.c @@ -451,15 +451,15 @@ ng_one2many_rcvdata(hook_p hook, item_p item) /* no need to copy data for the 1st one */ dst = &priv->many[priv->activeMany[0]]; - /* make copies of data and send for all links - * except the first one, which we'll do last + /* make modifiable copies of data and send for all + * links except the first one, which we'll do last */ for (i = 1; i < priv->numActiveMany; i++) { struct mbuf *m2; struct ng_one2many_link *mdst; mdst = &priv->many[priv->activeMany[i]]; - m2 = m_dup(m, M_NOWAIT); /* XXX m_copypacket() */ + m2 = m_dup(m, M_NOWAIT); if (m2 == NULL) { mdst->stats.memoryFailures++; NG_FREE_ITEM(item); From owner-dev-commits-src-main@freebsd.org Mon Jan 18 14:46:06 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C400D4ED985; Mon, 18 Jan 2021 14:46:06 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKF311t44z4Vgp; Mon, 18 Jan 2021 14:46:04 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 1542B26050E; Mon, 18 Jan 2021 15:45:57 +0100 (CET) Subject: Re: git: ec25b6fa5ffd - main - LinuxKPI: Reimplement irq_work queue on top of fast taskqueue To: Emmanuel Vadot , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101171147.10HBlhip057611@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: <40992eaf-97bd-b9fc-258a-63367aedc607@selasky.org> Date: Mon, 18 Jan 2021 15:45:43 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <202101171147.10HBlhip057611@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DKF311t44z4Vgp X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; 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.10)[text/plain]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; RBL_DBL_DONT_QUERY_IPS(0.00)[88.99.82.50:from]; DMARC_NA(0.00)[selasky.org]; SPAMHAUS_ZRD(0.00)[88.99.82.50:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 14:46:06 -0000 On 1/17/21 12:47 PM, Emmanuel Vadot wrote: > diff --git a/sys/compat/linuxkpi/common/include/linux/llist.h b/sys/compat/linuxkpi/common/include/linux/llist.h > new file mode 100644 > index 000000000000..b3c89516e710 > --- /dev/null > +++ b/sys/compat/linuxkpi/common/include/linux/llist.h > @@ -0,0 +1,101 @@ > +/* Public domain. */ Hi, Could you put a proper license text here? --HPS From owner-dev-commits-src-main@freebsd.org Mon Jan 18 14:51:56 2021 Return-Path: Delivered-To: dev-commits-src-main@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 84A2D4ED964; Mon, 18 Jan 2021 14:51:56 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKF9l6vcRz4WRR; Mon, 18 Jan 2021 14:51:55 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1610981507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1OqPA5QumwR/BKybXwTzM/grv7bFkasDFsVmQWeA53M=; b=Ow+Rf90B1yS1uIKGInsfmbwbm8Lm5t2lflx2uQsCr4QSaCJl1o4RqzbDH6BgvwWzkjd+Ux YRCG6YNqJds7KVx0HyMrsCU9WwTFtn5QDOhBJsAkf7VMtDik049Z62emNdrcy/xVFmgP+Z s/JzIJuwcFrIMfb7aBzqeJ1zmwWaQ/8= Received: from amy.home (lfbn-idf2-1-745-114.w86-247.abo.wanadoo.fr [86.247.192.114]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 02835d0f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 18 Jan 2021 14:51:47 +0000 (UTC) Date: Mon, 18 Jan 2021 15:51:47 +0100 From: Emmanuel Vadot To: Hans Petter Selasky Cc: Emmanuel Vadot , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: ec25b6fa5ffd - main - LinuxKPI: Reimplement irq_work queue on top of fast taskqueue Message-Id: <20210118155147.7bfc3adb93b21018c2076def@bidouilliste.com> In-Reply-To: <40992eaf-97bd-b9fc-258a-63367aedc607@selasky.org> References: <202101171147.10HBlhip057611@gitrepo.freebsd.org> <40992eaf-97bd-b9fc-258a-63367aedc607@selasky.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DKF9l6vcRz4WRR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 14:51:56 -0000 On Mon, 18 Jan 2021 15:45:43 +0100 Hans Petter Selasky wrote: > On 1/17/21 12:47 PM, Emmanuel Vadot wrote: > > diff --git a/sys/compat/linuxkpi/common/include/linux/llist.h b/sys/compat/linuxkpi/common/include/linux/llist.h > > new file mode 100644 > > index 000000000000..b3c89516e710 > > --- /dev/null > > +++ b/sys/compat/linuxkpi/common/include/linux/llist.h > > @@ -0,0 +1,101 @@ > > +/* Public domain. */ > > Hi, > > Could you put a proper license text here? > > --HPS I think that wulf@ adapted this one from the OpenBSD version. https://github.com/openbsd/src/blob/master/sys/dev/pci/drm/include/linux/llist.h -- Emmanuel Vadot From owner-dev-commits-src-main@freebsd.org Mon Jan 18 15:15:10 2021 Return-Path: Delivered-To: dev-commits-src-main@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 09E0F4EDD71; Mon, 18 Jan 2021 15:15:10 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp.infotel.ru (corp.infotel.ru [195.170.219.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4DKFhY60mPz4XRy; Mon, 18 Jan 2021 15:15:09 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp (corp.infotel.ru [195.170.219.3]) by corp.infotel.ru (Postfix) with ESMTP id A7396197A33; Mon, 18 Jan 2021 18:15:00 +0300 (MSK) X-Virus-Scanned: amavisd-new at corp.infotel.ru Received: from corp.infotel.ru ([195.170.219.3]) by corp (corp.infotel.ru [195.170.219.3]) (amavisd-new, port 10024) with ESMTP id b2WMqEYrF90g; Mon, 18 Jan 2021 18:14:56 +0300 (MSK) Received: from mail.cicgroup.ru (unknown [195.170.219.74]) by corp.infotel.ru (Postfix) with ESMTP id 2D3B2197A26; Mon, 18 Jan 2021 18:14:56 +0300 (MSK) Received: from mail.cicgroup.ru (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTP id 8520642211F; Mon, 18 Jan 2021 18:14:55 +0300 (MSK) Received: from mail.cicgroup.ru ([127.0.0.1]) by mail.cicgroup.ru (mail.cicgroup.ru [127.0.0.1]) (amavisd-new, port 10024) with SMTP id DsDoHgivWMQ0; Mon, 18 Jan 2021 18:14:44 +0300 (MSK) Received: from [192.168.0.30] (gateway [10.0.2.2]) by mail.cicgroup.ru (Postfix) with ESMTPA id 7ADCA42211C; Mon, 18 Jan 2021 18:14:44 +0300 (MSK) Subject: Re: git: ec25b6fa5ffd - main - LinuxKPI: Reimplement irq_work queue on top of fast taskqueue To: Emmanuel Vadot , Hans Petter Selasky Cc: Emmanuel Vadot , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101171147.10HBlhip057611@gitrepo.freebsd.org> <40992eaf-97bd-b9fc-258a-63367aedc607@selasky.org> <20210118155147.7bfc3adb93b21018c2076def@bidouilliste.com> From: Vladimir Kondratyev Message-ID: Date: Mon, 18 Jan 2021 18:14:39 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210118155147.7bfc3adb93b21018c2076def@bidouilliste.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DKFhY60mPz4XRy X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 15:15:10 -0000 On 18.01.2021 17:51, Emmanuel Vadot wrote: > On Mon, 18 Jan 2021 15:45:43 +0100 > Hans Petter Selasky wrote: > >> On 1/17/21 12:47 PM, Emmanuel Vadot wrote: >>> diff --git a/sys/compat/linuxkpi/common/include/linux/llist.h b/sys/compat/linuxkpi/common/include/linux/llist.h >>> new file mode 100644 >>> index 000000000000..b3c89516e710 >>> --- /dev/null >>> +++ b/sys/compat/linuxkpi/common/include/linux/llist.h >>> @@ -0,0 +1,101 @@ >>> +/* Public domain. */ >> >> Hi, >> >> Could you put a proper license text here? >> >> --HPS > > I think that wulf@ adapted this one from the OpenBSD version. > https://github.com/openbsd/src/blob/master/sys/dev/pci/drm/include/linux/llist.h > Yes. The file and license header is taken from OpenBSD. From owner-dev-commits-src-main@freebsd.org Mon Jan 18 15:23:59 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D311E4EE14C; Mon, 18 Jan 2021 15:23:59 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKFtl4F5yz4Xr3; Mon, 18 Jan 2021 15:23:59 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 10IFNvk6062506; Mon, 18 Jan 2021 07:23:57 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 10IFNvck062505; Mon, 18 Jan 2021 07:23:57 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202101181523.10IFNvck062505@gndrsh.dnsmgr.net> Subject: Re: git: ec25b6fa5ffd - main - LinuxKPI: Reimplement irq_work queue on top of fast taskqueue In-Reply-To: To: Vladimir Kondratyev Date: Mon, 18 Jan 2021 07:23:57 -0800 (PST) CC: Emmanuel Vadot , Hans Petter Selasky , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4DKFtl4F5yz4Xr3 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 15:23:59 -0000 > On 18.01.2021 17:51, Emmanuel Vadot wrote: > > On Mon, 18 Jan 2021 15:45:43 +0100 > > Hans Petter Selasky wrote: > > > >> On 1/17/21 12:47 PM, Emmanuel Vadot wrote: > >>> diff --git a/sys/compat/linuxkpi/common/include/linux/llist.h b/sys/compat/linuxkpi/common/include/linux/llist.h > >>> new file mode 100644 > >>> index 000000000000..b3c89516e710 > >>> --- /dev/null > >>> +++ b/sys/compat/linuxkpi/common/include/linux/llist.h > >>> @@ -0,0 +1,101 @@ > >>> +/* Public domain. */ > >> > >> Hi, > >> > >> Could you put a proper license text here? > >> > >> --HPS > > > > I think that wulf@ adapted this one from the OpenBSD version. > > https://github.com/openbsd/src/blob/master/sys/dev/pci/drm/include/linux/llist.h > > > > Yes. The file and license header is taken from OpenBSD. The above comes up a bit short on the recommended minimal text: "this work is dedicated to the public domain" And more normative the author that wrote it should do something more like: The person who associated a work with this deed has dedicated the work to the public domain by waiving all of his or her rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission. (above text taken from CC0) -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-main@freebsd.org Mon Jan 18 15:35:27 2021 Return-Path: Delivered-To: dev-commits-src-main@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 965124EE3C6; Mon, 18 Jan 2021 15:35:27 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKG7y6jSyz4Ynd; Mon, 18 Jan 2021 15:35:26 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1610984125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=auqDFb932I9nBU4SN51IQ0RR3e7TtG1u1eW827nnYqk=; b=cbdXkHghJlYFOUnppouVNxUn4kaRmsbspLspguGIlToWcaflFoh1IuOr0UUIM9m4oiA8j6 rdFamOYqfSVzM3lefBYNXmPsON2jWhLy1tG4Oqm6lmFtEtZDnB2wn9bXpGr9RDHnZprYqC aDZDtpaUCOYjZTnUf7CsECjdoCNYJNA= Received: from amy.home (lfbn-idf2-1-745-114.w86-247.abo.wanadoo.fr [86.247.192.114]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 5f20f22a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 18 Jan 2021 15:35:25 +0000 (UTC) Date: Mon, 18 Jan 2021 16:35:24 +0100 From: Emmanuel Vadot To: rgrimes@freebsd.org Cc: "Rodney W. Grimes" , Vladimir Kondratyev , Hans Petter Selasky , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ec25b6fa5ffd - main - LinuxKPI: Reimplement irq_work queue on top of fast taskqueue Message-Id: <20210118163524.fe600e540cccecdd41b04300@bidouilliste.com> In-Reply-To: <202101181523.10IFNvck062505@gndrsh.dnsmgr.net> References: <202101181523.10IFNvck062505@gndrsh.dnsmgr.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DKG7y6jSyz4Ynd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 15:35:27 -0000 On Mon, 18 Jan 2021 07:23:57 -0800 (PST) "Rodney W. Grimes" wrote: > > On 18.01.2021 17:51, Emmanuel Vadot wrote: > > > On Mon, 18 Jan 2021 15:45:43 +0100 > > > Hans Petter Selasky wrote: > > > > > >> On 1/17/21 12:47 PM, Emmanuel Vadot wrote: > > >>> diff --git a/sys/compat/linuxkpi/common/include/linux/llist.h b/sys/compat/linuxkpi/common/include/linux/llist.h > > >>> new file mode 100644 > > >>> index 000000000000..b3c89516e710 > > >>> --- /dev/null > > >>> +++ b/sys/compat/linuxkpi/common/include/linux/llist.h > > >>> @@ -0,0 +1,101 @@ > > >>> +/* Public domain. */ > > >> > > >> Hi, > > >> > > >> Could you put a proper license text here? > > >> > > >> --HPS > > > > > > I think that wulf@ adapted this one from the OpenBSD version. > > > https://github.com/openbsd/src/blob/master/sys/dev/pci/drm/include/linux/llist.h > > > > > > > Yes. The file and license header is taken from OpenBSD. > > The above comes up a bit short on the recommended minimal text: > "this work is dedicated to the public domain" > > And more normative the author that wrote it should do something more like: > > The person who associated a work with this deed has dedicated the > work to the public domain by waiving all of his or her rights to > the work worldwide under copyright law, including all related and > neighboring rights, to the extent allowed by law. You can copy, > modify, distribute and perform the work, even for commercial > purposes, all without asking permission. > > > (above text taken from CC0) > -- > Rod Grimes rgrimes@freebsd.org Tell that to OpenBSD and if they change it we will sync. -- Emmanuel Vadot From owner-dev-commits-src-main@freebsd.org Mon Jan 18 15:49:40 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9EAF84EEA91; Mon, 18 Jan 2021 15:49:40 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKGSN2VKCz4Z9w; Mon, 18 Jan 2021 15:49:39 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 10IFnV9V062655; Mon, 18 Jan 2021 07:49:31 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 10IFnVjE062654; Mon, 18 Jan 2021 07:49:31 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202101181549.10IFnVjE062654@gndrsh.dnsmgr.net> Subject: Re: git: ec25b6fa5ffd - main - LinuxKPI: Reimplement irq_work queue on top of fast taskqueue In-Reply-To: <20210118163524.fe600e540cccecdd41b04300@bidouilliste.com> To: Emmanuel Vadot Date: Mon, 18 Jan 2021 07:49:31 -0800 (PST) CC: rgrimes@freebsd.org, "Rodney W. Grimes" , Vladimir Kondratyev , Hans Petter Selasky , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4DKGSN2VKCz4Z9w X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 15:49:40 -0000 > On Mon, 18 Jan 2021 07:23:57 -0800 (PST) > "Rodney W. Grimes" wrote: > > > > On 18.01.2021 17:51, Emmanuel Vadot wrote: > > > > On Mon, 18 Jan 2021 15:45:43 +0100 > > > > Hans Petter Selasky wrote: > > > > > > > >> On 1/17/21 12:47 PM, Emmanuel Vadot wrote: > > > >>> diff --git a/sys/compat/linuxkpi/common/include/linux/llist.h b/sys/compat/linuxkpi/common/include/linux/llist.h > > > >>> new file mode 100644 > > > >>> index 000000000000..b3c89516e710 > > > >>> --- /dev/null > > > >>> +++ b/sys/compat/linuxkpi/common/include/linux/llist.h > > > >>> @@ -0,0 +1,101 @@ > > > >>> +/* Public domain. */ > > > >> > > > >> Hi, > > > >> > > > >> Could you put a proper license text here? > > > >> > > > >> --HPS > > > > > > > > I think that wulf@ adapted this one from the OpenBSD version. > > > > https://github.com/openbsd/src/blob/master/sys/dev/pci/drm/include/linux/llist.h > > > > > > > > > > Yes. The file and license header is taken from OpenBSD. > > > > The above comes up a bit short on the recommended minimal text: > > "this work is dedicated to the public domain" > > > > And more normative the author that wrote it should do something more like: > > > > The person who associated a work with this deed has dedicated the > > work to the public domain by waiving all of his or her rights to > > the work worldwide under copyright law, including all related and > > neighboring rights, to the extent allowed by law. You can copy, > > modify, distribute and perform the work, even for commercial > > purposes, all without asking permission. > > > > > > (above text taken from CC0) > > -- > > Rod Grimes rgrimes@freebsd.org > > Tell that to OpenBSD and if they change it we will sync. I am not the person who imported this code to FreeBSD, it is not my responsibilty to insure proper licence or copyright, that is the responsibility of the committer who commited it. -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-main@freebsd.org Mon Jan 18 15:56:16 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1C94F4EEFD5; Mon, 18 Jan 2021 15:56:16 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKGbz3Fshz4b3b; Mon, 18 Jan 2021 15:56:15 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1610985373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YMVWY6Z/XVf43kGrDvhqvyIzXjBqGhJNLGMa6OySwAs=; b=WQMu+GBouv/lNBlhMDCtcdfeTDy8sI2B3HzpV0+V994F/ruImW1sxjadOIIu56QC5DaTul 7QCI0UO2VJuDiU4A2MqO+WhZSCJ0COnMxxZxFkTxiN7nUy8v7zEdqmcBPllb+pm4PcWoh8 85WjWou3h1zGxgOQ+r9w1Hi+Cw3ne2c= Received: from amy.home (lfbn-idf2-1-745-114.w86-247.abo.wanadoo.fr [86.247.192.114]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 1fc8114f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 18 Jan 2021 15:56:13 +0000 (UTC) Date: Mon, 18 Jan 2021 16:56:13 +0100 From: Emmanuel Vadot To: rgrimes@freebsd.org Cc: "Rodney W. Grimes" , Vladimir Kondratyev , Hans Petter Selasky , Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ec25b6fa5ffd - main - LinuxKPI: Reimplement irq_work queue on top of fast taskqueue Message-Id: <20210118165613.21f90f4dc5eacb388a4b2918@bidouilliste.com> In-Reply-To: <202101181549.10IFnVjE062654@gndrsh.dnsmgr.net> References: <20210118163524.fe600e540cccecdd41b04300@bidouilliste.com> <202101181549.10IFnVjE062654@gndrsh.dnsmgr.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DKGbz3Fshz4b3b X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 15:56:16 -0000 On Mon, 18 Jan 2021 07:49:31 -0800 (PST) "Rodney W. Grimes" wrote: > > On Mon, 18 Jan 2021 07:23:57 -0800 (PST) > > "Rodney W. Grimes" wrote: > > > > > > On 18.01.2021 17:51, Emmanuel Vadot wrote: > > > > > On Mon, 18 Jan 2021 15:45:43 +0100 > > > > > Hans Petter Selasky wrote: > > > > > > > > > >> On 1/17/21 12:47 PM, Emmanuel Vadot wrote: > > > > >>> diff --git a/sys/compat/linuxkpi/common/include/linux/llist.h b/sys/compat/linuxkpi/common/include/linux/llist.h > > > > >>> new file mode 100644 > > > > >>> index 000000000000..b3c89516e710 > > > > >>> --- /dev/null > > > > >>> +++ b/sys/compat/linuxkpi/common/include/linux/llist.h > > > > >>> @@ -0,0 +1,101 @@ > > > > >>> +/* Public domain. */ > > > > >> > > > > >> Hi, > > > > >> > > > > >> Could you put a proper license text here? > > > > >> > > > > >> --HPS > > > > > > > > > > I think that wulf@ adapted this one from the OpenBSD version. > > > > > https://github.com/openbsd/src/blob/master/sys/dev/pci/drm/include/linux/llist.h > > > > > > > > > > > > > Yes. The file and license header is taken from OpenBSD. > > > > > > The above comes up a bit short on the recommended minimal text: > > > "this work is dedicated to the public domain" > > > > > > And more normative the author that wrote it should do something more like: > > > > > > The person who associated a work with this deed has dedicated the > > > work to the public domain by waiving all of his or her rights to > > > the work worldwide under copyright law, including all related and > > > neighboring rights, to the extent allowed by law. You can copy, > > > modify, distribute and perform the work, even for commercial > > > purposes, all without asking permission. > > > > > > > > > (above text taken from CC0) > > > -- > > > Rod Grimes rgrimes@freebsd.org > > > > Tell that to OpenBSD and if they change it we will sync. > > I am not the person who imported this code to FreeBSD, it is not my > responsibilty to insure proper licence or copyright, that is the > responsibility of the committer who commited it. > > -- > Rod Grimes rgrimes@freebsd.org And both the author and commiter (in git terms) don't have a problem with this code or the attribution in the public domain. -- Emmanuel Vadot From owner-dev-commits-src-main@freebsd.org Mon Jan 18 18:31:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 590C64F2AE5; Mon, 18 Jan 2021 18:31:02 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKL2Z1mLdz4nwY; Mon, 18 Jan 2021 18:31:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FAD318A90; Mon, 18 Jan 2021 18:31:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IIV2hf059800; Mon, 18 Jan 2021 18:31:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IIV2oV059799; Mon, 18 Jan 2021 18:31:02 GMT (envelope-from git) Date: Mon, 18 Jan 2021 18:31:02 GMT Message-Id: <202101181831.10IIV2oV059799@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: efa9c21bca98 - main - KTLS: Enable KERN_TLS in GENERIC on amd64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: efa9c21bca9873af9c9660f5aeffda9d5ae1dfb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 18:31:02 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=efa9c21bca9873af9c9660f5aeffda9d5ae1dfb7 commit efa9c21bca9873af9c9660f5aeffda9d5ae1dfb7 Author: Andrew Gallatin AuthorDate: 2021-01-14 17:44:06 +0000 Commit: Andrew Gallatin CommitDate: 2021-01-18 18:29:10 +0000 KTLS: Enable KERN_TLS in GENERIC on amd64 Based on discussions on freebsd-arch@, enable KERN_TLS in GENERIC on amd64, but leave it disabled via the sysctl kern.ipc.tls.enable. Users wishing to enable ktls must set kern.ipc.tls.enable=1 While here, fix wording in NOTES to mention that KERN_TLS also does receive now. Sponsored by: Netflix Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D28163 --- sys/amd64/conf/GENERIC | 1 + sys/conf/NOTES | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index c9ab23bb91b5..9f55a935f8a5 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -37,6 +37,7 @@ options TCP_BLACKBOX # Enhanced TCP event logging options TCP_HHOOK # hhook(9) framework for TCP options TCP_RFC7413 # TCP Fast Open options SCTP_SUPPORT # Allow kldload of SCTP +options KERN_TLS # TLS transmit & receive offload options FFS # Berkeley Fast Filesystem options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 1a8059a2e5c0..b4202bb65618 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -666,8 +666,8 @@ options IPSEC_SUPPORT #options IPSEC_DEBUG #debug for IP security -# TLS framing and encryption of data transmitted over TCP sockets. -options KERN_TLS # TLS transmit offload +# TLS framing and encryption/decryption of data over TCP sockets. +options KERN_TLS # TLS transmit and receive offload # # SMB/CIFS requester From owner-dev-commits-src-main@freebsd.org Mon Jan 18 18:58:09 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AD5464F3441; Mon, 18 Jan 2021 18:58:09 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKLds4Ypfz4qy7; Mon, 18 Jan 2021 18:58:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F5BA19093; Mon, 18 Jan 2021 18:58:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IIw95u090965; Mon, 18 Jan 2021 18:58:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IIw95j090964; Mon, 18 Jan 2021 18:58:09 GMT (envelope-from git) Date: Mon, 18 Jan 2021 18:58:09 GMT Message-Id: <202101181858.10IIw95j090964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 76ad42abf9d4 - main - jail: Add prison_isvalid() and prison_isalive() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 76ad42abf9d46c7a86c9e727603fe62e8b62a37b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 18:58:09 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=76ad42abf9d46c7a86c9e727603fe62e8b62a37b commit 76ad42abf9d46c7a86c9e727603fe62e8b62a37b Author: Jamie Gritton AuthorDate: 2021-01-18 18:56:20 +0000 Commit: Jamie Gritton CommitDate: 2021-01-18 18:56:20 +0000 jail: Add prison_isvalid() and prison_isalive() prison_isvalid() checks if a prison record can be used at all, i.e. pr_ref > 0. This filters out prisons that aren't fully created, and those that are either in the process of being dismantled, or will be at the next opportunity. While the check for pr_ref > 0 is simple enough to make without a convenience function, this prepares the way for other measures of prison validity. prison_isalive() checks not only validity as far as the useablity of the prison structure, but also whether the prison is visible to user space. It replaces a test for pr_uref > 0, which is currently only used within kern_jail.c, and not often there. Both of these functions also assert that either the prison mutex or allprison_lock is held, since it's generally the case that unlocked prisons aren't guaranteed to remain useable for any length of time. This isn't entirely true, for example a thread can assume its own prison is good, but most exceptions will exist inside of kern_jail.c. --- sys/kern/kern_jail.c | 104 +++++++++++++++++++++++++++++++------------------ sys/kern/sysv_msg.c | 2 +- sys/kern/sysv_sem.c | 2 +- sys/kern/sysv_shm.c | 2 +- sys/kern/uipc_mqueue.c | 3 +- sys/sys/jail.h | 2 + 6 files changed, 73 insertions(+), 42 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index ff540875c90e..ba4c1aab0d85 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1008,7 +1008,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) TAILQ_FOREACH(inspr, &allprison, pr_list) { if (inspr->pr_id == jid) { mtx_lock(&inspr->pr_mtx); - if (inspr->pr_ref > 0) { + if (prison_isvalid(inspr)) { pr = inspr; drflags |= PD_LOCKED; inspr = NULL; @@ -1041,7 +1041,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = ENOENT; vfs_opterror(opts, "jail %d not found", jid); goto done_deref; - } else if (pr->pr_uref == 0) { + } else if (!prison_isalive(pr)) { if (!(flags & JAIL_DYING)) { error = ENOENT; vfs_opterror(opts, "jail %d is dying", @@ -1118,24 +1118,18 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) FOREACH_PRISON_CHILD(ppr, tpr) { if (tpr != pr && tpr->pr_ref > 0 && !strcmp(tpr->pr_name + pnamelen, namelc)) { - if (pr == NULL && - cuflags != JAIL_CREATE) { - mtx_lock(&tpr->pr_mtx); - if (tpr->pr_ref > 0) { + mtx_lock(&tpr->pr_mtx); + drflags |= PD_LOCKED; + if (prison_isalive(tpr)) { + if (pr == NULL && + cuflags != JAIL_CREATE) { /* * Use this jail * for updates. */ - if (tpr->pr_uref > 0) { - pr = tpr; - drflags |= - PD_LOCKED; - break; - } - deadpr = tpr; + pr = tpr; + break; } - mtx_unlock(&tpr->pr_mtx); - } else if (tpr->pr_uref > 0) { /* * Create, or update(jid): * name must not exist in an @@ -1147,13 +1141,19 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) name); goto done_deref; } + if (pr == NULL && + cuflags != JAIL_CREATE && + prison_isvalid(tpr)) + deadpr = tpr; + mtx_unlock(&tpr->pr_mtx); + drflags &= ~PD_LOCKED; } } /* If no active jail is found, use a dying one. */ if (deadpr != NULL && pr == NULL) { if (flags & JAIL_DYING) { mtx_lock(&deadpr->pr_mtx); - if (deadpr->pr_ref == 0) { + if (!prison_isvalid(deadpr)) { mtx_unlock(&deadpr->pr_mtx); goto name_again; } @@ -1192,7 +1192,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) goto done_deref; } mtx_lock(&ppr->pr_mtx); - if (ppr->pr_ref == 0) { + if (!prison_isvalid(ppr)) { mtx_unlock(&ppr->pr_mtx); error = ENOENT; vfs_opterror(opts, "jail \"%s\" not found", @@ -1735,7 +1735,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * for now, so new ones will remain unseen until after the module * handlers have completed. */ - born = pr->pr_uref == 0; + born = !prison_isalive(pr); if (!created && (ch_flags & PR_PERSIST & (pr_flags ^ pr->pr_flags))) { if (pr_flags & PR_PERSIST) { pr->pr_ref++; @@ -2029,8 +2029,8 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) TAILQ_FOREACH(pr, &allprison, pr_list) { if (pr->pr_id > jid && prison_ischild(mypr, pr)) { mtx_lock(&pr->pr_mtx); - if (pr->pr_ref > 0 && - (pr->pr_uref > 0 || (flags & JAIL_DYING))) + if ((flags & JAIL_DYING) + ? prison_isvalid(pr) : prison_isalive(pr)) break; mtx_unlock(&pr->pr_mtx); } @@ -2051,7 +2051,8 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) pr = prison_find_child(mypr, jid); if (pr != NULL) { drflags |= PD_LOCKED; - if (pr->pr_uref == 0 && !(flags & JAIL_DYING)) { + if (!(prison_isalive(pr) || + (flags & JAIL_DYING))) { error = ENOENT; vfs_opterror(opts, "jail %d is dying", jid); @@ -2075,7 +2076,7 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) pr = prison_find_name(mypr, name); if (pr != NULL) { drflags |= PD_LOCKED; - if (pr->pr_uref == 0 && !(flags & JAIL_DYING)) { + if (!(prison_isalive(pr) || (flags & JAIL_DYING))) { error = ENOENT; vfs_opterror(opts, "jail \"%s\" is dying", name); @@ -2203,7 +2204,7 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) if (error != 0 && error != ENOENT) goto done; } - i = (pr->pr_uref == 0); + i = !prison_isalive(pr); error = vfs_setopt(opts, "dying", &i, sizeof(i)); if (error != 0 && error != ENOENT) goto done; @@ -2314,7 +2315,7 @@ sys_jail_remove(struct thread *td, struct jail_remove_args *uap) lpr = NULL; FOREACH_PRISON_DESCENDANT(pr, cpr, descend) { mtx_lock(&cpr->pr_mtx); - if (cpr->pr_ref > 0) { + if (prison_isvalid(cpr)) { tpr = cpr; cpr->pr_ref++; } else { @@ -2414,11 +2415,8 @@ sys_jail_attach(struct thread *td, struct jail_attach_args *uap) return (EINVAL); } - /* - * Do not allow a process to attach to a prison that is not - * considered to be "alive". - */ - if (pr->pr_uref == 0) { + /* Do not allow a process to attach to a prison that is not alive. */ + if (!prison_isalive(pr)) { mtx_unlock(&pr->pr_mtx); sx_sunlock(&allprison_lock); return (EINVAL); @@ -2514,7 +2512,7 @@ prison_find(int prid) TAILQ_FOREACH(pr, &allprison, pr_list) { if (pr->pr_id == prid) { mtx_lock(&pr->pr_mtx); - if (pr->pr_ref > 0) + if (prison_isvalid(pr)) return (pr); /* * Any active prison with the same ID would have @@ -2542,7 +2540,7 @@ prison_find_child(struct prison *mypr, int prid) FOREACH_PRISON_DESCENDANT(mypr, pr, descend) { if (pr->pr_id == prid) { mtx_lock(&pr->pr_mtx); - if (pr->pr_ref > 0) + if (prison_isvalid(pr)) return (pr); mtx_unlock(&pr->pr_mtx); } @@ -2567,18 +2565,17 @@ prison_find_name(struct prison *mypr, const char *name) FOREACH_PRISON_DESCENDANT(mypr, pr, descend) { if (!strcmp(pr->pr_name + mylen, name)) { mtx_lock(&pr->pr_mtx); - if (pr->pr_ref > 0) { - if (pr->pr_uref > 0) - return (pr); + if (prison_isalive(pr)) + return (pr); + if (prison_isvalid(pr)) deadpr = pr; - } mtx_unlock(&pr->pr_mtx); } } /* There was no valid prison - perhaps there was a dying one. */ if (deadpr != NULL) { mtx_lock(&deadpr->pr_mtx); - if (deadpr->pr_ref == 0) { + if (!prison_isvalid(deadpr)) { mtx_unlock(&deadpr->pr_mtx); goto again; } @@ -2967,6 +2964,37 @@ prison_ischild(struct prison *pr1, struct prison *pr2) return (0); } +/* + * Return true if the prison is currently alive. A prison is alive if it is + * valid and it holds user references. + */ +bool +prison_isalive(struct prison *pr) +{ + + mtx_assert(&pr->pr_mtx, MA_OWNED); + if (__predict_false(pr->pr_ref == 0)) + return (false); + if (__predict_false(pr->pr_uref == 0)) + return (false); + return (true); +} + +/* + * Return true if the prison is currently valid. A prison is valid if it has + * been fully created, and is not being destroyed. Note that dying prisons + * are still considered valid. + */ +bool +prison_isvalid(struct prison *pr) +{ + + mtx_assert(&pr->pr_mtx, MA_OWNED); + if (__predict_false(pr->pr_ref == 0)) + return (false); + return (true); +} + /* * Return 1 if the passed credential is in a jail and that jail does not * have its own virtual network stack, otherwise 0. @@ -3623,14 +3651,14 @@ sysctl_jail_list(SYSCTL_HANDLER_ARGS) cpr->pr_ip6s * sizeof(struct in6_addr)); } #endif - if (cpr->pr_ref == 0) { + if (!prison_isvalid(cpr)) { mtx_unlock(&cpr->pr_mtx); continue; } bzero(xp, sizeof(*xp)); xp->pr_version = XPRISON_VERSION; xp->pr_id = cpr->pr_id; - xp->pr_state = cpr->pr_uref > 0 + xp->pr_state = prison_isalive(cpr) ? PRISON_STATE_ALIVE : PRISON_STATE_DYING; strlcpy(xp->pr_path, prison_path(pr, cpr), sizeof(xp->pr_path)); strlcpy(xp->pr_host, cpr->pr_hostname, sizeof(xp->pr_host)); diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index 098bba612636..f048234f3a33 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -290,7 +290,7 @@ msginit() if (rsv == NULL) rsv = osd_reserve(msg_prison_slot); prison_lock(pr); - if ((pr->pr_allow & PR_ALLOW_SYSVIPC) && pr->pr_ref > 0) { + if (prison_isvalid(pr) && (pr->pr_allow & PR_ALLOW_SYSVIPC)) { (void)osd_jail_set_reserved(pr, msg_prison_slot, rsv, &prison0); rsv = NULL; diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 612f45a3144a..deee60d87a5a 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -321,7 +321,7 @@ seminit(void) if (rsv == NULL) rsv = osd_reserve(sem_prison_slot); prison_lock(pr); - if ((pr->pr_allow & PR_ALLOW_SYSVIPC) && pr->pr_ref > 0) { + if (prison_isvalid(pr) && (pr->pr_allow & PR_ALLOW_SYSVIPC)) { (void)osd_jail_set_reserved(pr, sem_prison_slot, rsv, &prison0); rsv = NULL; diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index eb6c57a77a08..ad5f0030b965 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -979,7 +979,7 @@ shminit(void) if (rsv == NULL) rsv = osd_reserve(shm_prison_slot); prison_lock(pr); - if ((pr->pr_allow & PR_ALLOW_SYSVIPC) && pr->pr_ref > 0) { + if (prison_isvalid(pr) && (pr->pr_allow & PR_ALLOW_SYSVIPC)) { (void)osd_jail_set_reserved(pr, shm_prison_slot, rsv, &prison0); rsv = NULL; diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c index 309fa3423fbd..dc94ce213d08 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -1569,7 +1569,8 @@ mqfs_prison_remove(void *obj, void *data __unused) found = 0; TAILQ_FOREACH(tpr, &allprison, pr_list) { prison_lock(tpr); - if (tpr->pr_root == pr->pr_root && tpr != pr && tpr->pr_ref > 0) + if (tpr != pr && prison_isvalid(tpr) && + tpr->pr_root == pr->pr_root) found = 1; prison_unlock(tpr); } diff --git a/sys/sys/jail.h b/sys/sys/jail.h index 96201b0638b3..67ef9347d093 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -407,6 +407,8 @@ void prison_proc_hold(struct prison *); void prison_proc_free(struct prison *); void prison_set_allow(struct ucred *cred, unsigned flag, int enable); int prison_ischild(struct prison *, struct prison *); +bool prison_isalive(struct prison *); +bool prison_isvalid(struct prison *); int prison_equal_ip4(struct prison *, struct prison *); int prison_get_ip4(struct ucred *cred, struct in_addr *ia); int prison_local_ip4(struct ucred *cred, struct in_addr *ia); From owner-dev-commits-src-main@freebsd.org Mon Jan 18 19:39:01 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B92984F452B; Mon, 18 Jan 2021 19:39:01 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKMY14q4yz4tTW; Mon, 18 Jan 2021 19:39:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9864F1952D; Mon, 18 Jan 2021 19:39:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IJd1ZV043895; Mon, 18 Jan 2021 19:39:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IJd1da043894; Mon, 18 Jan 2021 19:39:01 GMT (envelope-from git) Date: Mon, 18 Jan 2021 19:39:01 GMT Message-Id: <202101181939.10IJd1da043894@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 95ae95d413bd - main - pkgbase: limit PKG_VERSION_FROM calculation to real-update-packages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95ae95d413bdbab9b7360d190a81c18aadf440f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 19:39:01 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=95ae95d413bdbab9b7360d190a81c18aadf440f7 commit 95ae95d413bdbab9b7360d190a81c18aadf440f7 Author: Kyle Evans AuthorDate: 2021-01-18 19:34:54 +0000 Commit: Kyle Evans CommitDate: 2021-01-18 19:34:54 +0000 pkgbase: limit PKG_VERSION_FROM calculation to real-update-packages PKG_ABI is defined in some other targets that do not need to shell out and calculate PKG_VERSION_FROM. Moreover, it produces extra errors when bootstrapping an initial pkgbase repo, as the /latest link doesn't exist yet. --- Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index f77fe5cfa25c..bb3d2f98f4a3 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1872,7 +1872,7 @@ _pkgbootstrap: .PHONY PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI .endif -.if !defined(PKG_VERSION_FROM) +.if !defined(PKG_VERSION_FROM) && make(real-update-packages) .if defined(PKG_ABI) PKG_VERSION_FROM!=/usr/bin/readlink ${REPODIR}/${PKG_ABI}/latest .endif From owner-dev-commits-src-main@freebsd.org Mon Jan 18 20:45:50 2021 Return-Path: Delivered-To: dev-commits-src-main@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 79E624F54B0; Mon, 18 Jan 2021 20:45:50 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward500o.mail.yandex.net (forward500o.mail.yandex.net [37.140.190.195]) (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 4DKP243nHjz3DFS; Mon, 18 Jan 2021 20:45:47 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from iva5-13ec62da2ad0.qloud-c.yandex.net (iva5-13ec62da2ad0.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:9304:0:640:13ec:62da]) by forward500o.mail.yandex.net (Yandex) with ESMTP id 19B5960110; Mon, 18 Jan 2021 23:45:45 +0300 (MSK) Received: from localhost (localhost [::1]) by iva5-13ec62da2ad0.qloud-c.yandex.net (mxback/Yandex) with ESMTP id EidJDCiEPG-jhDqGMDh; Mon, 18 Jan 2021 23:45:44 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1611002744; bh=FY2uM8aG/C3fcCDpCyDRVtnjfgBD18lDQfu6PGQkRCk=; h=References:Date:Message-Id:Subject:In-Reply-To:To:From; b=vieUefFSPQD6+k2qh3B03w9TsvR2ZX04XO1YV5dPASmhhq/NL7EGY78ZTlC8UbWD6 SI70JtcjFrbc+2GpnvtMplkH0U/XuBz50CWSBHRFFpUvMw0cWG17BtzBmc8WktXSgi U8yc0sW1DheRHNI/KzHnv7+x6NSfr4xh1J0fna2o= Received: by iva4-57c3b416b70c.qloud-c.yandex.net with HTTP; Mon, 18 Jan 2021 23:45:43 +0300 From: Alexander V. Chernikov To: Konstantin Belousov , "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" In-Reply-To: <202101171729.10HHTsHk099908@gitrepo.freebsd.org> References: <202101171729.10HHTsHk099908@gitrepo.freebsd.org> Subject: Re: git: 3b15beb30b3b - main - Implement malloc_domainset_aligned(9). MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Mon, 18 Jan 2021 20:45:43 +0000 Message-Id: <124361611001207@mail.yandex.ru> Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 X-Rspamd-Queue-Id: 4DKP243nHjz3DFS X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ipfw.ru header.s=mail header.b=vieUefFS; dmarc=none; spf=pass (mx1.freebsd.org: domain of melifaro@ipfw.ru designates 37.140.190.195 as permitted sender) smtp.mailfrom=melifaro@ipfw.ru X-Spamd-Result: default: False [-3.50 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RWL_MAILSPIKE_VERYGOOD(0.00)[37.140.190.195:from]; R_DKIM_ALLOW(-0.20)[ipfw.ru:s=mail]; FREEFALL_USER(0.00)[melifaro]; 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.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip4:37.140.128.0/18]; ARC_NA(0.00)[]; DMARC_NA(0.00)[ipfw.ru]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[ipfw.ru:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[37.140.190.195:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13238, ipnet:37.140.128.0/18, country:RU]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 20:45:50 -0000 17.01.2021, 17:30, "Konstantin Belousov" : > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57 > > commit 3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57 > Author: Konstantin Belousov > AuthorDate: 2021-01-14 03:59:34 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-01-17 17:29:05 +0000 > >     Implement malloc_domainset_aligned(9). Hi Kostik, This change makes my vm panic in usb code. No dump, as dumpdev not mounted yet. Note: the below lines have been OCR'ed, so there may be some errors. Root mount waiting for: CAM usbus0 usbus1 panic: malloc_domainset_aligned: result not aligned 0xfffff8000551ca80 size 0x180 align 0x100 cpuid = 1 time = 2 KDB: stack backtrace: db_trace_self_urapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004d6345c0 vpanic() at vpanic+0x181 /frame 0xfffffe004d634610 panic() at panic+0x43/frame 0xfffffe004d634670 malloc_domainset_aligned() at malloc_domainset_aligned+0x8e/frame 0xfffffe004d6346a0 bounce_bus_dmamem_alloc() at bounce_bus_dmamem_alloc+0xde/frame 0xfffffe004d6346d0 usb_pc_alloc_mem() at usb_pc_alloc_mem+0x7c/frame 0xfffffe004d634730 usbd_transfer_setup_sub_malloc() at usbd_transfer_setup_sub_malloc+0x2fc/frame 0xfffffe004d6347c0 uhci_xfer_setup() at uhci_xfer_setup+0x1c9/frame 0xfffffe004d634840 usbd_transfer_setup() at usbd_transfer_setup+0x64a/frame 0xfffffe004d634910 usbd_ctr l_transfer_setup() at usbd_ctrl_transfer_setup+0xad/frame 0xfffffe004d634960 usbd_do_reguest_flags() at usbd_do_reguest_flags+0x220/frame 0xfffffe004d6349f0 usbd_reg_set_addressO at usbd_reg_set_address+0x9d/frame 0xfffffe004d634a30 usb_alloc_device() at usb_alloc_device+0x50e/frame 0xfffffe004d634ae0 uhub_explore() at uhub_explore+0x584/frame 0xfffffe004d634b60 usb_bus_explore() at usb_bus_explore+0x117/frame 0xfffffe004d634b80 usb_process() at usb_process+0xf3/frame 0xfffffe004d634bb0 fork_exit() at fork_exit+0x80/frame 0xfffffe004d634bf0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004d634bf0 After converting KASSERT to printf: malloc_domainset_aligned: result not aligned 0xfffff80005309a80 size 0x180 align 0x100 bus_dmamem_alloc failed to align memory properly. malloc_domainset_aligned: result not aligned 0xfffff80005309a80 size 0x180 align 0x100 bus_dmamem_alloc failed to align memory properly. ugen0.2: at usbus0 Root mount waiting for: CAM usbus0 usbus1 malloc_domainset_aligned: result not aligned 0xfffff80005309780 size 0x180 align 0x100 bus_dmamem_alloc failed to align memory properly. malloc_domainset_aligned: result not aligned 0xfffff80005309780 size 0x180 align 0x100 bus_dmamem_alloc failed to align memory properly. ugen0.3: at usbus0 uhub2 on uhub0 uhub2: on usbus0 malloc_domainset_aligned: result not aligned 0xfffff80005309480 size 0x180 align 0x100 bus_dmamem_alloc failed to align memory properly. malloc_domainset_aligned: result not aligned 0xfffff80005309180 size 0x180 align 0x100 bus_dmamem_alloc failed to align memory properly. > >     Change the power-of-two malloc zones to require alignment equal to the >     size [*]. Current uma allocator already provides such alignment, so in >     fact this change does not change anything except providing future-proof >     setup. > >     Suggested by: markj [*] >     Reviewed by: andrew, jah, markj >     Tested by: pho >     MFC after: 1 week >     Sponsored by: The FreeBSD Foundation >     Differential Revision: https://reviews.freebsd.org/D28147 > --- >  sys/kern/kern_malloc.c | 28 +++++++++++++++++++++++++++- >  sys/sys/malloc.h | 3 +++ >  2 files changed, 30 insertions(+), 1 deletion(-) > > diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c > index f79352f2fbfd..232472708b9b 100644 > --- a/sys/kern/kern_malloc.c > +++ b/sys/kern/kern_malloc.c > @@ -763,6 +763,28 @@ malloc_domainset_exec(size_t size, struct malloc_type *mtp, struct domainset *ds >          return (malloc_large(&size, mtp, ds, flags DEBUG_REDZONE_ARG)); >  } > > +void * > +malloc_domainset_aligned(size_t size, size_t align, > + struct malloc_type *mtp, struct domainset *ds, int flags) > +{ > + void *res; > + > + KASSERT(align != 0 && powerof2(align), > + ("malloc_domainset_aligned: wrong align %#zx size %#zx", > + align, size)); > + KASSERT(align <= kmemzones[nitems(kmemzones) - 2].kz_size, > + ("malloc_domainset_aligned: align %#zx (size %#zx) too large", > + align, size)); > + > + if (size < align) > + size = align; > + res = malloc_domainset(size, mtp, ds, flags); > + KASSERT(res == NULL || ((uintptr_t)res & (align - 1)) == 0, > + ("malloc_domainset_aligned: result not aligned %p size %#zx " > + "align %#zx", res, size, align)); > + return (res); > +} > + >  void * >  mallocarray(size_t nmemb, size_t size, struct malloc_type *type, int flags) >  { > @@ -1146,8 +1168,12 @@ mallocinit(void *dummy) >          for (i = 0, indx = 0; kmemzones[indx].kz_size != 0; indx++) { >                  int size = kmemzones[indx].kz_size; >                  const char *name = kmemzones[indx].kz_name; > + size_t align; >                  int subzone; > > + align = UMA_ALIGN_PTR; > + if (powerof2(size) && size > sizeof(void *)) > + align = size - 1; >                  for (subzone = 0; subzone < numzones; subzone++) { >                          kmemzones[indx].kz_zone[subzone] = >                              uma_zcreate(name, size, > @@ -1156,7 +1182,7 @@ mallocinit(void *dummy) >  #else >                              NULL, NULL, NULL, NULL, >  #endif > - UMA_ALIGN_PTR, UMA_ZONE_MALLOC); > + align, UMA_ZONE_MALLOC); >                  } >                  for (;i <= size; i+= KMEM_ZBASE) >                          kmemsize[i >> KMEM_ZSHIFT] = indx; > diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h > index bf87e3168e01..a11dd767efc5 100644 > --- a/sys/sys/malloc.h > +++ b/sys/sys/malloc.h > @@ -261,6 +261,9 @@ void *realloc(void *addr, size_t size, struct malloc_type *type, int flags) >              __result_use_check __alloc_size(2); >  void *reallocf(void *addr, size_t size, struct malloc_type *type, int flags) >              __result_use_check __alloc_size(2); > +void *malloc_domainset_aligned(size_t size, size_t align, > + struct malloc_type *mtp, struct domainset *ds, int flags) > + __malloc_like __result_use_check __alloc_size(1); > >  struct malloc_type *malloc_desc2type(const char *desc); From owner-dev-commits-src-main@freebsd.org Mon Jan 18 21:12:17 2021 Return-Path: Delivered-To: dev-commits-src-main@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 437DB4F5D91; Mon, 18 Jan 2021 21:12:17 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKPcd1KM8z3Ffb; Mon, 18 Jan 2021 21:12:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 206621A8B3; Mon, 18 Jan 2021 21:12:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10ILCHO8071962; Mon, 18 Jan 2021 21:12:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10ILCHoC071957; Mon, 18 Jan 2021 21:12:17 GMT (envelope-from git) Date: Mon, 18 Jan 2021 21:12:17 GMT Message-Id: <202101182112.10ILCHoC071957@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: a520f5ca580f - main - armv8crypto: print a message on probe failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a520f5ca580fcff34fd0d9f0d64a4c165f57eb30 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 21:12:17 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=a520f5ca580fcff34fd0d9f0d64a4c165f57eb30 commit a520f5ca580fcff34fd0d9f0d64a4c165f57eb30 Author: Mitchell Horne AuthorDate: 2021-01-18 20:59:21 +0000 Commit: Mitchell Horne CommitDate: 2021-01-18 20:59:21 +0000 armv8crypto: print a message on probe failure Similar to the message printed by aesni(4), let the user know if the driver is unsupported by their CPU. PR: 252543 Reported by: gbe MFC after: 3 days Sponsored by: The FreeBSD Foundation --- sys/crypto/armv8/armv8_crypto.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index 90d096b53b1a..f296337e6f33 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -112,6 +112,9 @@ armv8_crypto_probe(device_t dev) case ID_AA64ISAR0_AES_PMULL: ret = 0; break; + case ID_AA64ISAR0_AES_NONE: + device_printf(dev, "CPU lacks AES instructions"); + break; } device_set_desc_copy(dev, "AES-CBC,AES-XTS"); From owner-dev-commits-src-main@freebsd.org Mon Jan 18 21:19:51 2021 Return-Path: Delivered-To: dev-commits-src-main@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 3026C4F5F89; Mon, 18 Jan 2021 21:19:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKPnL6dd4z3G63; Mon, 18 Jan 2021 21:19:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 10ILJgo4048490 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 18 Jan 2021 23:19:45 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 10ILJgo4048490 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 10ILJgF8048489; Mon, 18 Jan 2021 23:19:42 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 18 Jan 2021 23:19:42 +0200 From: Konstantin Belousov To: "Alexander V. Chernikov" Cc: Konstantin Belousov , "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" Subject: Re: git: 3b15beb30b3b - main - Implement malloc_domainset_aligned(9). Message-ID: References: <202101171729.10HHTsHk099908@gitrepo.freebsd.org> <124361611001207@mail.yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <124361611001207@mail.yandex.ru> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DKPnL6dd4z3G63 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 21:19:51 -0000 On Mon, Jan 18, 2021 at 08:45:43PM +0000, Alexander V. Chernikov wrote: > 17.01.2021, 17:30, "Konstantin Belousov" : > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57 > > > > commit 3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57 > > Author: Konstantin Belousov > > AuthorDate: 2021-01-14 03:59:34 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-01-17 17:29:05 +0000 > > > >     Implement malloc_domainset_aligned(9). > Hi Kostik, > > This change makes my vm panic in usb code. No dump, as dumpdev not mounted yet. > > Note: the below lines have been OCR'ed, so there may be some errors. > > Root mount waiting for: CAM usbus0 usbus1 > panic: malloc_domainset_aligned: result not aligned 0xfffff8000551ca80 size 0x180 align 0x100 Try this. diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 232472708b9b..7c4cb0f465b2 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -768,20 +768,25 @@ malloc_domainset_aligned(size_t size, size_t align, struct malloc_type *mtp, struct domainset *ds, int flags) { void *res; + size_t asize; KASSERT(align != 0 && powerof2(align), ("malloc_domainset_aligned: wrong align %#zx size %#zx", align, size)); - KASSERT(align <= kmemzones[nitems(kmemzones) - 2].kz_size, + KASSERT(align <= PAGE_SIZE, ("malloc_domainset_aligned: align %#zx (size %#zx) too large", align, size)); if (size < align) - size = align; - res = malloc_domainset(size, mtp, ds, flags); + asize = align; + else if (!powerof2(size)) + asize = roundup2(size, align); + else + asize = size; + res = malloc_domainset(asize, mtp, ds, flags); KASSERT(res == NULL || ((uintptr_t)res & (align - 1)) == 0, ("malloc_domainset_aligned: result not aligned %p size %#zx " - "align %#zx", res, size, align)); + "allocsize %#zx align %#zx", res, size, asize, align)); return (res); } @@ -1173,7 +1178,7 @@ mallocinit(void *dummy) align = UMA_ALIGN_PTR; if (powerof2(size) && size > sizeof(void *)) - align = size - 1; + align = (size <= PAGE_SIZE ? size : PAGE_SIZE) - 1; for (subzone = 0; subzone < numzones; subzone++) { kmemzones[indx].kz_zone[subzone] = uma_zcreate(name, size, From owner-dev-commits-src-main@freebsd.org Mon Jan 18 21:34:13 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D55244F61FC for ; Mon, 18 Jan 2021 21:34:13 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DKQ5x5VGBz3HDF for ; Mon, 18 Jan 2021 21:34:13 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f48.google.com with SMTP id q18so17825740wrn.1 for ; Mon, 18 Jan 2021 13:34:13 -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:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=0Mek7r33VRbbBP12vVvbyDh+krCfeubQG6zBI0saZiI=; b=RsRC78bth6YQnkB+5eadXnuN+YpNTYEjJQ15/EHdi7LoEHtg1f63bd+p9h9/JId3Rr 8Fjqk/Ahh80k2fTdMwca8ISYiG/+at3Wvg5ZK8pElrTmssaxEK1J2ss+K5OT8ZOgQdz6 vxTn3ajJqz59wC8LkCatoSm8Wi09gLh2/pOXAFBu7r24g3ZPqUd4ZJ7TBxXSlhIS9DXW AzmEWEAj7DYmAvvkMSHykG0Rw+gKPWdiO624EG9VkYo2GNp99AVFc5YjmhKr6sBZVKMq c/5cdohat7C1IpuOBit2lb3gic4x8sOyhIqDTf3d9M/2gTeEjUV0WfRQ5ErEUpYQqWwI xyhA== X-Gm-Message-State: AOAM532DtRBsTR1M4csgU2FF0Saldc5i89RNb/S0+E6Hv1sa6u1AycZ/ 8jiwOUVz/M7a3utmX2uBKjKDsDcCwkHSfn2O X-Google-Smtp-Source: ABdhPJxHLn5n86eov8DTTAFT0gwDDruEHGFqZUSdYVNnCakxbWGFjnhf8YIWG8zYIyCpce2mYYNOOA== X-Received: by 2002:a5d:498a:: with SMTP id r10mr1304713wrq.238.1611005652132; Mon, 18 Jan 2021 13:34:12 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id r1sm33306225wrl.95.2021.01.18.13.34.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jan 2021 13:34:11 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 3b15beb30b3b - main - Implement malloc_domainset_aligned(9). From: Jessica Clarke In-Reply-To: Date: Mon, 18 Jan 2021 21:34:10 +0000 Cc: "Alexander V. Chernikov" , Konstantin Belousov , "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" Content-Transfer-Encoding: quoted-printable Message-Id: <3B09F5B7-25CF-4E1F-8516-9226CB0A5B0E@freebsd.org> References: <202101171729.10HHTsHk099908@gitrepo.freebsd.org> <124361611001207@mail.yandex.ru> To: Konstantin Belousov X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DKQ5x5VGBz3HDF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 21:34:13 -0000 On 18 Jan 2021, at 21:19, Konstantin Belousov = wrote: > On Mon, Jan 18, 2021 at 08:45:43PM +0000, Alexander V. Chernikov = wrote: >> 17.01.2021, 17:30, "Konstantin Belousov" : >>> The branch main has been updated by kib: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D3b15beb30b3b4ba17bae3d1d43c8c04f= f862bb57 >>>=20 >>> commit 3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57 >>> Author: Konstantin Belousov >>> AuthorDate: 2021-01-14 03:59:34 +0000 >>> Commit: Konstantin Belousov >>> CommitDate: 2021-01-17 17:29:05 +0000 >>>=20 >>> Implement malloc_domainset_aligned(9). >> Hi Kostik, >>=20 >> This change makes my vm panic in usb code. No dump, as dumpdev not = mounted yet. >>=20 >> Note: the below lines have been OCR'ed, so there may be some errors. >>=20 >> Root mount waiting for: CAM usbus0 usbus1 >> panic: malloc_domainset_aligned: result not aligned = 0xfffff8000551ca80 size 0x180 align 0x100 >=20 > Try this. >=20 > ... > if (size < align) > - size =3D align; > - res =3D malloc_domainset(size, mtp, ds, flags); > + asize =3D align; > + else if (!powerof2(size)) > + asize =3D roundup2(size, align); > + else > + asize =3D size; Why not just `asize =3D roundup2(size, align)`? It's only 3 instructions (4 on Clang due to a missed combine) on amd64 and I'd be very surprised if the branching version were faster even in the fast path case. Plus it's much easier to read; currently it looks like there's something unusual going on but there really isn't. https://godbolt.org/z/rv6qs7 FWIW Jess From owner-dev-commits-src-main@freebsd.org Mon Jan 18 21:48:57 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6B24A4F6A61; Mon, 18 Jan 2021 21:48:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKQQx0lCJz3J08; Mon, 18 Jan 2021 21:48:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 10ILmnqm055696 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 18 Jan 2021 23:48:52 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 10ILmnqm055696 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 10ILmnDk055695; Mon, 18 Jan 2021 23:48:49 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 18 Jan 2021 23:48:49 +0200 From: Konstantin Belousov To: Jessica Clarke Cc: "Alexander V. Chernikov" , "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" Subject: Re: git: 3b15beb30b3b - main - Implement malloc_domainset_aligned(9). Message-ID: References: <202101171729.10HHTsHk099908@gitrepo.freebsd.org> <124361611001207@mail.yandex.ru> <3B09F5B7-25CF-4E1F-8516-9226CB0A5B0E@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3B09F5B7-25CF-4E1F-8516-9226CB0A5B0E@freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DKQQx0lCJz3J08 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 21:48:57 -0000 On Mon, Jan 18, 2021 at 09:34:10PM +0000, Jessica Clarke wrote: > On 18 Jan 2021, at 21:19, Konstantin Belousov wrote: > > On Mon, Jan 18, 2021 at 08:45:43PM +0000, Alexander V. Chernikov wrote: > >> 17.01.2021, 17:30, "Konstantin Belousov" : > >>> The branch main has been updated by kib: > >>> > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57 > >>> > >>> commit 3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57 > >>> Author: Konstantin Belousov > >>> AuthorDate: 2021-01-14 03:59:34 +0000 > >>> Commit: Konstantin Belousov > >>> CommitDate: 2021-01-17 17:29:05 +0000 > >>> > >>> Implement malloc_domainset_aligned(9). > >> Hi Kostik, > >> > >> This change makes my vm panic in usb code. No dump, as dumpdev not mounted yet. > >> > >> Note: the below lines have been OCR'ed, so there may be some errors. > >> > >> Root mount waiting for: CAM usbus0 usbus1 > >> panic: malloc_domainset_aligned: result not aligned 0xfffff8000551ca80 size 0x180 align 0x100 > > > > Try this. > > > > ... > > if (size < align) > > - size = align; > > - res = malloc_domainset(size, mtp, ds, flags); > > + asize = align; > > + else if (!powerof2(size)) > > + asize = roundup2(size, align); > > + else > > + asize = size; > > Why not just `asize = roundup2(size, align)`? It's only 3 instructions > (4 on Clang due to a missed combine) on amd64 and I'd be very surprised > if the branching version were faster even in the fast path case. Plus > it's much easier to read; currently it looks like there's something > unusual going on but there really isn't. > > https://godbolt.org/z/rv6qs7 FWIW Ok, it is D28219. Feel free to stamp. From owner-dev-commits-src-main@freebsd.org Mon Jan 18 22:08:11 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8B1C34F6F75; Mon, 18 Jan 2021 22:08:11 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKQs73WQfz3KG8; Mon, 18 Jan 2021 22:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 676321B592; Mon, 18 Jan 2021 22:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IM8BFs039164; Mon, 18 Jan 2021 22:08:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IM8Bdv039163; Mon, 18 Jan 2021 22:08:11 GMT (envelope-from git) Date: Mon, 18 Jan 2021 22:08:11 GMT Message-Id: <202101182208.10IM8Bdv039163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4af932354260 - main - linuxkpi: Fix the shrinker scan target MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4af93235426012049161d82d7c2a5941f7c0a38b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 22:08:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4af93235426012049161d82d7c2a5941f7c0a38b commit 4af93235426012049161d82d7c2a5941f7c0a38b Author: Mark Johnston AuthorDate: 2021-01-18 22:07:55 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 22:07:55 +0000 linuxkpi: Fix the shrinker scan target Use the number of items scanned to control the duration of the shrink loop. Otherwise, if a consumer like TTM is not able to free the number of items requested for some reason, the shrinker keeps looping forever. Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28224 --- sys/compat/linuxkpi/common/src/linux_shrinker.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_shrinker.c b/sys/compat/linuxkpi/common/src/linux_shrinker.c index adc22cc23510..0423f4e05804 100644 --- a/sys/compat/linuxkpi/common/src/linux_shrinker.c +++ b/sys/compat/linuxkpi/common/src/linux_shrinker.c @@ -71,7 +71,7 @@ shrinker_shrink(struct shrinker *s) struct shrink_control sc; unsigned long can_free; unsigned long batch; - unsigned long freeed = 0; + unsigned long scanned = 0; unsigned long ret; can_free = s->count_objects(s, &sc); @@ -79,12 +79,12 @@ shrinker_shrink(struct shrinker *s) return; batch = s->batch ? s->batch : SHRINKER_BATCH; - while (freeed <= can_free) { + while (scanned <= can_free) { sc.nr_to_scan = batch; ret = s->scan_objects(s, &sc); if (ret == SHRINK_STOP) break; - freeed += ret; + scanned += batch; } } From owner-dev-commits-src-main@freebsd.org Mon Jan 18 22:08:12 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9ED404F6BF4; Mon, 18 Jan 2021 22:08:12 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKQs845Pdz3K7Y; Mon, 18 Jan 2021 22:08:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F5D11B593; Mon, 18 Jan 2021 22:08:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IM8Cx1039186; Mon, 18 Jan 2021 22:08:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IM8COd039185; Mon, 18 Jan 2021 22:08:12 GMT (envelope-from git) Date: Mon, 18 Jan 2021 22:08:12 GMT Message-Id: <202101182208.10IM8COd039185@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e934d455ba37 - main - safexcel: Dispatch requests to the current CPU's ring MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e934d455ba37ea777bd32cdcb0f9754865f9e818 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 22:08:12 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e934d455ba37ea777bd32cdcb0f9754865f9e818 commit e934d455ba37ea777bd32cdcb0f9754865f9e818 Author: Mark Johnston AuthorDate: 2021-01-18 22:07:55 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 22:07:55 +0000 safexcel: Dispatch requests to the current CPU's ring This gives better performance in some tests than the previous policy of statically binding each session to a ring. MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/dev/safexcel/safexcel.c | 25 ++++++++++++++----------- sys/dev/safexcel/safexcel_var.h | 3 +-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index ba65207eb588..c3a2cdcca62d 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -189,6 +190,8 @@ safexcel_rdr_intr(struct safexcel_softc *sc, int ringidx) req = STAILQ_FIRST(&ring->queued_requests); KASSERT(req != NULL, ("%s: expected %d pending requests", __func__, nreqs)); + KASSERT(req->ringidx == ringidx, + ("%s: ring index mismatch", __func__)); STAILQ_REMOVE_HEAD(&ring->queued_requests, link); mtx_unlock(&ring->mtx); @@ -748,9 +751,7 @@ safexcel_execute(struct safexcel_softc *sc, struct safexcel_ring *ring, mtx_assert(&ring->mtx, MA_OWNED); - ringidx = req->sess->ringidx; - if (STAILQ_EMPTY(&ring->ready_requests)) - return; + ringidx = req->ringidx; busy = !STAILQ_EMPTY(&ring->queued_requests); ncdescs = nrdescs = nreqs = 0; while ((req = STAILQ_FIRST(&ring->ready_requests)) != NULL && @@ -1024,7 +1025,7 @@ safexcel_init_hw(struct safexcel_softc *sc) static int safexcel_setup_dev_interrupts(struct safexcel_softc *sc) { - int i, j; + int error, i, j; for (i = 0; i < SAFEXCEL_MAX_RINGS && sc->sc_intr[i] != NULL; i++) { sc->sc_ih[i].sc = sc; @@ -1037,6 +1038,11 @@ safexcel_setup_dev_interrupts(struct safexcel_softc *sc) "couldn't setup interrupt %d\n", i); goto err; } + + error = bus_bind_intr(sc->sc_dev, sc->sc_intr[i], i % mp_ncpus); + if (error != 0) + device_printf(sc->sc_dev, + "failed to bind ring %d\n", error); } return (0); @@ -1175,6 +1181,7 @@ safexcel_attach(device_t dev) for (i = 0; i < SAFEXCEL_REQUESTS_PER_RING; i++) { req = &ring->requests[i]; req->sc = sc; + req->ringidx = ringidx; if (bus_dmamap_create(ring->data_dtag, BUS_DMA_COHERENT, &req->dmap) != 0) { for (j = 0; j < i; j++) @@ -1783,7 +1790,7 @@ safexcel_set_token(struct safexcel_request *req) csp = crypto_get_params(req->crp->crp_session); cdesc = req->cdesc; sc = req->sc; - ringidx = req->sess->ringidx; + ringidx = req->ringidx; safexcel_set_command(req, cdesc); @@ -1999,7 +2006,7 @@ safexcel_create_chain_cb(void *arg, bus_dma_segment_t *segs, int nseg, crp = req->crp; csp = crypto_get_params(crp->crp_session); sess = req->sess; - ring = &req->sc->sc_ring[sess->ringidx]; + ring = &req->sc->sc_ring[req->ringidx]; mtx_assert(&ring->mtx, MA_OWNED); @@ -2527,10 +2534,6 @@ safexcel_newsession(device_t dev, crypto_session_t cses, safexcel_setkey(sess, csp, NULL); - /* Bind each session to a fixed ring to minimize lock contention. */ - sess->ringidx = atomic_fetchadd_int(&sc->sc_ringidx, 1); - sess->ringidx %= sc->sc_config.rings; - return (0); } @@ -2558,7 +2561,7 @@ safexcel_process(device_t dev, struct cryptop *crp, int hint) if (crp->crp_cipher_key != NULL || crp->crp_auth_key != NULL) safexcel_setkey(sess, csp, crp); - ring = &sc->sc_ring[sess->ringidx]; + ring = &sc->sc_ring[curcpu % sc->sc_config.rings]; mtx_lock(&ring->mtx); req = safexcel_alloc_request(sc, ring); if (__predict_false(req == NULL)) { diff --git a/sys/dev/safexcel/safexcel_var.h b/sys/dev/safexcel/safexcel_var.h index 057f9e9be1d5..de65e666a4c3 100644 --- a/sys/dev/safexcel/safexcel_var.h +++ b/sys/dev/safexcel/safexcel_var.h @@ -334,7 +334,6 @@ struct safexcel_res_descr_ring { }; struct safexcel_session { - int ringidx; uint32_t alg; /* cipher algorithm */ uint32_t digest; /* digest type */ uint32_t hash; /* hash algorithm */ @@ -359,6 +358,7 @@ struct safexcel_softc; struct safexcel_request { STAILQ_ENTRY(safexcel_request) link; bool dmap_loaded; + int ringidx; bus_dmamap_t dmap; int error; int cdescs, rdescs; @@ -406,7 +406,6 @@ struct safexcel_softc { struct safexcel_intr_handle sc_ih[SAFEXCEL_MAX_RINGS]; struct safexcel_ring sc_ring[SAFEXCEL_MAX_RINGS]; - int sc_ringidx; int32_t sc_cid; struct safexcel_reg_offsets sc_offsets; From owner-dev-commits-src-main@freebsd.org Mon Jan 18 22:08:14 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E33EA4F7306; Mon, 18 Jan 2021 22:08:14 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKQsB0Zchz3JwD; Mon, 18 Jan 2021 22:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B52761B541; Mon, 18 Jan 2021 22:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IM8DED039205; Mon, 18 Jan 2021 22:08:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IM8D9v039204; Mon, 18 Jan 2021 22:08:13 GMT (envelope-from git) Date: Mon, 18 Jan 2021 22:08:13 GMT Message-Id: <202101182208.10IM8D9v039204@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 0371c3faaa24 - main - safexcel: Add counters for some resource exhaustion conditions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0371c3faaa2412413d4fb44254b03124f97dfe66 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 22:08:15 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0371c3faaa2412413d4fb44254b03124f97dfe66 commit 0371c3faaa2412413d4fb44254b03124f97dfe66 Author: Mark Johnston AuthorDate: 2021-01-18 22:07:55 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 22:07:55 +0000 safexcel: Add counters for some resource exhaustion conditions This is useful when analyzing performance problems. MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/dev/safexcel/safexcel.c | 36 +++++++++++++++++++++++++++++++++--- sys/dev/safexcel/safexcel_var.h | 6 ++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index c3a2cdcca62d..c30b8178efb1 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1149,7 +1150,9 @@ safexcel_probe(device_t dev) static int safexcel_attach(device_t dev) { - struct sysctl_ctx_list *sctx; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *oid; + struct sysctl_oid_list *children; struct safexcel_softc *sc; struct safexcel_request *req; struct safexcel_ring *ring; @@ -1203,11 +1206,30 @@ safexcel_attach(device_t dev) } } - sctx = device_get_sysctl_ctx(dev); - SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + ctx = device_get_sysctl_ctx(dev); + SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "debug", CTLFLAG_RWTUN, &sc->sc_debug, 0, "Debug message verbosity"); + oid = device_get_sysctl_tree(sc->sc_dev); + children = SYSCTL_CHILDREN(oid); + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "statistics"); + children = SYSCTL_CHILDREN(oid); + + sc->sc_req_alloc_failures = counter_u64_alloc(M_WAITOK); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "req_alloc_failures", + CTLFLAG_RD, &sc->sc_req_alloc_failures, + "Number of request allocation failures"); + sc->sc_cdesc_alloc_failures = counter_u64_alloc(M_WAITOK); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "cdesc_alloc_failures", + CTLFLAG_RD, &sc->sc_cdesc_alloc_failures, + "Number of command descriptor ring overflows"); + sc->sc_rdesc_alloc_failures = counter_u64_alloc(M_WAITOK); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "rdesc_alloc_failures", + CTLFLAG_RD, &sc->sc_rdesc_alloc_failures, + "Number of result descriptor ring overflows"); + sc->sc_cid = crypto_get_driverid(dev, sizeof(struct safexcel_session), CRYPTOCAP_F_HARDWARE); if (sc->sc_cid < 0) @@ -1234,6 +1256,11 @@ safexcel_detach(device_t dev) if (sc->sc_cid >= 0) crypto_unregister_all(sc->sc_cid); + + counter_u64_free(sc->sc_req_alloc_failures); + counter_u64_free(sc->sc_cdesc_alloc_failures); + counter_u64_free(sc->sc_rdesc_alloc_failures); + for (ringidx = 0; ringidx < sc->sc_config.rings; ringidx++) { ring = &sc->sc_ring[ringidx]; for (i = 0; i < SAFEXCEL_REQUESTS_PER_RING; i++) { @@ -2065,6 +2092,7 @@ safexcel_create_chain_cb(void *arg, bus_dma_segment_t *segs, int nseg, (uint32_t)inlen, req->ctx.paddr); if (cdesc == NULL) { safexcel_cmd_descr_rollback(ring, i); + counter_u64_add(req->sc->sc_cdesc_alloc_failures, 1); req->error = EAGAIN; return; } @@ -2092,6 +2120,7 @@ safexcel_create_chain_cb(void *arg, bus_dma_segment_t *segs, int nseg, safexcel_cmd_descr_rollback(ring, ring->cmd_data->sg_nseg); safexcel_res_descr_rollback(ring, i); + counter_u64_add(req->sc->sc_rdesc_alloc_failures, 1); req->error = EAGAIN; return; } @@ -2567,6 +2596,7 @@ safexcel_process(device_t dev, struct cryptop *crp, int hint) if (__predict_false(req == NULL)) { ring->blocked = CRYPTO_SYMQ; mtx_unlock(&ring->mtx); + counter_u64_add(sc->sc_req_alloc_failures, 1); return (ERESTART); } diff --git a/sys/dev/safexcel/safexcel_var.h b/sys/dev/safexcel/safexcel_var.h index de65e666a4c3..dab4b17963ab 100644 --- a/sys/dev/safexcel/safexcel_var.h +++ b/sys/dev/safexcel/safexcel_var.h @@ -29,6 +29,8 @@ #ifndef _SAFEXCEL_VAR_H_ #define _SAFEXCEL_VAR_H_ +#include + #define SAFEXCEL_MAX_RINGS 4 #define SAFEXCEL_MAX_BATCH_SIZE 64 #define SAFEXCEL_MAX_FRAGMENTS 64 @@ -405,6 +407,10 @@ struct safexcel_softc { struct resource *sc_intr[SAFEXCEL_MAX_RINGS]; struct safexcel_intr_handle sc_ih[SAFEXCEL_MAX_RINGS]; + counter_u64_t sc_req_alloc_failures; + counter_u64_t sc_cdesc_alloc_failures; + counter_u64_t sc_rdesc_alloc_failures; + struct safexcel_ring sc_ring[SAFEXCEL_MAX_RINGS]; int32_t sc_cid; From owner-dev-commits-src-main@freebsd.org Mon Jan 18 22:08:17 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E38384F6E49; Mon, 18 Jan 2021 22:08:17 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKQsF4q4fz3JpD; Mon, 18 Jan 2021 22:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3FDE1B620; Mon, 18 Jan 2021 22:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IM8FRn039249; Mon, 18 Jan 2021 22:08:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IM8FPG039248; Mon, 18 Jan 2021 22:08:15 GMT (envelope-from git) Date: Mon, 18 Jan 2021 22:08:15 GMT Message-Id: <202101182208.10IM8FPG039248@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1a6ffed5d73a - main - safexcel: Simplify request allocation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a6ffed5d73a22858182e68e629662afda1b9f6d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 22:08:18 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1a6ffed5d73a22858182e68e629662afda1b9f6d commit 1a6ffed5d73a22858182e68e629662afda1b9f6d Author: Mark Johnston AuthorDate: 2021-01-18 22:07:56 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 22:07:56 +0000 safexcel: Simplify request allocation Rather than preallocating a set of requests and moving them between queues during state transitions, maintain a shadow of the command descriptor ring to track the driver context of each request. This is simpler and requires less synchronization between safexcel_process() and the ring interrupt handler. MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/dev/safexcel/safexcel.c | 121 ++++++++++++++++++++-------------------- sys/dev/safexcel/safexcel_var.h | 20 ++++--- 2 files changed, 73 insertions(+), 68 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index 2f0f10f1d5e8..5f66cd9d4abb 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -56,8 +56,6 @@ __FBSDID("$FreeBSD$"); #include "safexcel_reg.h" #include "safexcel_var.h" -static MALLOC_DEFINE(M_SAFEXCEL, "safexcel_req", "safexcel request buffers"); - /* * We only support the EIP97 for now. */ @@ -93,6 +91,17 @@ const struct safexcel_reg_offsets eip197_regs_offset = { .pe = SAFEXCEL_EIP197_PE_BASE, }; +static struct safexcel_request * +safexcel_next_request(struct safexcel_ring *ring) +{ + int i; + + i = ring->cdr.read; + KASSERT(i >= 0 && i < SAFEXCEL_RING_SIZE, + ("%s: out of bounds request index %d", __func__, i)); + return (&ring->requests[i]); +} + static struct safexcel_cmd_descr * safexcel_cmd_descr_next(struct safexcel_cmd_descr_ring *ring) { @@ -120,13 +129,14 @@ safexcel_res_descr_next(struct safexcel_res_descr_ring *ring) static struct safexcel_request * safexcel_alloc_request(struct safexcel_softc *sc, struct safexcel_ring *ring) { - struct safexcel_request *req; + int i; mtx_assert(&ring->mtx, MA_OWNED); - if ((req = STAILQ_FIRST(&ring->free_requests)) != NULL) - STAILQ_REMOVE_HEAD(&ring->free_requests, link); - return (req); + i = ring->cdr.write; + if ((i + 1) % SAFEXCEL_RING_SIZE == ring->cdr.read) + return (NULL); + return (&ring->requests[i]); } static void @@ -143,21 +153,13 @@ safexcel_free_request(struct safexcel_ring *ring, struct safexcel_request *req) ctx = (struct safexcel_context_record *)req->ctx.vaddr; explicit_bzero(ctx->data, sizeof(ctx->data)); explicit_bzero(req->iv, sizeof(req->iv)); - STAILQ_INSERT_TAIL(&ring->free_requests, req, link); -} - -static void -safexcel_enqueue_request(struct safexcel_softc *sc, struct safexcel_ring *ring, - struct safexcel_request *req) -{ - mtx_assert(&ring->mtx, MA_OWNED); - - STAILQ_INSERT_TAIL(&ring->ready_requests, req, link); } static void safexcel_rdr_intr(struct safexcel_softc *sc, int ringidx) { + TAILQ_HEAD(, cryptop) cq; + struct cryptop *crp, *tmp; struct safexcel_cmd_descr *cdesc; struct safexcel_res_descr *rdesc; struct safexcel_request *req; @@ -167,7 +169,6 @@ safexcel_rdr_intr(struct safexcel_softc *sc, int ringidx) blocked = 0; ring = &sc->sc_ring[ringidx]; - mtx_lock(&ring->mtx); nreqs = SAFEXCEL_READ(sc, SAFEXCEL_HIA_RDR(sc, ringidx) + SAFEXCEL_HIA_xDR_PROC_COUNT); nreqs >>= SAFEXCEL_xDR_PROC_xD_PKT_OFFSET; @@ -175,9 +176,12 @@ safexcel_rdr_intr(struct safexcel_softc *sc, int ringidx) if (nreqs == 0) { SAFEXCEL_DPRINTF(sc, 1, "zero pending requests on ring %d\n", ringidx); + mtx_lock(&ring->mtx); goto out; } + TAILQ_INIT(&cq); + ring = &sc->sc_ring[ringidx]; bus_dmamap_sync(ring->rdr.dma.tag, ring->rdr.dma.map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -188,13 +192,7 @@ safexcel_rdr_intr(struct safexcel_softc *sc, int ringidx) ncdescs = nrdescs = 0; for (i = 0; i < nreqs; i++) { - req = STAILQ_FIRST(&ring->queued_requests); - KASSERT(req != NULL, ("%s: expected %d pending requests", - __func__, nreqs)); - KASSERT(req->ringidx == ringidx, - ("%s: ring index mismatch", __func__)); - STAILQ_REMOVE_HEAD(&ring->queued_requests, link); - mtx_unlock(&ring->mtx); + req = safexcel_next_request(ring); bus_dmamap_sync(req->ctx.tag, req->ctx.map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -226,12 +224,16 @@ safexcel_rdr_intr(struct safexcel_softc *sc, int ringidx) } } - crypto_done(req->crp); - mtx_lock(&ring->mtx); - safexcel_free_request(ring, req); + TAILQ_INSERT_TAIL(&cq, req->crp, crp_next); } + mtx_lock(&ring->mtx); if (nreqs != 0) { + KASSERT(ring->queued >= nreqs, + ("%s: request count underflow, %d queued %d completed", + __func__, ring->queued, nreqs)); + ring->queued -= nreqs; + SAFEXCEL_WRITE(sc, SAFEXCEL_HIA_RDR(sc, ringidx) + SAFEXCEL_HIA_xDR_PROC_COUNT, SAFEXCEL_xDR_PROC_xD_PKT(nreqs) | @@ -240,15 +242,18 @@ safexcel_rdr_intr(struct safexcel_softc *sc, int ringidx) ring->blocked = 0; } out: - if (!STAILQ_EMPTY(&ring->queued_requests)) { + if (ring->queued != 0) { SAFEXCEL_WRITE(sc, SAFEXCEL_HIA_RDR(sc, ringidx) + SAFEXCEL_HIA_xDR_THRESH, - SAFEXCEL_HIA_CDR_THRESH_PKT_MODE | 1); + SAFEXCEL_HIA_CDR_THRESH_PKT_MODE | imin(ring->queued, 16)); } mtx_unlock(&ring->mtx); if (blocked) crypto_unblock(sc->sc_cid, blocked); + + TAILQ_FOREACH_SAFE(crp, &cq, crp_next, tmp) + crypto_done(crp); } static void @@ -744,38 +749,40 @@ safexcel_enable_pe_engine(struct safexcel_softc *sc, int pe) static void safexcel_execute(struct safexcel_softc *sc, struct safexcel_ring *ring, - struct safexcel_request *req) + struct safexcel_request *req, int hint) { - uint32_t ncdescs, nrdescs, nreqs; - int ringidx; + int ringidx, ncdesc, nrdesc; bool busy; mtx_assert(&ring->mtx, MA_OWNED); - ringidx = req->ringidx; - busy = !STAILQ_EMPTY(&ring->queued_requests); - ncdescs = nrdescs = nreqs = 0; - while ((req = STAILQ_FIRST(&ring->ready_requests)) != NULL && - req->cdescs + ncdescs <= SAFEXCEL_MAX_BATCH_SIZE && - req->rdescs + nrdescs <= SAFEXCEL_MAX_BATCH_SIZE) { - STAILQ_REMOVE_HEAD(&ring->ready_requests, link); - STAILQ_INSERT_TAIL(&ring->queued_requests, req, link); - ncdescs += req->cdescs; - nrdescs += req->rdescs; - nreqs++; + if ((hint & CRYPTO_HINT_MORE) != 0) { + ring->pending++; + ring->pending_cdesc += req->cdescs; + ring->pending_rdesc += req->rdescs; + return; } + ringidx = req->ringidx; + + busy = ring->queued != 0; + ncdesc = ring->pending_cdesc + req->cdescs; + nrdesc = ring->pending_rdesc + req->rdescs; + ring->queued += ring->pending + 1; + if (!busy) { SAFEXCEL_WRITE(sc, SAFEXCEL_HIA_RDR(sc, ringidx) + SAFEXCEL_HIA_xDR_THRESH, - SAFEXCEL_HIA_CDR_THRESH_PKT_MODE | nreqs); + SAFEXCEL_HIA_CDR_THRESH_PKT_MODE | ring->queued); } SAFEXCEL_WRITE(sc, SAFEXCEL_HIA_RDR(sc, ringidx) + SAFEXCEL_HIA_xDR_PREP_COUNT, - nrdescs * sc->sc_config.rd_offset * sizeof(uint32_t)); + nrdesc * sc->sc_config.rd_offset * sizeof(uint32_t)); SAFEXCEL_WRITE(sc, SAFEXCEL_HIA_CDR(sc, ringidx) + SAFEXCEL_HIA_xDR_PREP_COUNT, - ncdescs * sc->sc_config.cd_offset * sizeof(uint32_t)); + ncdesc * sc->sc_config.cd_offset * sizeof(uint32_t)); + + ring->pending = ring->pending_cdesc = ring->pending_rdesc = 0; } static void @@ -792,10 +799,9 @@ safexcel_init_rings(struct safexcel_softc *sc) snprintf(ring->lockname, sizeof(ring->lockname), "safexcel_ring%d", i); mtx_init(&ring->mtx, ring->lockname, NULL, MTX_DEF); - STAILQ_INIT(&ring->free_requests); - STAILQ_INIT(&ring->ready_requests); - STAILQ_INIT(&ring->queued_requests); + ring->pending = ring->pending_cdesc = ring->pending_rdesc = 0; + ring->queued = 0; ring->cdr.read = ring->cdr.write = 0; ring->rdr.read = ring->rdr.write = 0; for (j = 0; j < SAFEXCEL_RING_SIZE; j++) { @@ -1177,11 +1183,7 @@ safexcel_attach(device_t dev) ring->cmd_data = sglist_alloc(SAFEXCEL_MAX_FRAGMENTS, M_WAITOK); ring->res_data = sglist_alloc(SAFEXCEL_MAX_FRAGMENTS, M_WAITOK); - ring->requests = mallocarray(SAFEXCEL_REQUESTS_PER_RING, - sizeof(struct safexcel_request), M_SAFEXCEL, - M_WAITOK | M_ZERO); - - for (i = 0; i < SAFEXCEL_REQUESTS_PER_RING; i++) { + for (i = 0; i < SAFEXCEL_RING_SIZE; i++) { req = &ring->requests[i]; req->sc = sc; req->ringidx = ringidx; @@ -1202,7 +1204,6 @@ safexcel_attach(device_t dev) } goto err2; } - STAILQ_INSERT_TAIL(&ring->free_requests, req, link); } } @@ -1263,12 +1264,11 @@ safexcel_detach(device_t dev) for (ringidx = 0; ringidx < sc->sc_config.rings; ringidx++) { ring = &sc->sc_ring[ringidx]; - for (i = 0; i < SAFEXCEL_REQUESTS_PER_RING; i++) { + for (i = 0; i < SAFEXCEL_RING_SIZE; i++) { bus_dmamap_destroy(ring->data_dtag, ring->requests[i].dmap); safexcel_dma_free_mem(&ring->requests[i].ctx); } - free(ring->requests, M_SAFEXCEL); sglist_free(ring->cmd_data); sglist_free(ring->res_data); } @@ -2077,7 +2077,8 @@ safexcel_create_chain_cb(void *arg, bus_dma_segment_t *segs, int nseg, * length zero. The EIP97 apparently does not handle * zero-length packets properly since subsequent requests return * bogus errors, so provide a dummy segment using the context - * descriptor. + * descriptor. Also, we must allocate at least one command ring + * entry per request to keep the request shadow ring in sync. */ (void)sglist_append_phys(sg, req->ctx.paddr, 1); } @@ -2633,10 +2634,8 @@ safexcel_process(device_t dev, struct cryptop *crp, int hint) bus_dmamap_sync(ring->rdr.dma.tag, ring->rdr.dma.map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - safexcel_enqueue_request(sc, ring, req); + safexcel_execute(sc, ring, req, hint); - if ((hint & CRYPTO_HINT_MORE) == 0) - safexcel_execute(sc, ring, req); mtx_unlock(&ring->mtx); return (0); diff --git a/sys/dev/safexcel/safexcel_var.h b/sys/dev/safexcel/safexcel_var.h index dab4b17963ab..5a81c3086492 100644 --- a/sys/dev/safexcel/safexcel_var.h +++ b/sys/dev/safexcel/safexcel_var.h @@ -38,7 +38,6 @@ #define SAFEXCEL_MAX_REQUEST_SIZE 65535 #define SAFEXCEL_RING_SIZE 512 -#define SAFEXCEL_REQUESTS_PER_RING 64 #define SAFEXCEL_MAX_ITOKENS 4 #define SAFEXCEL_MAX_ATOKENS 16 #define SAFEXCEL_FETCH_COUNT 1 @@ -49,7 +48,8 @@ * Context Record format. * * In this driver the context control words are always set in the control data. - * This is configured by setting SAFEXCEL_OPTION_CTX_CTRL_IN_CMD. + * This helps optimize fetching of the context record. This is configured by + * setting SAFEXCEL_OPTION_CTX_CTRL_IN_CMD. */ struct safexcel_context_record { uint32_t control0; /* Unused. */ @@ -379,12 +379,18 @@ struct safexcel_ring { struct sglist *res_data; struct safexcel_res_descr_ring rdr; - int blocked; + /* Shadows the command descriptor ring. */ + struct safexcel_request requests[SAFEXCEL_RING_SIZE]; + + /* Count of requests pending submission. */ + int pending; + int pending_cdesc, pending_rdesc; - struct safexcel_request *requests; - STAILQ_HEAD(, safexcel_request) ready_requests; - STAILQ_HEAD(, safexcel_request) queued_requests; - STAILQ_HEAD(, safexcel_request) free_requests; + /* Count of outstanding requests. */ + int queued; + + /* Requests were deferred due to a resource shortage. */ + int blocked; struct safexcel_dma_mem dma_atok; bus_dma_tag_t data_dtag; From owner-dev-commits-src-main@freebsd.org Mon Jan 18 22:08:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4D42B4F723A; Mon, 18 Jan 2021 22:08:22 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKQsJ2Xchz3Jt6; Mon, 18 Jan 2021 22:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DF651B7D4; Mon, 18 Jan 2021 22:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IM8I1R039291; Mon, 18 Jan 2021 22:08:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IM8IVm039290; Mon, 18 Jan 2021 22:08:18 GMT (envelope-from git) Date: Mon, 18 Jan 2021 22:08:18 GMT Message-Id: <202101182208.10IM8IVm039290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 098c902b5202 - main - aesni: Ensure that key schedules are aligned MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 098c902b52022a8ed53600727cca2f06086305c0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 22:08:22 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=098c902b52022a8ed53600727cca2f06086305c0 commit 098c902b52022a8ed53600727cca2f06086305c0 Author: Mark Johnston AuthorDate: 2021-01-18 22:07:56 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 22:07:56 +0000 aesni: Ensure that key schedules are aligned Rather than depending on malloc() returning 16-byte aligned chunks, allocate some extra pad bytes and ensure that key schedules are appropriately aligned. Reviewed by: kib MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D28157 --- sys/crypto/aesni/aesni.c | 7 +++++++ sys/crypto/aesni/aesni.h | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/crypto/aesni/aesni.c b/sys/crypto/aesni/aesni.c index 709d1558ee84..4debbae12c2b 100644 --- a/sys/crypto/aesni/aesni.c +++ b/sys/crypto/aesni/aesni.c @@ -560,8 +560,15 @@ aesni_cipher_setup(struct aesni_session *ses, const struct crypto_session_params *csp) { struct fpu_kern_ctx *ctx; + uint8_t *schedbase; int kt, ctxidx, error; + schedbase = (uint8_t *)roundup2((uintptr_t)ses->schedules, + AES_SCHED_ALIGN); + ses->enc_schedule = schedbase; + ses->dec_schedule = schedbase + AES_SCHED_LEN; + ses->xts_schedule = schedbase + AES_SCHED_LEN * 2; + switch (csp->csp_auth_alg) { case CRYPTO_SHA1_HMAC: ses->hmac = true; diff --git a/sys/crypto/aesni/aesni.h b/sys/crypto/aesni/aesni.h index ef1a6635f6ad..284bf6fba0fc 100644 --- a/sys/crypto/aesni/aesni.h +++ b/sys/crypto/aesni/aesni.h @@ -47,11 +47,13 @@ #define AES192_ROUNDS 12 #define AES256_ROUNDS 14 #define AES_SCHED_LEN ((AES256_ROUNDS + 1) * AES_BLOCK_LEN) +#define AES_SCHED_ALIGN 16 struct aesni_session { - uint8_t enc_schedule[AES_SCHED_LEN] __aligned(16); - uint8_t dec_schedule[AES_SCHED_LEN] __aligned(16); - uint8_t xts_schedule[AES_SCHED_LEN] __aligned(16); + uint8_t schedules[3 * AES_SCHED_LEN + AES_SCHED_ALIGN]; + uint8_t *enc_schedule; + uint8_t *dec_schedule; + uint8_t *xts_schedule; int rounds; /* uint8_t *ses_ictx; */ /* uint8_t *ses_octx; */ From owner-dev-commits-src-main@freebsd.org Mon Jan 18 22:08:16 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E1D944F728E; Mon, 18 Jan 2021 22:08:16 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKQsC3DVSz3KCr; Mon, 18 Jan 2021 22:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3E2E1B542; Mon, 18 Jan 2021 22:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IM8EhO039227; Mon, 18 Jan 2021 22:08:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IM8Ei2039226; Mon, 18 Jan 2021 22:08:14 GMT (envelope-from git) Date: Mon, 18 Jan 2021 22:08:14 GMT Message-Id: <202101182208.10IM8Ei2039226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b7e27af36b7d - main - safexcel: Handle command/result descriptor exhaustion gracefully MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b7e27af36b7df05f4b6cdc706750413f3a048640 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 22:08:17 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b7e27af36b7df05f4b6cdc706750413f3a048640 commit b7e27af36b7df05f4b6cdc706750413f3a048640 Author: Mark Johnston AuthorDate: 2021-01-18 22:07:56 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 22:07:56 +0000 safexcel: Handle command/result descriptor exhaustion gracefully Rather than returning a hard error in this case, return ERESTART so that upper layers get a chance to retry the request (or drop it, depending on the desired policy). This case is hard to hit due to the somewhat low bound on queued requests, but that will no longer be true after an upcoming change. MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/dev/safexcel/safexcel.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index c30b8178efb1..2f0f10f1d5e8 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -2093,7 +2093,7 @@ safexcel_create_chain_cb(void *arg, bus_dma_segment_t *segs, int nseg, if (cdesc == NULL) { safexcel_cmd_descr_rollback(ring, i); counter_u64_add(req->sc->sc_cdesc_alloc_failures, 1); - req->error = EAGAIN; + req->error = ERESTART; return; } if (i == 0) @@ -2121,7 +2121,7 @@ safexcel_create_chain_cb(void *arg, bus_dma_segment_t *segs, int nseg, ring->cmd_data->sg_nseg); safexcel_res_descr_rollback(ring, i); counter_u64_add(req->sc->sc_rdesc_alloc_failures, 1); - req->error = EAGAIN; + req->error = ERESTART; return; } } @@ -2608,10 +2608,16 @@ safexcel_process(device_t dev, struct cryptop *crp, int hint) error = safexcel_create_chain(ring, req); if (__predict_false(error != 0)) { safexcel_free_request(ring, req); + if (error == ERESTART) + ring->blocked = CRYPTO_SYMQ; mtx_unlock(&ring->mtx); - crp->crp_etype = error; - crypto_done(crp); - return (0); + if (error != ERESTART) { + crp->crp_etype = error; + crypto_done(crp); + return (0); + } else { + return (ERESTART); + } } safexcel_set_token(req); From owner-dev-commits-src-main@freebsd.org Mon Jan 18 22:08:23 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A8D444F723B; Mon, 18 Jan 2021 22:08:23 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKQsH6L91z3KGX; Mon, 18 Jan 2021 22:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1236A1B621; Mon, 18 Jan 2021 22:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10IM8HgE039267; Mon, 18 Jan 2021 22:08:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10IM8HqH039266; Mon, 18 Jan 2021 22:08:17 GMT (envelope-from git) Date: Mon, 18 Jan 2021 22:08:17 GMT Message-Id: <202101182208.10IM8HqH039266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5bdb8b273aaf - main - safexcel: Maintain per-session context records MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bdb8b273aaf6aa1bf089071ce6d5c9e80657c52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 22:08:23 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5bdb8b273aaf6aa1bf089071ce6d5c9e80657c52 commit 5bdb8b273aaf6aa1bf089071ce6d5c9e80657c52 Author: Mark Johnston AuthorDate: 2021-01-18 22:07:56 +0000 Commit: Mark Johnston CommitDate: 2021-01-18 22:07:56 +0000 safexcel: Maintain per-session context records The context record contains key material precomputed by the driver at session creation time. Rather than storing various components of the context record in each session, go a bit further and store the full context record image so that safexcel_process() can simply copy the image into each request submitted to the hardware. This simplifies the data path and eliminates a bunch of unnecessary conditional logic that was getting executed for each request. MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/dev/safexcel/safexcel.c | 400 ++++++++++++++++++---------------------- sys/dev/safexcel/safexcel_var.h | 19 +- 2 files changed, 186 insertions(+), 233 deletions(-) diff --git a/sys/dev/safexcel/safexcel.c b/sys/dev/safexcel/safexcel.c index 5f66cd9d4abb..3083f5f794fe 100644 --- a/sys/dev/safexcel/safexcel.c +++ b/sys/dev/safexcel/safexcel.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2020 Rubicon Communications, LLC (Netgate) + * Copyright (c) 2020, 2021 Rubicon Communications, LLC (Netgate) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1280,59 +1280,153 @@ safexcel_detach(device_t dev) } /* - * Populate the request's context record with pre-computed key material. + * Pre-compute the hash key used in GHASH, which is a block of zeroes encrypted + * using the cipher key. + */ +static void +safexcel_setkey_ghash(const uint8_t *key, int klen, uint32_t *hashkey) +{ + uint32_t ks[4 * (RIJNDAEL_MAXNR + 1)]; + uint8_t zeros[AES_BLOCK_LEN]; + int i, rounds; + + memset(zeros, 0, sizeof(zeros)); + + rounds = rijndaelKeySetupEnc(ks, key, klen * NBBY); + rijndaelEncrypt(ks, rounds, zeros, (uint8_t *)hashkey); + for (i = 0; i < GMAC_BLOCK_LEN / sizeof(uint32_t); i++) + hashkey[i] = htobe32(hashkey[i]); + + explicit_bzero(ks, sizeof(ks)); +} + +/* + * Pre-compute the combined CBC-MAC key, which consists of three keys K1, K2, K3 + * in the hardware implementation. K1 is the cipher key and comes last in the + * buffer since K2 and K3 have a fixed size of AES_BLOCK_LEN. For now XCBC-MAC + * is not implemented so K2 and K3 are fixed. + */ +static void +safexcel_setkey_xcbcmac(const uint8_t *key, int klen, uint32_t *hashkey) +{ + int i, off; + + memset(hashkey, 0, 2 * AES_BLOCK_LEN); + off = 2 * AES_BLOCK_LEN / sizeof(uint32_t); + for (i = 0; i < klen / sizeof(uint32_t); i++, key += 4) + hashkey[i + off] = htobe32(le32dec(key)); +} + +static void +safexcel_setkey_hmac_digest(struct auth_hash *ahash, union authctx *ctx, + char *buf) +{ + int hashwords, i; + + switch (ahash->type) { + case CRYPTO_SHA1_HMAC: + hashwords = ahash->hashsize / sizeof(uint32_t); + for (i = 0; i < hashwords; i++) + ((uint32_t *)buf)[i] = htobe32(ctx->sha1ctx.h.b32[i]); + break; + case CRYPTO_SHA2_224_HMAC: + hashwords = auth_hash_hmac_sha2_256.hashsize / sizeof(uint32_t); + for (i = 0; i < hashwords; i++) + ((uint32_t *)buf)[i] = htobe32(ctx->sha224ctx.state[i]); + break; + case CRYPTO_SHA2_256_HMAC: + hashwords = ahash->hashsize / sizeof(uint32_t); + for (i = 0; i < hashwords; i++) + ((uint32_t *)buf)[i] = htobe32(ctx->sha256ctx.state[i]); + break; + case CRYPTO_SHA2_384_HMAC: + hashwords = auth_hash_hmac_sha2_512.hashsize / sizeof(uint64_t); + for (i = 0; i < hashwords; i++) + ((uint64_t *)buf)[i] = htobe64(ctx->sha384ctx.state[i]); + break; + case CRYPTO_SHA2_512_HMAC: + hashwords = ahash->hashsize / sizeof(uint64_t); + for (i = 0; i < hashwords; i++) + ((uint64_t *)buf)[i] = htobe64(ctx->sha512ctx.state[i]); + break; + } +} + +/* + * Pre-compute the inner and outer digests used in the HMAC algorithm. + */ +static void +safexcel_setkey_hmac(const struct crypto_session_params *csp, + const uint8_t *key, int klen, uint8_t *ipad, uint8_t *opad) +{ + union authctx ctx; + struct auth_hash *ahash; + + ahash = crypto_auth_hash(csp); + hmac_init_ipad(ahash, key, klen, &ctx); + safexcel_setkey_hmac_digest(ahash, &ctx, ipad); + hmac_init_opad(ahash, key, klen, &ctx); + safexcel_setkey_hmac_digest(ahash, &ctx, opad); + explicit_bzero(&ctx, ahash->ctxsize); +} + +static void +safexcel_setkey_xts(const uint8_t *key, int klen, uint8_t *tweakkey) +{ + memcpy(tweakkey, key + klen, klen); +} + +/* + * Populate a context record with paramters from a session. Some consumers + * specify per-request keys, in which case the context must be re-initialized + * for each request. */ static int -safexcel_set_context(struct safexcel_request *req) +safexcel_set_context(struct safexcel_context_record *ctx, int op, + const uint8_t *ckey, const uint8_t *akey, struct safexcel_session *sess) { const struct crypto_session_params *csp; - struct cryptop *crp; - struct safexcel_context_record *ctx; - struct safexcel_session *sess; uint8_t *data; - int off; + uint32_t ctrl0, ctrl1; + int aklen, alg, cklen, off; - crp = req->crp; - csp = crypto_get_params(crp->crp_session); - sess = req->sess; + csp = crypto_get_params(sess->cses); + aklen = csp->csp_auth_klen; + cklen = csp->csp_cipher_klen; + if (csp->csp_cipher_alg == CRYPTO_AES_XTS) + cklen /= 2; + + ctrl0 = sess->alg | sess->digest | sess->hash; + ctrl1 = sess->mode; - ctx = (struct safexcel_context_record *)req->ctx.vaddr; data = (uint8_t *)ctx->data; if (csp->csp_cipher_alg != 0) { - if (crp->crp_cipher_key != NULL) - memcpy(data, crp->crp_cipher_key, sess->klen); - else - memcpy(data, csp->csp_cipher_key, sess->klen); - off = sess->klen; + memcpy(data, ckey, cklen); + off = cklen; } else if (csp->csp_auth_alg == CRYPTO_AES_NIST_GMAC) { - if (crp->crp_auth_key != NULL) - memcpy(data, crp->crp_auth_key, sess->klen); - else - memcpy(data, csp->csp_auth_key, sess->klen); - off = sess->klen; + memcpy(data, akey, aklen); + off = aklen; } else { off = 0; } switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: - memcpy(data + off, sess->ghash_key, GMAC_BLOCK_LEN); + safexcel_setkey_ghash(ckey, cklen, (uint32_t *)(data + off)); off += GMAC_BLOCK_LEN; break; case CRYPTO_AES_CCM_16: - memcpy(data + off, sess->xcbc_key, - AES_BLOCK_LEN * 2 + sess->klen); - off += AES_BLOCK_LEN * 2 + sess->klen; + safexcel_setkey_xcbcmac(ckey, cklen, (uint32_t *)(data + off)); + off += AES_BLOCK_LEN * 2 + cklen; break; case CRYPTO_AES_XTS: - memcpy(data + off, sess->tweak_key, sess->klen); - off += sess->klen; + safexcel_setkey_xts(ckey, cklen, data + off); + off += cklen; break; } - switch (csp->csp_auth_alg) { case CRYPTO_AES_NIST_GMAC: - memcpy(data + off, sess->ghash_key, GMAC_BLOCK_LEN); + safexcel_setkey_ghash(akey, aklen, (uint32_t *)(data + off)); off += GMAC_BLOCK_LEN; break; case CRYPTO_SHA1_HMAC: @@ -1340,41 +1434,12 @@ safexcel_set_context(struct safexcel_request *req) case CRYPTO_SHA2_256_HMAC: case CRYPTO_SHA2_384_HMAC: case CRYPTO_SHA2_512_HMAC: - memcpy(data + off, sess->hmac_ipad, sess->statelen); - off += sess->statelen; - memcpy(data + off, sess->hmac_opad, sess->statelen); - off += sess->statelen; + safexcel_setkey_hmac(csp, akey, aklen, + data + off, data + off + sess->statelen); + off += sess->statelen * 2; break; } - - return (off); -} - -/* - * Populate fields in the first command descriptor of the chain used to encode - * the specified request. These fields indicate the algorithms used, the size - * of the key material stored in the associated context record, the primitive - * operations to be performed on input data, and the location of the IV if any. - */ -static void -safexcel_set_command(struct safexcel_request *req, - struct safexcel_cmd_descr *cdesc) -{ - const struct crypto_session_params *csp; - struct cryptop *crp; - struct safexcel_session *sess; - uint32_t ctrl0, ctrl1, ctxr_len; - int alg; - - crp = req->crp; - csp = crypto_get_params(crp->crp_session); - sess = req->sess; - - ctrl0 = sess->alg | sess->digest | sess->hash; - ctrl1 = sess->mode; - - ctxr_len = safexcel_set_context(req) / sizeof(uint32_t); - ctrl0 |= SAFEXCEL_CONTROL0_SIZE(ctxr_len); + ctrl0 |= SAFEXCEL_CONTROL0_SIZE(off / sizeof(uint32_t)); alg = csp->csp_cipher_alg; if (alg == 0) @@ -1382,7 +1447,7 @@ safexcel_set_command(struct safexcel_request *req, switch (alg) { case CRYPTO_AES_CCM_16: - if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + if (CRYPTO_OP_IS_ENCRYPT(op)) { ctrl0 |= SAFEXCEL_CONTROL0_TYPE_HASH_ENCRYPT_OUT | SAFEXCEL_CONTROL0_KEY_EN; } else { @@ -1395,7 +1460,7 @@ safexcel_set_command(struct safexcel_request *req, case CRYPTO_AES_CBC: case CRYPTO_AES_ICM: case CRYPTO_AES_XTS: - if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + if (CRYPTO_OP_IS_ENCRYPT(op)) { ctrl0 |= SAFEXCEL_CONTROL0_TYPE_CRYPTO_OUT | SAFEXCEL_CONTROL0_KEY_EN; if (csp->csp_auth_alg != 0) @@ -1410,8 +1475,7 @@ safexcel_set_command(struct safexcel_request *req, break; case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_NIST_GMAC: - if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op) || - csp->csp_auth_alg != 0) { + if (CRYPTO_OP_IS_ENCRYPT(op) || csp->csp_auth_alg != 0) { ctrl0 |= SAFEXCEL_CONTROL0_TYPE_CRYPTO_OUT | SAFEXCEL_CONTROL0_KEY_EN | SAFEXCEL_CONTROL0_TYPE_HASH_OUT; @@ -1442,8 +1506,10 @@ safexcel_set_command(struct safexcel_request *req, break; } - cdesc->control_data.control0 = ctrl0; - cdesc->control_data.control1 = ctrl1; + ctx->control0 = ctrl0; + ctx->control1 = ctrl1; + + return (off); } /* @@ -1809,17 +1875,48 @@ static void safexcel_set_token(struct safexcel_request *req) { const struct crypto_session_params *csp; + struct cryptop *crp; struct safexcel_cmd_descr *cdesc; + struct safexcel_context_record *ctx; + struct safexcel_context_template *ctxtmp; struct safexcel_instr *instr; struct safexcel_softc *sc; + const uint8_t *akey, *ckey; int ringidx; - csp = crypto_get_params(req->crp->crp_session); + crp = req->crp; + csp = crypto_get_params(crp->crp_session); cdesc = req->cdesc; sc = req->sc; ringidx = req->ringidx; - safexcel_set_command(req, cdesc); + akey = crp->crp_auth_key; + ckey = crp->crp_cipher_key; + if (akey != NULL || ckey != NULL) { + /* + * If we have a per-request key we have to generate the context + * record on the fly. + */ + if (akey == NULL) + akey = csp->csp_auth_key; + if (ckey == NULL) + ckey = csp->csp_cipher_key; + ctx = (struct safexcel_context_record *)req->ctx.vaddr; + (void)safexcel_set_context(ctx, crp->crp_op, ckey, akey, + req->sess); + } else { + /* + * Use the context record template computed at session + * initialization time. + */ + ctxtmp = CRYPTO_OP_IS_ENCRYPT(crp->crp_op) ? + &req->sess->encctx : &req->sess->decctx; + ctx = &ctxtmp->ctx; + memcpy(req->ctx.vaddr + 2 * sizeof(uint32_t), ctx->data, + ctxtmp->len); + } + cdesc->control_data.control0 = ctx->control0; + cdesc->control_data.control1 = ctx->control1; /* * For keyless hash operations, the token instructions can be embedded @@ -2243,153 +2340,6 @@ safexcel_probesession(device_t dev, const struct crypto_session_params *csp) return (CRYPTODEV_PROBE_HARDWARE); } -/* - * Pre-compute the hash key used in GHASH, which is a block of zeroes encrypted - * using the cipher key. - */ -static void -safexcel_setkey_ghash(struct safexcel_session *sess, const uint8_t *key, - int klen) -{ - uint32_t ks[4 * (RIJNDAEL_MAXNR + 1)]; - uint8_t zeros[AES_BLOCK_LEN]; - int i, rounds; - - memset(zeros, 0, sizeof(zeros)); - - rounds = rijndaelKeySetupEnc(ks, key, klen * NBBY); - rijndaelEncrypt(ks, rounds, zeros, (uint8_t *)sess->ghash_key); - for (i = 0; i < GMAC_BLOCK_LEN / sizeof(uint32_t); i++) - sess->ghash_key[i] = htobe32(sess->ghash_key[i]); - - explicit_bzero(ks, sizeof(ks)); -} - -/* - * Pre-compute the combined CBC-MAC key, which consists of three keys K1, K2, K3 - * in the hardware implementation. K1 is the cipher key and comes last in the - * buffer since K2 and K3 have a fixed size of AES_BLOCK_LEN. For now XCBC-MAC - * is not implemented so K2 and K3 are fixed. - */ -static void -safexcel_setkey_xcbcmac(struct safexcel_session *sess, const uint8_t *key, - int klen) -{ - int i, off; - - memset(sess->xcbc_key, 0, sizeof(sess->xcbc_key)); - off = 2 * AES_BLOCK_LEN / sizeof(uint32_t); - for (i = 0; i < klen / sizeof(uint32_t); i++, key += 4) - sess->xcbc_key[i + off] = htobe32(le32dec(key)); -} - -static void -safexcel_setkey_hmac_digest(struct auth_hash *ahash, union authctx *ctx, - char *buf) -{ - int hashwords, i; - - switch (ahash->type) { - case CRYPTO_SHA1_HMAC: - hashwords = ahash->hashsize / sizeof(uint32_t); - for (i = 0; i < hashwords; i++) - ((uint32_t *)buf)[i] = htobe32(ctx->sha1ctx.h.b32[i]); - break; - case CRYPTO_SHA2_224_HMAC: - hashwords = auth_hash_hmac_sha2_256.hashsize / sizeof(uint32_t); - for (i = 0; i < hashwords; i++) - ((uint32_t *)buf)[i] = htobe32(ctx->sha224ctx.state[i]); - break; - case CRYPTO_SHA2_256_HMAC: - hashwords = ahash->hashsize / sizeof(uint32_t); - for (i = 0; i < hashwords; i++) - ((uint32_t *)buf)[i] = htobe32(ctx->sha256ctx.state[i]); - break; - case CRYPTO_SHA2_384_HMAC: - hashwords = auth_hash_hmac_sha2_512.hashsize / sizeof(uint64_t); - for (i = 0; i < hashwords; i++) - ((uint64_t *)buf)[i] = htobe64(ctx->sha384ctx.state[i]); - break; - case CRYPTO_SHA2_512_HMAC: - hashwords = ahash->hashsize / sizeof(uint64_t); - for (i = 0; i < hashwords; i++) - ((uint64_t *)buf)[i] = htobe64(ctx->sha512ctx.state[i]); - break; - } -} - -/* - * Pre-compute the inner and outer digests used in the HMAC algorithm. - */ -static void -safexcel_setkey_hmac(const struct crypto_session_params *csp, - struct safexcel_session *sess, const uint8_t *key, int klen) -{ - union authctx ctx; - struct auth_hash *ahash; - - ahash = crypto_auth_hash(csp); - hmac_init_ipad(ahash, key, klen, &ctx); - safexcel_setkey_hmac_digest(ahash, &ctx, sess->hmac_ipad); - hmac_init_opad(ahash, key, klen, &ctx); - safexcel_setkey_hmac_digest(ahash, &ctx, sess->hmac_opad); - explicit_bzero(&ctx, ahash->ctxsize); -} - -static void -safexcel_setkey_xts(struct safexcel_session *sess, const uint8_t *key, int klen) -{ - memcpy(sess->tweak_key, key + klen / 2, klen / 2); -} - -static void -safexcel_setkey(struct safexcel_session *sess, - const struct crypto_session_params *csp, struct cryptop *crp) -{ - const uint8_t *akey, *ckey; - int aklen, cklen; - - aklen = csp->csp_auth_klen; - cklen = csp->csp_cipher_klen; - akey = ckey = NULL; - if (crp != NULL) { - akey = crp->crp_auth_key; - ckey = crp->crp_cipher_key; - } - if (akey == NULL) - akey = csp->csp_auth_key; - if (ckey == NULL) - ckey = csp->csp_cipher_key; - - sess->klen = cklen; - switch (csp->csp_cipher_alg) { - case CRYPTO_AES_NIST_GCM_16: - safexcel_setkey_ghash(sess, ckey, cklen); - break; - case CRYPTO_AES_CCM_16: - safexcel_setkey_xcbcmac(sess, ckey, cklen); - break; - case CRYPTO_AES_XTS: - safexcel_setkey_xts(sess, ckey, cklen); - sess->klen /= 2; - break; - } - - switch (csp->csp_auth_alg) { - case CRYPTO_SHA1_HMAC: - case CRYPTO_SHA2_224_HMAC: - case CRYPTO_SHA2_256_HMAC: - case CRYPTO_SHA2_384_HMAC: - case CRYPTO_SHA2_512_HMAC: - safexcel_setkey_hmac(csp, sess, akey, aklen); - break; - case CRYPTO_AES_NIST_GMAC: - sess->klen = aklen; - safexcel_setkey_ghash(sess, akey, aklen); - break; - } -} - static uint32_t safexcel_aes_algid(int keylen) { @@ -2499,6 +2449,7 @@ safexcel_newsession(device_t dev, crypto_session_t cses, sc = device_get_softc(dev); sess = crypto_get_driver_session(cses); + sess->cses = cses; switch (csp->csp_auth_alg) { case CRYPTO_SHA1: @@ -2562,7 +2513,15 @@ safexcel_newsession(device_t dev, crypto_session_t cses, if (csp->csp_auth_mlen != 0) sess->digestlen = csp->csp_auth_mlen; - safexcel_setkey(sess, csp, NULL); + if ((csp->csp_cipher_alg == 0 || csp->csp_cipher_key != NULL) && + (csp->csp_auth_alg == 0 || csp->csp_auth_key != NULL)) { + sess->encctx.len = safexcel_set_context(&sess->encctx.ctx, + CRYPTO_OP_ENCRYPT, csp->csp_cipher_key, csp->csp_auth_key, + sess); + sess->decctx.len = safexcel_set_context(&sess->decctx.ctx, + CRYPTO_OP_DECRYPT, csp->csp_cipher_key, csp->csp_auth_key, + sess); + } return (0); } @@ -2588,13 +2547,10 @@ safexcel_process(device_t dev, struct cryptop *crp, int hint) return (0); } - if (crp->crp_cipher_key != NULL || crp->crp_auth_key != NULL) - safexcel_setkey(sess, csp, crp); - ring = &sc->sc_ring[curcpu % sc->sc_config.rings]; mtx_lock(&ring->mtx); req = safexcel_alloc_request(sc, ring); - if (__predict_false(req == NULL)) { + if (__predict_false(req == NULL)) { ring->blocked = CRYPTO_SYMQ; mtx_unlock(&ring->mtx); counter_u64_add(sc->sc_req_alloc_failures, 1); diff --git a/sys/dev/safexcel/safexcel_var.h b/sys/dev/safexcel/safexcel_var.h index 5a81c3086492..efcf66a090bf 100644 --- a/sys/dev/safexcel/safexcel_var.h +++ b/sys/dev/safexcel/safexcel_var.h @@ -335,24 +335,21 @@ struct safexcel_res_descr_ring { int read; }; +struct safexcel_context_template { + struct safexcel_context_record ctx; + int len; +}; + struct safexcel_session { + crypto_session_t cses; uint32_t alg; /* cipher algorithm */ uint32_t digest; /* digest type */ uint32_t hash; /* hash algorithm */ uint32_t mode; /* cipher mode of operation */ unsigned int digestlen; /* digest length */ unsigned int statelen; /* HMAC hash state length */ - unsigned int klen; /* cipher key length */ - union { - uint32_t ghash_key[AES_BLOCK_LEN / sizeof(uint32_t)]; - uint32_t xcbc_key[(AES_BLOCK_LEN * 2 + AES_MAX_KEY) / - sizeof(uint32_t)]; - uint8_t tweak_key[AES_MAX_KEY]; - }; - struct { - uint8_t hmac_ipad[HMAC_MAX_BLOCK_LEN]; - uint8_t hmac_opad[HMAC_MAX_BLOCK_LEN]; - }; + + struct safexcel_context_template encctx, decctx; }; struct safexcel_softc; From owner-dev-commits-src-main@freebsd.org Mon Jan 18 23:47:52 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E1F1B4D87F8; Mon, 18 Jan 2021 23:47:52 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKT48672jz3QmP; Mon, 18 Jan 2021 23:47:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C06EA1C269; Mon, 18 Jan 2021 23:47:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10INlq6M068559; Mon, 18 Jan 2021 23:47:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10INlqFl068558; Mon, 18 Jan 2021 23:47:52 GMT (envelope-from git) Date: Mon, 18 Jan 2021 23:47:52 GMT Message-Id: <202101182347.10INlqFl068558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 83bc72a04e0d - main - jail: Fix a stray mutex from 76ad42abf9d4. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 83bc72a04e0d1b6dab453707290e3eb36ef69d95 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 23:47:52 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=83bc72a04e0d1b6dab453707290e3eb36ef69d95 commit 83bc72a04e0d1b6dab453707290e3eb36ef69d95 Author: Jamie Gritton AuthorDate: 2021-01-18 23:47:09 +0000 Commit: Jamie Gritton CommitDate: 2021-01-18 23:47:09 +0000 jail: Fix a stray mutex from 76ad42abf9d4. --- sys/kern/kern_jail.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index ba4c1aab0d85..4893e4df2781 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1119,7 +1119,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) if (tpr != pr && tpr->pr_ref > 0 && !strcmp(tpr->pr_name + pnamelen, namelc)) { mtx_lock(&tpr->pr_mtx); - drflags |= PD_LOCKED; if (prison_isalive(tpr)) { if (pr == NULL && cuflags != JAIL_CREATE) { @@ -1128,6 +1127,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * for updates. */ pr = tpr; + drflags |= PD_LOCKED; break; } /* @@ -1136,6 +1136,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * active sibling jail. */ error = EEXIST; + mtx_unlock(&tpr->pr_mtx); vfs_opterror(opts, "jail \"%s\" already exists", name); @@ -1146,7 +1147,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) prison_isvalid(tpr)) deadpr = tpr; mtx_unlock(&tpr->pr_mtx); - drflags &= ~PD_LOCKED; } } /* If no active jail is found, use a dying one. */ From owner-dev-commits-src-main@freebsd.org Tue Jan 19 00:36:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9DE474D9E5B; Tue, 19 Jan 2021 00:36:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKV8Y3n9qz3jkP; Tue, 19 Jan 2021 00:36:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73B431D332; Tue, 19 Jan 2021 00:36:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J0ajYR033257; Tue, 19 Jan 2021 00:36:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J0aj3O033256; Tue, 19 Jan 2021 00:36:45 GMT (envelope-from git) Date: Tue, 19 Jan 2021 00:36:45 GMT Message-Id: <202101190036.10J0aj3O033256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Oleksandr Tymoshenko Subject: git: 248f0cabca75 - main - make maximum interrupt number tunable on ARM, ARM64, MIPS, and RISC-V MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gonzo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 248f0cabca75f421553633184b5bf2ffa459d3de Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 00:36:45 -0000 The branch main has been updated by gonzo: URL: https://cgit.FreeBSD.org/src/commit/?id=248f0cabca75f421553633184b5bf2ffa459d3de commit 248f0cabca75f421553633184b5bf2ffa459d3de Author: Oleksandr Tymoshenko AuthorDate: 2020-12-30 06:59:03 +0000 Commit: Oleksandr Tymoshenko CommitDate: 2021-01-19 00:36:39 +0000 make maximum interrupt number tunable on ARM, ARM64, MIPS, and RISC-V Use a machdep.nirq tunable intead of compile-time constant NIRQ as a value for maximum number of interrupts. It allows keep a system footprint small by default with an option to increase the limit for large systems like server-grade ARM64 Reviewd by: mhorne Differential Revision: https://reviews.freebsd.org/D27844 Submitted by: Klara, Inc. Sponsored by: Ampere Computing --- sys/arm/arm/genassym.c | 1 - sys/arm/mv/mvreg.h | 4 ---- sys/arm64/arm64/gic_v3.c | 3 ++- sys/kern/subr_intr.c | 58 +++++++++++++++++++++++++++++++----------------- sys/mips/mips/nexus.c | 2 +- sys/sys/interrupt.h | 5 ----- sys/sys/intr.h | 3 +++ 7 files changed, 44 insertions(+), 32 deletions(-) diff --git a/sys/arm/arm/genassym.c b/sys/arm/arm/genassym.c index 39ded845f288..e90bbff6549a 100644 --- a/sys/arm/arm/genassym.c +++ b/sys/arm/arm/genassym.c @@ -122,7 +122,6 @@ ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); ASSYM(MAXCOMLEN, MAXCOMLEN); ASSYM(MAXCPU, MAXCPU); ASSYM(_NCPUWORDS, _NCPUWORDS); -ASSYM(NIRQ, NIRQ); ASSYM(PCPU_SIZE, sizeof(struct pcpu)); ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace)); ASSYM(VM_PMAP, offsetof(struct vmspace, vm_pmap)); diff --git a/sys/arm/mv/mvreg.h b/sys/arm/mv/mvreg.h index 4ae1e52ee215..95af82b295f6 100644 --- a/sys/arm/mv/mvreg.h +++ b/sys/arm/mv/mvreg.h @@ -310,10 +310,6 @@ #define MV_GPIO_OUT_OPEN_DRAIN 0x2 #define MV_GPIO_OUT_OPEN_SRC 0x4 -#define IS_GPIO_IRQ(irq) ((irq) >= NIRQ && (irq) < NIRQ + MV_GPIO_MAX_NPINS) -#define GPIO2IRQ(gpio) ((gpio) + NIRQ) -#define IRQ2GPIO(irq) ((irq) - NIRQ) - #if defined(SOC_MV_ORION) #define SAMPLE_AT_RESET 0x10 #elif defined(SOC_MV_KIRKWOOD) diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index a83ef576e30e..f230eb6bbd06 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -388,7 +389,7 @@ gic_v3_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) switch (which) { case GICV3_IVAR_NIRQS: - *result = (NIRQ - sc->gic_nirqs) / sc->gic_nchildren; + *result = (intr_nirq - sc->gic_nirqs) / sc->gic_nchildren; return (0); case GICV3_IVAR_REDIST: *result = (uintptr_t)sc->gic_redists.pcpu[PCPU_GET(cpuid)]; diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index 8cda3921fc86..7f99d194e971 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef HWPMC_HOOKS #include @@ -131,7 +132,7 @@ static struct intr_pic *pic_lookup(device_t dev, intptr_t xref, int flags); /* Interrupt source definition. */ static struct mtx isrc_table_lock; -static struct intr_irqsrc *irq_sources[NIRQ]; +static struct intr_irqsrc **irq_sources; u_int irq_next_free; #ifdef SMP @@ -142,21 +143,15 @@ static bool irq_assign_cpu = false; #endif #endif -/* - * - 2 counters for each I/O interrupt. - * - MAXCPU counters for each IPI counters for SMP. - */ -#ifdef SMP -#define INTRCNT_COUNT (NIRQ * 2 + INTR_IPI_COUNT * MAXCPU) -#else -#define INTRCNT_COUNT (NIRQ * 2) -#endif +int intr_nirq = NIRQ; +SYSCTL_UINT(_machdep, OID_AUTO, nirq, CTLFLAG_RDTUN, &intr_nirq, 0, + "Number of IRQs"); /* Data for MI statistics reporting. */ -u_long intrcnt[INTRCNT_COUNT]; -char intrnames[INTRCNT_COUNT * INTRNAME_LEN]; -size_t sintrcnt = sizeof(intrcnt); -size_t sintrnames = sizeof(intrnames); +u_long *intrcnt; +char *intrnames; +size_t sintrcnt; +size_t sintrnames; static u_int intrcnt_index; static struct intr_irqsrc *intr_map_get_isrc(u_int res_id); @@ -171,11 +166,30 @@ static void intr_map_copy_map_data(u_int res_id, device_t *dev, intptr_t *xref, static void intr_irq_init(void *dummy __unused) { + int intrcnt_count; SLIST_INIT(&pic_list); mtx_init(&pic_list_lock, "intr pic list", NULL, MTX_DEF); mtx_init(&isrc_table_lock, "intr isrc table", NULL, MTX_DEF); + + /* + * - 2 counters for each I/O interrupt. + * - MAXCPU counters for each IPI counters for SMP. + */ + intrcnt_count = intr_nirq * 2; +#ifdef SMP + intrcnt_count += INTR_IPI_COUNT * MAXCPU; +#endif + + intrcnt = mallocarray(intrcnt_count, sizeof(u_long), M_INTRNG, + M_WAITOK | M_ZERO); + intrnames = mallocarray(intrcnt_count, INTRNAME_LEN, M_INTRNG, + M_WAITOK | M_ZERO); + sintrcnt = intrcnt_count * sizeof(u_long); + sintrnames = intrcnt_count * INTRNAME_LEN; + irq_sources = mallocarray(intr_nirq, sizeof(struct intr_irqsrc*), + M_INTRNG, M_WAITOK | M_ZERO); } SYSINIT(intr_irq_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_irq_init, NULL); @@ -391,7 +405,7 @@ isrc_alloc_irq(struct intr_irqsrc *isrc) mtx_assert(&isrc_table_lock, MA_OWNED); - maxirqs = nitems(irq_sources); + maxirqs = intr_nirq; if (irq_next_free >= maxirqs) return (ENOSPC); @@ -426,7 +440,7 @@ isrc_free_irq(struct intr_irqsrc *isrc) mtx_assert(&isrc_table_lock, MA_OWNED); - if (isrc->isrc_irq >= nitems(irq_sources)) + if (isrc->isrc_irq >= intr_nirq) return (EINVAL); if (irq_sources[isrc->isrc_irq] != isrc) return (EINVAL); @@ -1229,7 +1243,7 @@ intr_irq_shuffle(void *arg __unused) mtx_lock(&isrc_table_lock); irq_assign_cpu = true; - for (i = 0; i < NIRQ; i++) { + for (i = 0; i < intr_nirq; i++) { isrc = irq_sources[i]; if (isrc == NULL || isrc->isrc_handlers == 0 || isrc->isrc_flags & (INTR_ISRCF_PPI | INTR_ISRCF_IPI)) @@ -1529,7 +1543,7 @@ DB_SHOW_COMMAND(irqs, db_show_irqs) u_long num; struct intr_irqsrc *isrc; - for (irqsum = 0, i = 0; i < NIRQ; i++) { + for (irqsum = 0, i = 0; i < intr_nirq; i++) { isrc = irq_sources[i]; if (isrc == NULL) continue; @@ -1561,8 +1575,8 @@ struct intr_map_entry }; /* XXX Convert irq_map[] to dynamicaly expandable one. */ -static struct intr_map_entry *irq_map[2 * NIRQ]; -static int irq_map_count = nitems(irq_map); +static struct intr_map_entry **irq_map; +static int irq_map_count; static int irq_map_first_free_idx; static struct mtx irq_map_lock; @@ -1712,5 +1726,9 @@ intr_map_init(void *dummy __unused) { mtx_init(&irq_map_lock, "intr map table", NULL, MTX_DEF); + + irq_map_count = 2 * intr_nirq; + irq_map = mallocarray(irq_map_count, sizeof(struct intr_map_entry*), + M_INTRNG, M_WAITOK | M_ZERO); } SYSINIT(intr_map_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_map_init, NULL); diff --git a/sys/mips/mips/nexus.c b/sys/mips/mips/nexus.c index 43b94e239e41..46e7f1831029 100644 --- a/sys/mips/mips/nexus.c +++ b/sys/mips/mips/nexus.c @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); #endif /* NEXUS_DEBUG */ #ifdef INTRNG -#define NUM_MIPS_IRQS NIRQ /* Any INTRNG-mapped IRQ */ +#define NUM_MIPS_IRQS intr_nirq /* Any INTRNG-mapped IRQ */ #else #define NUM_MIPS_IRQS 6 /* HW IRQs only */ #endif diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h index 138e99495af2..f1770fe64b0b 100644 --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -157,13 +157,8 @@ extern struct intr_event *tty_intr_event; extern void *vm_ih; /* Counts and names for statistics (defined in MD code). */ -#if defined(__amd64__) || defined(__i386__) || defined(__powerpc__) extern u_long *intrcnt; /* counts for for each device and stray */ extern char *intrnames; /* string table containing device names */ -#else -extern u_long intrcnt[]; /* counts for for each device and stray */ -extern char intrnames[]; /* string table containing device names */ -#endif extern size_t sintrcnt; /* size of intrcnt table */ extern size_t sintrnames; /* size of intrnames table */ diff --git a/sys/sys/intr.h b/sys/sys/intr.h index 5e305e719e10..c922b10f3368 100644 --- a/sys/sys/intr.h +++ b/sys/sys/intr.h @@ -164,4 +164,7 @@ intr_ipi_increment_count(u_long *counter, u_int cpu) u_long * intr_ipi_setup_counters(const char *name); #endif + +extern int intr_nirq; /* number of IRQs on intrng platforms */ + #endif /* _SYS_INTR_H */ From owner-dev-commits-src-main@freebsd.org Tue Jan 19 00:45:15 2021 Return-Path: Delivered-To: dev-commits-src-main@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 123424DA09F; Tue, 19 Jan 2021 00:45:15 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKVLM02kpz3kHN; Tue, 19 Jan 2021 00:45:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E44341D71E; Tue, 19 Jan 2021 00:45:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J0jEsE046641; Tue, 19 Jan 2021 00:45:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J0jEEA046640; Tue, 19 Jan 2021 00:45:14 GMT (envelope-from git) Date: Tue, 19 Jan 2021 00:45:14 GMT Message-Id: <202101190045.10J0jEEA046640@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a45d90561696 - main - ppbus: Fix the direction of the PPISEPPA ioctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a45d90561696e7a5c76e38c6bf715e6190d2ca07 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 00:45:15 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a45d90561696e7a5c76e38c6bf715e6190d2ca07 commit a45d90561696e7a5c76e38c6bf715e6190d2ca07 Author: Mark Johnston AuthorDate: 2021-01-19 00:44:42 +0000 Commit: Mark Johnston CommitDate: 2021-01-19 00:44:42 +0000 ppbus: Fix the direction of the PPISEPPA ioctl PR: 252711 Submitted by: Eugene --- sys/dev/ppbus/ppi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ppbus/ppi.h b/sys/dev/ppbus/ppi.h index 4fb16e921179..b6f406a4aabb 100644 --- a/sys/dev/ppbus/ppi.h +++ b/sys/dev/ppbus/ppi.h @@ -51,6 +51,6 @@ #define PPISFIFO _IOW('P', 21, u_int8_t) #define PPIGEPPA _IOR('P', 22, u_int8_t) -#define PPISEPPA _IOR('P', 23, u_int8_t) +#define PPISEPPA _IOW('P', 23, u_int8_t) #endif From owner-dev-commits-src-main@freebsd.org Tue Jan 19 01:24:56 2021 Return-Path: Delivered-To: dev-commits-src-main@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 268D84DB8AF; Tue, 19 Jan 2021 01:24:56 +0000 (UTC) (envelope-from rpokala@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKWD80cdqz3n2f; Tue, 19 Jan 2021 01:24:56 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 7A12625C93; Tue, 19 Jan 2021 01:24:55 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.45.21011103 Date: Mon, 18 Jan 2021 17:24:50 -0800 Subject: Re: ad1ebbe5cea8 - main - loader: create local copy of mode list provided by vbeinfoblock From: Ravi Pokala To: Toomas Soome , , , Message-ID: <7FCB573F-0BC6-429E-919C-6A87513DBD63@panasas.com> Thread-Topic: ad1ebbe5cea8 - main - loader: create local copy of mode list provided by vbeinfoblock References: <202101160823.10G8NjEi016925@gitrepo.freebsd.org> In-Reply-To: <202101160823.10G8NjEi016925@gitrepo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 01:24:56 -0000 Hi Toomas, =EF=BB=BF-----Original Message----- From: on behalf of Toomas Soome Date: 2021-01-16, Saturday at 00:23 To: , , Subject: git: ad1ebbe5cea8 - main - loader: create local copy of mode list = provided by vbeinfoblock The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=3Dad1ebbe5cea8ffac0037966990= ddf0f80faa55d5 commit ad1ebbe5cea8ffac0037966990ddf0f80faa55d5 Author: Toomas Soome AuthorDate: 2021-01-16 10:18:32 +0000 Commit: Toomas Soome CommitDate: 2021-01-16 10:23:22 +0000 loader: create local copy of mode list provided by vbeinfoblock Apparently some systems do corrupt mode list memory area, so we nee= d to use local copy instead. ... + vbe_mode_list_size =3D (uintptr_t)p - (uintptr_t)ml; + vbe_mode_list =3D malloc(vbe_mode_list_size); + if (vbe_mode_list =3D=3D NULL) { + free(vbe); + vbe =3D NULL; + free(vbe_mode); + vbe_mode =3D NULL; + } + bcopy(ml, vbe_mode_list, vbe_mode_list_size); + + /* reset VideoModePtr, so we will not have chance to use bad data. */ + vbe->VideoModePtr =3D 0; If allocation of vbe_mode_list failed, you're freeing things that were allo= cated before it, but then you're continuing on. The very next thing you do i= s the bcopy(), which dereferences vbe_mode_list, which is NULL because of th= e allocation failure. That doesn't seem right. Thanks, Ravi (rpokala@) From owner-dev-commits-src-main@freebsd.org Tue Jan 19 01:27:44 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D7ED04DBB6B; Tue, 19 Jan 2021 01:27:44 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKWHN5Jntz3nBW; Tue, 19 Jan 2021 01:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A90791E040; Tue, 19 Jan 2021 01:27:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J1RiSD098808; Tue, 19 Jan 2021 01:27:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J1RiA1098807; Tue, 19 Jan 2021 01:27:44 GMT (envelope-from git) Date: Tue, 19 Jan 2021 01:27:44 GMT Message-Id: <202101190127.10J1RiA1098807@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: effad35ed1e5 - main - jail: Clean up some function placement and improve comments. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: effad35ed1e52196469f8f2709b0f1f74cd2ce8c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 01:27:44 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=effad35ed1e52196469f8f2709b0f1f74cd2ce8c commit effad35ed1e52196469f8f2709b0f1f74cd2ce8c Author: Jamie Gritton AuthorDate: 2021-01-19 01:23:51 +0000 Commit: Jamie Gritton CommitDate: 2021-01-19 01:23:51 +0000 jail: Clean up some function placement and improve comments. Move prison_hold, prison_hold_locked ,prison_proc_hold, and prison_proc_free to a more intuitive part of the file (together with with prison_free and prison_free_locked), and add or improve comments to these and others, to better describe what's going in the prison reference cycle. No functional changes. --- sys/kern/kern_jail.c | 157 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 96 insertions(+), 61 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 4893e4df2781..757b8bd06b89 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -2604,8 +2604,35 @@ prison_allow(struct ucred *cred, unsigned flag) } /* - * Remove a prison reference. If that was the last reference, remove the - * prison itself - but not in this context in case there are locks held. + * Hold a prison reference, by incrementing pr_ref. It is generally + * an error to hold a prison that does not already have a reference. + * A prison record will remain valid as long as it has at least one + * reference, and will not be removed as long as either the prison + * mutex or the allprison lock is held (allprison_lock may be shared). + */ +void +prison_hold_locked(struct prison *pr) +{ + + mtx_assert(&pr->pr_mtx, MA_OWNED); + KASSERT(pr->pr_ref > 0, + ("Trying to hold dead prison %p (jid=%d).", pr, pr->pr_id)); + pr->pr_ref++; +} + +void +prison_hold(struct prison *pr) +{ + + mtx_lock(&pr->pr_mtx); + prison_hold_locked(pr); + mtx_unlock(&pr->pr_mtx); +} + +/* + * Remove a prison reference. If that was the last reference, the + * prison will be removed (at a later time). Return with the prison + * unlocked. */ void prison_free_locked(struct prison *pr) @@ -2615,8 +2642,13 @@ prison_free_locked(struct prison *pr) mtx_assert(&pr->pr_mtx, MA_OWNED); ref = --pr->pr_ref; mtx_unlock(&pr->pr_mtx); - if (ref == 0) + if (ref == 0) { + /* + * Don't remove the last reference in this context, + * in case there are locks held. + */ taskqueue_enqueue(taskqueue_thread, &pr->pr_task); + } } void @@ -2627,6 +2659,54 @@ prison_free(struct prison *pr) prison_free_locked(pr); } +/* + * Hold a a prison for user visibility, by incrementing pr_uref. + * It is generally an error to hold a prison that isn't already + * user-visible, except through the the jail system calls. It is also + * an error to hold an invalid prison. A prison record will remain + * alive as long as it has at least one user reference, and will not + * be set to the dying state was long as the prison mutex is held. + */ +void +prison_proc_hold(struct prison *pr) +{ + + mtx_lock(&pr->pr_mtx); + KASSERT(pr->pr_uref > 0, + ("Cannot add a process to a non-alive prison (jid=%d)", pr->pr_id)); + pr->pr_uref++; + mtx_unlock(&pr->pr_mtx); +} + +/* + * Remove a prison user reference. If it was the last reference, the + * prison will be considered "dying", and may be removed once all of + * its references are dropped. + */ +void +prison_proc_free(struct prison *pr) +{ + + mtx_lock(&pr->pr_mtx); + KASSERT(pr->pr_uref > 0, + ("Trying to kill a process in a dead prison (jid=%d)", pr->pr_id)); + if (pr->pr_uref > 1) + pr->pr_uref--; + else { + /* + * Don't remove the last user reference in this context, + * which is expected to be a process that is not only locked, + * but also half dead. Add a reference so any calls to + * prison_free() won't re-submit the task. + */ + pr->pr_ref++; + mtx_unlock(&pr->pr_mtx); + taskqueue_enqueue(taskqueue_thread, &pr->pr_task); + return; + } + mtx_unlock(&pr->pr_mtx); +} + /* * Complete a call to either prison_free or prison_proc_free. */ @@ -2637,16 +2717,24 @@ prison_complete(void *context, int pending) sx_xlock(&allprison_lock); mtx_lock(&pr->pr_mtx); - prison_deref(pr, pr->pr_uref + /* + * If this is completing a call to prison_proc_free, there will still + * be a user reference held; clear that as well as the reference that + * was added. No references are expected if this is completing a call + * to prison_free, but prison_deref is still called for the cleanup. + */ + prison_deref(pr, pr->pr_uref > 0 ? PD_DEREF | PD_DEUREF | PD_LOCKED | PD_LIST_XLOCKED : PD_LOCKED | PD_LIST_XLOCKED); } /* - * Remove a prison reference (usually). This internal version assumes no - * mutexes are held, except perhaps the prison itself. If there are no more - * references, release and delist the prison. On completion, the prison lock - * and the allprison lock are both unlocked. + * Remove a prison reference and/or user reference (usually). + * This assumes context that allows sleeping (for allprison_lock), + * with no non-sleeping locks held, except perhaps the prison itself. + * If there are no more references, release and delist the prison. + * On completion, the prison lock and the allprison lock are both + * unlocked. */ static void prison_deref(struct prison *pr, int flags) @@ -2750,59 +2838,6 @@ prison_deref(struct prison *pr, int flags) } } -void -prison_hold_locked(struct prison *pr) -{ - - mtx_assert(&pr->pr_mtx, MA_OWNED); - KASSERT(pr->pr_ref > 0, - ("Trying to hold dead prison %p (jid=%d).", pr, pr->pr_id)); - pr->pr_ref++; -} - -void -prison_hold(struct prison *pr) -{ - - mtx_lock(&pr->pr_mtx); - prison_hold_locked(pr); - mtx_unlock(&pr->pr_mtx); -} - -void -prison_proc_hold(struct prison *pr) -{ - - mtx_lock(&pr->pr_mtx); - KASSERT(pr->pr_uref > 0, - ("Cannot add a process to a non-alive prison (jid=%d)", pr->pr_id)); - pr->pr_uref++; - mtx_unlock(&pr->pr_mtx); -} - -void -prison_proc_free(struct prison *pr) -{ - - mtx_lock(&pr->pr_mtx); - KASSERT(pr->pr_uref > 0, - ("Trying to kill a process in a dead prison (jid=%d)", pr->pr_id)); - if (pr->pr_uref > 1) - pr->pr_uref--; - else { - /* - * Don't remove the last user reference in this context, which - * is expected to be a process that is not only locked, but - * also half dead. - */ - pr->pr_ref++; - mtx_unlock(&pr->pr_mtx); - taskqueue_enqueue(taskqueue_thread, &pr->pr_task); - return; - } - mtx_unlock(&pr->pr_mtx); -} - /* * Set or clear a permission bit in the pr_allow field, passing restrictions * (cleared permission) down to child jails. From owner-dev-commits-src-main@freebsd.org Tue Jan 19 04:26:33 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6A7C64E442E; Tue, 19 Jan 2021 04:26:33 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKbFj2CK6z4VbL; Tue, 19 Jan 2021 04:26:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BBA1203A7; Tue, 19 Jan 2021 04:26:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J4QUSR033388; Tue, 19 Jan 2021 04:26:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J4QUku033387; Tue, 19 Jan 2021 04:26:30 GMT (envelope-from git) Date: Tue, 19 Jan 2021 04:26:30 GMT Message-Id: <202101190426.10J4QUku033387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 613fe5321f6c - main - pkgbase: differentiate package versions for ALPHA/BETA/PRERELEASE/RC phases MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 613fe5321f6c18faa80f95132e457295f98b996b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 04:26:33 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=613fe5321f6c18faa80f95132e457295f98b996b commit 613fe5321f6c18faa80f95132e457295f98b996b Author: Emmanuel Vadot AuthorDate: 2021-01-14 12:56:38 +0000 Commit: Kyle Evans CommitDate: 2021-01-19 04:26:22 +0000 pkgbase: differentiate package versions for ALPHA/BETA/PRERELEASE/RC phases The current postfix conversions are: CURRENT / STABLE / PRERELEASE, 12.x-CURRENT becomes 12.snapYYYYMMDDhhmmss ALPHAx -> .ax, so 11.3-ALPHA1 becomes 11.3.a1.YYYYMMDDhhmmss BETAx -> .bx, so 12.1-BETA2 becomes 12.1.b2.YYYYMMDDhhmmss RCx -> .rcx, so 13.0-RC3 becomes 13.0.rc3.YYYYMMDDhhmmss RELEASE -> (nothing), so 12.1-RELEASE becomes 12.1 RELEASE-pX -> pX, so 12.1-RELEASE-p1 becomes 12.1p1 Note that for development branches we will start to drop the minor version component entirely, which more closely matches how these branches are physically named (stable/NN). snap is a new prefix that was added to pkg in [0], which is simply a more verbose version of the current ".s" used. As noted, build timestamps are also added to ALPHA/BETA/RC versions. This is largely irrelevant for re@ snapshots because they will only produce one set of snapshots for each alpha/beta/rc, but external folks may produce multiple in that timeframe -- at least for alpha. For them, it is imperative that the builds have a differentiating characteristic like this rather than multiple builds across multiple revisions being versioned identically. [0] https://github.com/freebsd/pkg/pull/1929 Reviewed by: gjb, manu Submitted by: rene (original, original version) Differential Revision: https://reviews.freebsd.org/D28167 --- Makefile.inc1 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index bb3d2f98f4a3..969e3d67cd05 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -557,19 +557,21 @@ VERSION= FreeBSD ${_REVISION}-${_BRANCH:C/-p[0-9]+$//} ${TARGET_ARCH} ${SRCRELDA .endif .if !defined(PKG_VERSION) -.if ${_BRANCH:MSTABLE*} || ${_BRANCH:MCURRENT*} || ${_BRANCH:MPRERELEASE*} -TIMENOW= %Y%m%d%H%M%S -EXTRA_REVISION= .s${TIMENOW:gmtime} +_STRTIMENOW= %Y%m%d%H%M%S +_TIMENOW= ${_STRTIMENOW:gmtime} +.if ${_BRANCH:MCURRENT*} || ${_BRANCH:MSTABLE*} || ${_BRANCH:MPRERELEASE*} +_REVISION:= ${_REVISION:R} +EXTRA_REVISION= .snap${_TIMENOW} .elif ${_BRANCH:MALPHA*} -EXTRA_REVISION= _${_BRANCH:C/-ALPHA/.a/} +EXTRA_REVISION= .a${_BRANCH:C/ALPHA([0-9]+).*/\1/}.${_TIMENOW} .elif ${_BRANCH:MBETA*} -EXTRA_REVISION= _${_BRANCH:C/-BETA/.b/} +EXTRA_REVISION= .b${_BRANCH:C/BETA([0-9]+).*/\1/}.${_TIMENOW} .elif ${_BRANCH:MRC*} -EXTRA_REVISION= _${_BRANCH:C/-RC/.r/} +EXTRA_REVISION= .rc${_BRANCH:C/RC([0-9]+).*/\1/}.${_TIMENOW} .elif ${_BRANCH:M*-p*} -EXTRA_REVISION= _${_BRANCH:C/.*-p([0-9]+$)/\1/} +EXTRA_REVISION= p${_BRANCH:C/.*-p([0-9]+$)/\1/} .endif -PKG_VERSION:= ${_REVISION}${EXTRA_REVISION} +PKG_VERSION:= ${_REVISION}${EXTRA_REVISION:C/[[:space:]]//g} .endif .endif # !defined(PKG_VERSION) From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:07:59 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D33614E4FE4; Tue, 19 Jan 2021 05:07:59 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9W5gjGz4X15; Tue, 19 Jan 2021 05:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5DFC20D8A; Tue, 19 Jan 2021 05:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J57x2G085537; Tue, 19 Jan 2021 05:07:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J57xQP085536; Tue, 19 Jan 2021 05:07:59 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:07:59 GMT Message-Id: <202101190507.10J57xQP085536@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 1cd1ed3f5dd5 - main - Revert: virtio: Support non-legacy network device and queue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1cd1ed3f5dd50ca070908468a3816f570448427b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:07:59 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=1cd1ed3f5dd50ca070908468a3816f570448427b commit 1cd1ed3f5dd50ca070908468a3816f570448427b Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:23 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:23 +0000 Revert: virtio: Support non-legacy network device and queue And subsequent fix 576b099a. By adding the mergable header to the vtnet_rx_header structure, the size was increased by 2 bytes, breaking the alignment of this structure as described the in preceding comments. Furthermore, the mergable header does not belong the structure. With the mergable feature, the header is placed in line with the data, so there is no need for a separate segment, and misleading to follow the mergable header with any padding. The V1 header is effectively identical to mergable header, and the driver has long supported the mergable feature. Revert this so the later changes that add V1 support can show how V1 is derived from the existing mergable buffers support, and to facilitate a later MFC. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27855 --- sys/dev/virtio/network/if_vtnet.c | 17 ++++++----------- sys/dev/virtio/network/if_vtnetvar.h | 14 ++++---------- sys/dev/virtio/virtio.c | 2 +- sys/dev/virtio/virtqueue.c | 1 - 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 2bfa72734f9e..e16570f7b4f1 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -640,13 +640,10 @@ vtnet_setup_features(struct vtnet_softc *sc) sc->vtnet_flags |= VTNET_FLAG_MAC; } - if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) + if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) { sc->vtnet_flags |= VTNET_FLAG_MRG_RXBUFS; - - if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF) || - virtio_with_feature(dev, VIRTIO_F_VERSION_1)) sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf); - else + } else sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr); if (sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) @@ -1462,10 +1459,9 @@ vtnet_rxq_enqueue_buf(struct vtnet_rxq *rxq, struct mbuf *m) sglist_reset(sg); if ((sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) == 0) { - MPASS(sc->vtnet_hdr_size == sizeof(rxhdr->vrh_uhdr.hdr) || - sc->vtnet_hdr_size == sizeof(rxhdr->vrh_uhdr.mhdr)); + MPASS(sc->vtnet_hdr_size == sizeof(struct virtio_net_hdr)); rxhdr = (struct vtnet_rx_header *) mdata; - sglist_append(sg, &rxhdr->vrh_uhdr, sc->vtnet_hdr_size); + sglist_append(sg, &rxhdr->vrh_hdr, sc->vtnet_hdr_size); offset = sizeof(struct vtnet_rx_header); } else offset = 0; @@ -1819,10 +1815,9 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) adjsz = sizeof(struct vtnet_rx_header); /* * Account for our pad inserted between the header - * and the actual start of the frame. This includes - * the unused num_buffers when using a legacy device. + * and the actual start of the frame. */ - len += adjsz - sc->vtnet_hdr_size; + len += VTNET_RX_HEADER_PAD; } else { mhdr = mtod(m, struct virtio_net_hdr_mrg_rxbuf *); nbufs = mhdr->num_buffers; diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 01775cc186f2..24f2c354a298 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -219,20 +219,15 @@ struct vtnet_softc { * When mergeable buffers are not negotiated, the vtnet_rx_header structure * below is placed at the beginning of the mbuf data. Use 4 bytes of pad to * both keep the VirtIO header and the data non-contiguous and to keep the - * frame's payload 4 byte aligned. Note that non-legacy drivers still want - * room for a full mergeable buffer header. + * frame's payload 4 byte aligned. * * When mergeable buffers are negotiated, the host puts the VirtIO header in * the beginning of the first mbuf's data. */ #define VTNET_RX_HEADER_PAD 4 struct vtnet_rx_header { - union { - struct virtio_net_hdr hdr; - struct virtio_net_hdr_mrg_rxbuf mhdr; - } vrh_uhdr; - - char vrh_pad[VTNET_RX_HEADER_PAD]; + struct virtio_net_hdr vrh_hdr; + char vrh_pad[VTNET_RX_HEADER_PAD]; } __packed; /* @@ -301,8 +296,7 @@ CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE); VIRTIO_NET_F_MRG_RXBUF | \ VIRTIO_NET_F_MQ | \ VIRTIO_RING_F_EVENT_IDX | \ - VIRTIO_RING_F_INDIRECT_DESC | \ - VIRTIO_F_VERSION_1) + VIRTIO_RING_F_INDIRECT_DESC) /* * The VIRTIO_NET_F_HOST_TSO[46] features permit us to send the host diff --git a/sys/dev/virtio/virtio.c b/sys/dev/virtio/virtio.c index a37f7b550c93..b6537e9305ea 100644 --- a/sys/dev/virtio/virtio.c +++ b/sys/dev/virtio/virtio.c @@ -78,7 +78,7 @@ static struct virtio_feature_desc virtio_common_feature_desc[] = { { VIRTIO_RING_F_INDIRECT_DESC, "RingIndirect" }, { VIRTIO_RING_F_EVENT_IDX, "EventIdx" }, { VIRTIO_F_BAD_FEATURE, "BadFeature" }, - { VIRTIO_F_VERSION_1, "Version1" }, + { 0, NULL } }; diff --git a/sys/dev/virtio/virtqueue.c b/sys/dev/virtio/virtqueue.c index 0273c2ad005b..e23d4d25c47f 100644 --- a/sys/dev/virtio/virtqueue.c +++ b/sys/dev/virtio/virtqueue.c @@ -142,7 +142,6 @@ virtqueue_filter_features(uint64_t features) mask = (1 << VIRTIO_TRANSPORT_F_START) - 1; mask |= VIRTIO_RING_F_INDIRECT_DESC; mask |= VIRTIO_RING_F_EVENT_IDX; - mask |= VIRTIO_F_VERSION_1; return (features & mask); } From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:00 2021 Return-Path: Delivered-To: dev-commits-src-main@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 EFBCC4E5249; Tue, 19 Jan 2021 05:08:00 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9X6Rdmz4X3b; Tue, 19 Jan 2021 05:08:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFE1020D11; Tue, 19 Jan 2021 05:08:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58086085559; Tue, 19 Jan 2021 05:08:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J580Tb085558; Tue, 19 Jan 2021 05:08:00 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:00 GMT Message-Id: <202101190508.10J580Tb085558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 9da9560c4dd3 - main - virtio: Add VirtIO PCI modern (V1) support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9da9560c4dd3556519cd391a04f0db157dc3c295 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:01 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=9da9560c4dd3556519cd391a04f0db157dc3c295 commit 9da9560c4dd3556519cd391a04f0db157dc3c295 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:23 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:23 +0000 virtio: Add VirtIO PCI modern (V1) support Use the existing legacy PCI driver as the basis for shared code between the legacy and modern PCI drivers. The existing virtio_pci kernel module will contain both the legacy and modern drivers. Changes to the virtqueue and each device driver (network, block, etc) for V1 support come in later commits. Update the MMIO driver to reflect the VirtIO bus method changes, but the modern compliance can be improved on later. Note that the modern PCI driver requires bus_map_resource() to be implemented, which is not the case on all archs. The hw.virtio.pci.transitional tunable default value is zero so transitional devices will continue to be driven via the legacy driver. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27856 --- sys/conf/files | 3 + sys/dev/virtio/mmio/virtio_mmio.c | 23 +- sys/dev/virtio/pci/virtio_pci.c | 1297 +++++++++---------------- sys/dev/virtio/pci/virtio_pci.h | 173 ++-- sys/dev/virtio/pci/virtio_pci_if.m | 71 ++ sys/dev/virtio/pci/virtio_pci_legacy.c | 733 ++++++++++++++ sys/dev/virtio/pci/virtio_pci_legacy_var.h | 78 ++ sys/dev/virtio/pci/virtio_pci_modern.c | 1448 ++++++++++++++++++++++++++++ sys/dev/virtio/pci/virtio_pci_modern_var.h | 135 +++ sys/dev/virtio/pci/virtio_pci_var.h | 55 ++ sys/dev/virtio/virtio.c | 76 +- sys/dev/virtio/virtio.h | 8 + sys/dev/virtio/virtio_bus_if.m | 11 + sys/dev/virtio/virtio_endian.h | 106 ++ sys/dev/virtio/virtqueue.c | 10 +- sys/dev/virtio/virtqueue.h | 4 +- sys/modules/virtio/pci/Makefile | 5 +- 17 files changed, 3292 insertions(+), 944 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index e641b79d9c46..79f3b7ca54e6 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3457,6 +3457,9 @@ dev/virtio/virtqueue.c optional virtio dev/virtio/virtio_bus_if.m optional virtio dev/virtio/virtio_if.m optional virtio dev/virtio/pci/virtio_pci.c optional virtio_pci +dev/virtio/pci/virtio_pci_if.m optional virtio_pci +dev/virtio/pci/virtio_pci_legacy.c optional virtio_pci +dev/virtio/pci/virtio_pci_modern.c optional virtio_pci dev/virtio/mmio/virtio_mmio.c optional virtio_mmio dev/virtio/mmio/virtio_mmio_acpi.c optional virtio_mmio acpi dev/virtio/mmio/virtio_mmio_fdt.c optional virtio_mmio fdt diff --git a/sys/dev/virtio/mmio/virtio_mmio.c b/sys/dev/virtio/mmio/virtio_mmio.c index bb5d84754f09..694d2a232fdd 100644 --- a/sys/dev/virtio/mmio/virtio_mmio.c +++ b/sys/dev/virtio/mmio/virtio_mmio.c @@ -84,7 +84,7 @@ static void vtmmio_stop(device_t); static void vtmmio_poll(device_t); static int vtmmio_reinit(device_t, uint64_t); static void vtmmio_reinit_complete(device_t); -static void vtmmio_notify_virtqueue(device_t, uint16_t); +static void vtmmio_notify_virtqueue(device_t, uint16_t, bus_size_t); static uint8_t vtmmio_get_status(device_t); static void vtmmio_set_status(device_t, uint8_t); static void vtmmio_read_dev_config(device_t, bus_size_t, void *, int); @@ -352,6 +352,13 @@ vtmmio_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) */ *result = 0; break; + case VIRTIO_IVAR_MODERN: + /* + * There are several modern (aka MMIO v2) spec compliance + * issues with this driver, but keep the status quo. + */ + *result = sc->vtmmio_version > 1; + break; default: return (ENOENT); } @@ -388,6 +395,10 @@ vtmmio_negotiate_features(device_t dev, uint64_t child_features) sc = device_get_softc(dev); + if (sc->vtmmio_version > 1) { + child_features |= VIRTIO_F_VERSION_1; + } + vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 1); host_features = vtmmio_read_config_4(sc, VIRTIO_MMIO_HOST_FEATURES); host_features <<= 32; @@ -402,7 +413,7 @@ vtmmio_negotiate_features(device_t dev, uint64_t child_features) * host all support. */ features = host_features & child_features; - features = virtqueue_filter_features(features); + features = virtio_filter_transport_features(features); sc->vtmmio_features = features; vtmmio_describe_features(sc, "negotiated", features); @@ -504,7 +515,8 @@ vtmmio_alloc_virtqueues(device_t dev, int flags, int nvqs, size = vtmmio_read_config_4(sc, VIRTIO_MMIO_QUEUE_NUM_MAX); error = virtqueue_alloc(dev, idx, size, - VIRTIO_MMIO_VRING_ALIGN, ~(vm_paddr_t)0, info, &vq); + VIRTIO_MMIO_QUEUE_NOTIFY, VIRTIO_MMIO_VRING_ALIGN, + ~(vm_paddr_t)0, info, &vq); if (error) { device_printf(dev, "cannot allocate virtqueue %d: %d\n", @@ -586,13 +598,14 @@ vtmmio_reinit_complete(device_t dev) } static void -vtmmio_notify_virtqueue(device_t dev, uint16_t queue) +vtmmio_notify_virtqueue(device_t dev, uint16_t queue, bus_size_t offset) { struct vtmmio_softc *sc; sc = device_get_softc(dev); + MPASS(offset == VIRTIO_MMIO_QUEUE_NOTIFY); - vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_NOTIFY, queue); + vtmmio_write_config_4(sc, offset, queue); } static uint8_t diff --git a/sys/dev/virtio/pci/virtio_pci.c b/sys/dev/virtio/pci/virtio_pci.c index 05a632f526a8..4d6fa929ef19 100644 --- a/sys/dev/virtio/pci/virtio_pci.c +++ b/sys/dev/virtio/pci/virtio_pci.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2011, Bryan Venteicher + * Copyright (c) 2017, Bryan Venteicher * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,8 +26,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* Driver for the VirtIO PCI interface. */ - #include __FBSDID("$FreeBSD$"); @@ -37,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -50,369 +47,236 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include -#include "virtio_bus_if.h" +#include "virtio_pci_if.h" #include "virtio_if.h" -struct vtpci_interrupt { - struct resource *vti_irq; - int vti_rid; - void *vti_handler; -}; - -struct vtpci_virtqueue { - struct virtqueue *vtv_vq; - int vtv_no_intr; -}; - -struct vtpci_softc { - device_t vtpci_dev; - struct resource *vtpci_res; - struct resource *vtpci_msix_res; - uint64_t vtpci_features; - uint32_t vtpci_flags; -#define VTPCI_FLAG_NO_MSI 0x0001 -#define VTPCI_FLAG_NO_MSIX 0x0002 -#define VTPCI_FLAG_LEGACY 0x1000 -#define VTPCI_FLAG_MSI 0x2000 -#define VTPCI_FLAG_MSIX 0x4000 -#define VTPCI_FLAG_SHARED_MSIX 0x8000 -#define VTPCI_FLAG_ITYPE_MASK 0xF000 - - /* This "bus" will only ever have one child. */ - device_t vtpci_child_dev; - struct virtio_feature_desc *vtpci_child_feat_desc; - - int vtpci_nvqs; - struct vtpci_virtqueue *vtpci_vqs; - - /* - * Ideally, each virtqueue that the driver provides a callback for will - * receive its own MSIX vector. If there are not sufficient vectors - * available, then attempt to have all the VQs share one vector. For - * MSIX, the configuration changed notifications must be on their own - * vector. - * - * If MSIX is not available, we will attempt to have the whole device - * share one MSI vector, and then, finally, one legacy interrupt. - */ - struct vtpci_interrupt vtpci_device_interrupt; - struct vtpci_interrupt *vtpci_msix_vq_interrupts; - int vtpci_nmsix_resources; -}; - -static int vtpci_probe(device_t); -static int vtpci_attach(device_t); -static int vtpci_detach(device_t); -static int vtpci_suspend(device_t); -static int vtpci_resume(device_t); -static int vtpci_shutdown(device_t); -static void vtpci_driver_added(device_t, driver_t *); -static void vtpci_child_detached(device_t, device_t); -static int vtpci_read_ivar(device_t, device_t, int, uintptr_t *); -static int vtpci_write_ivar(device_t, device_t, int, uintptr_t); - -static uint64_t vtpci_negotiate_features(device_t, uint64_t); -static int vtpci_with_feature(device_t, uint64_t); -static int vtpci_alloc_virtqueues(device_t, int, int, - struct vq_alloc_info *); -static int vtpci_setup_intr(device_t, enum intr_type); -static void vtpci_stop(device_t); -static int vtpci_reinit(device_t, uint64_t); -static void vtpci_reinit_complete(device_t); -static void vtpci_notify_virtqueue(device_t, uint16_t); -static uint8_t vtpci_get_status(device_t); -static void vtpci_set_status(device_t, uint8_t); -static void vtpci_read_dev_config(device_t, bus_size_t, void *, int); -static void vtpci_write_dev_config(device_t, bus_size_t, void *, int); - -static void vtpci_describe_features(struct vtpci_softc *, const char *, +static void vtpci_describe_features(struct vtpci_common *, const char *, uint64_t); -static void vtpci_probe_and_attach_child(struct vtpci_softc *); - -static int vtpci_alloc_msix(struct vtpci_softc *, int); -static int vtpci_alloc_msi(struct vtpci_softc *); -static int vtpci_alloc_intr_msix_pervq(struct vtpci_softc *); -static int vtpci_alloc_intr_msix_shared(struct vtpci_softc *); -static int vtpci_alloc_intr_msi(struct vtpci_softc *); -static int vtpci_alloc_intr_legacy(struct vtpci_softc *); -static int vtpci_alloc_interrupt(struct vtpci_softc *, int, int, +static int vtpci_alloc_msix(struct vtpci_common *, int); +static int vtpci_alloc_msi(struct vtpci_common *); +static int vtpci_alloc_intr_msix_pervq(struct vtpci_common *); +static int vtpci_alloc_intr_msix_shared(struct vtpci_common *); +static int vtpci_alloc_intr_msi(struct vtpci_common *); +static int vtpci_alloc_intr_intx(struct vtpci_common *); +static int vtpci_alloc_interrupt(struct vtpci_common *, int, int, + struct vtpci_interrupt *); +static void vtpci_free_interrupt(struct vtpci_common *, struct vtpci_interrupt *); -static int vtpci_alloc_intr_resources(struct vtpci_softc *); -static int vtpci_setup_legacy_interrupt(struct vtpci_softc *, +static void vtpci_free_interrupts(struct vtpci_common *); +static void vtpci_free_virtqueues(struct vtpci_common *); +static void vtpci_cleanup_setup_intr_attempt(struct vtpci_common *); +static int vtpci_alloc_intr_resources(struct vtpci_common *); +static int vtpci_setup_intx_interrupt(struct vtpci_common *, enum intr_type); -static int vtpci_setup_pervq_msix_interrupts(struct vtpci_softc *, +static int vtpci_setup_pervq_msix_interrupts(struct vtpci_common *, enum intr_type); -static int vtpci_setup_msix_interrupts(struct vtpci_softc *, +static int vtpci_set_host_msix_vectors(struct vtpci_common *); +static int vtpci_setup_msix_interrupts(struct vtpci_common *, enum intr_type); -static int vtpci_setup_interrupts(struct vtpci_softc *, enum intr_type); - -static int vtpci_register_msix_vector(struct vtpci_softc *, int, - struct vtpci_interrupt *); -static int vtpci_set_host_msix_vectors(struct vtpci_softc *); -static int vtpci_reinit_virtqueue(struct vtpci_softc *, int); - -static void vtpci_free_interrupt(struct vtpci_softc *, - struct vtpci_interrupt *); -static void vtpci_free_interrupts(struct vtpci_softc *); -static void vtpci_free_virtqueues(struct vtpci_softc *); -static void vtpci_release_child_resources(struct vtpci_softc *); -static void vtpci_cleanup_setup_intr_attempt(struct vtpci_softc *); -static void vtpci_reset(struct vtpci_softc *); - -static void vtpci_select_virtqueue(struct vtpci_softc *, int); - -static void vtpci_legacy_intr(void *); +static int vtpci_setup_intrs(struct vtpci_common *, enum intr_type); +static int vtpci_reinit_virtqueue(struct vtpci_common *, int); +static void vtpci_intx_intr(void *); static int vtpci_vq_shared_intr_filter(void *); static void vtpci_vq_shared_intr(void *); static int vtpci_vq_intr_filter(void *); static void vtpci_vq_intr(void *); static void vtpci_config_intr(void *); -#define vtpci_setup_msi_interrupt vtpci_setup_legacy_interrupt - -#define VIRTIO_PCI_CONFIG(_sc) \ - VIRTIO_PCI_CONFIG_OFF((((_sc)->vtpci_flags & VTPCI_FLAG_MSIX)) != 0) - -/* - * I/O port read/write wrappers. - */ -#define vtpci_read_config_1(sc, o) bus_read_1((sc)->vtpci_res, (o)) -#define vtpci_write_config_1(sc, o, v) bus_write_1((sc)->vtpci_res, (o), (v)) +#define vtpci_setup_msi_interrupt vtpci_setup_intx_interrupt /* - * Virtio-pci specifies that PCI Configuration area is guest endian. However, - * since PCI devices are inherently little-endian, on BE systems the bus layer - * transparently converts it to BE. For virtio-legacy, this conversion is - * undesired, so an extra byte swap is required to fix it. + * This module contains two drivers: + * - virtio_pci_legacy for pre-V1 support + * - virtio_pci_modern for V1 support */ -#define vtpci_read_config_2(sc, o) le16toh(bus_read_2((sc)->vtpci_res, (o))) -#define vtpci_read_config_4(sc, o) le32toh(bus_read_4((sc)->vtpci_res, (o))) -#define vtpci_write_config_2(sc, o, v) bus_write_2((sc)->vtpci_res, (o), (htole16(v))) -#define vtpci_write_config_4(sc, o, v) bus_write_4((sc)->vtpci_res, (o), (htole32(v))) - -/* PCI Header LE. On BE systems the bus layer takes care of byte swapping */ -#define vtpci_read_header_2(sc, o) (bus_read_2((sc)->vtpci_res, (o))) -#define vtpci_read_header_4(sc, o) (bus_read_4((sc)->vtpci_res, (o))) -#define vtpci_write_header_2(sc, o, v) bus_write_2((sc)->vtpci_res, (o), (v)) -#define vtpci_write_header_4(sc, o, v) bus_write_4((sc)->vtpci_res, (o), (v)) - -/* Tunables. */ -static int vtpci_disable_msix = 0; -TUNABLE_INT("hw.virtio.pci.disable_msix", &vtpci_disable_msix); - -static device_method_t vtpci_methods[] = { - /* Device interface. */ - DEVMETHOD(device_probe, vtpci_probe), - DEVMETHOD(device_attach, vtpci_attach), - DEVMETHOD(device_detach, vtpci_detach), - DEVMETHOD(device_suspend, vtpci_suspend), - DEVMETHOD(device_resume, vtpci_resume), - DEVMETHOD(device_shutdown, vtpci_shutdown), - - /* Bus interface. */ - DEVMETHOD(bus_driver_added, vtpci_driver_added), - DEVMETHOD(bus_child_detached, vtpci_child_detached), - DEVMETHOD(bus_child_pnpinfo_str, virtio_child_pnpinfo_str), - DEVMETHOD(bus_read_ivar, vtpci_read_ivar), - DEVMETHOD(bus_write_ivar, vtpci_write_ivar), - - /* VirtIO bus interface. */ - DEVMETHOD(virtio_bus_negotiate_features, vtpci_negotiate_features), - DEVMETHOD(virtio_bus_with_feature, vtpci_with_feature), - DEVMETHOD(virtio_bus_alloc_virtqueues, vtpci_alloc_virtqueues), - DEVMETHOD(virtio_bus_setup_intr, vtpci_setup_intr), - DEVMETHOD(virtio_bus_stop, vtpci_stop), - DEVMETHOD(virtio_bus_reinit, vtpci_reinit), - DEVMETHOD(virtio_bus_reinit_complete, vtpci_reinit_complete), - DEVMETHOD(virtio_bus_notify_vq, vtpci_notify_virtqueue), - DEVMETHOD(virtio_bus_read_device_config, vtpci_read_dev_config), - DEVMETHOD(virtio_bus_write_device_config, vtpci_write_dev_config), - - DEVMETHOD_END -}; - -static driver_t vtpci_driver = { - "virtio_pci", - vtpci_methods, - sizeof(struct vtpci_softc) -}; - -devclass_t vtpci_devclass; - -DRIVER_MODULE(virtio_pci, pci, vtpci_driver, vtpci_devclass, 0, 0); MODULE_VERSION(virtio_pci, 1); MODULE_DEPEND(virtio_pci, pci, 1, 1, 1); MODULE_DEPEND(virtio_pci, virtio, 1, 1, 1); -static int -vtpci_probe(device_t dev) -{ - char desc[36]; - const char *name; +int vtpci_disable_msix = 0; +TUNABLE_INT("hw.virtio.pci.disable_msix", &vtpci_disable_msix); - if (pci_get_vendor(dev) != VIRTIO_PCI_VENDORID) - return (ENXIO); +static uint8_t +vtpci_read_isr(struct vtpci_common *cn) +{ + return (VIRTIO_PCI_READ_ISR(cn->vtpci_dev)); +} - if (pci_get_device(dev) < VIRTIO_PCI_DEVICEID_MIN || - pci_get_device(dev) > VIRTIO_PCI_DEVICEID_MAX) - return (ENXIO); +static uint16_t +vtpci_get_vq_size(struct vtpci_common *cn, int idx) +{ + return (VIRTIO_PCI_GET_VQ_SIZE(cn->vtpci_dev, idx)); +} - if (pci_get_revid(dev) != VIRTIO_PCI_ABI_VERSION) - return (ENXIO); +static bus_size_t +vtpci_get_vq_notify_off(struct vtpci_common *cn, int idx) +{ + return (VIRTIO_PCI_GET_VQ_NOTIFY_OFF(cn->vtpci_dev, idx)); +} - name = virtio_device_name(pci_get_subdevice(dev)); - if (name == NULL) - name = "Unknown"; +static void +vtpci_set_vq(struct vtpci_common *cn, struct virtqueue *vq) +{ + VIRTIO_PCI_SET_VQ(cn->vtpci_dev, vq); +} - snprintf(desc, sizeof(desc), "VirtIO PCI %s adapter", name); - device_set_desc_copy(dev, desc); +static void +vtpci_disable_vq(struct vtpci_common *cn, int idx) +{ + VIRTIO_PCI_DISABLE_VQ(cn->vtpci_dev, idx); +} - return (BUS_PROBE_DEFAULT); +static int +vtpci_register_cfg_msix(struct vtpci_common *cn, struct vtpci_interrupt *intr) +{ + return (VIRTIO_PCI_REGISTER_CFG_MSIX(cn->vtpci_dev, intr)); } static int -vtpci_attach(device_t dev) +vtpci_register_vq_msix(struct vtpci_common *cn, int idx, + struct vtpci_interrupt *intr) { - struct vtpci_softc *sc; - device_t child; - int rid; + return (VIRTIO_PCI_REGISTER_VQ_MSIX(cn->vtpci_dev, idx, intr)); +} - sc = device_get_softc(dev); - sc->vtpci_dev = dev; +void +vtpci_init(struct vtpci_common *cn, device_t dev, bool modern) +{ - pci_enable_busmaster(dev); + cn->vtpci_dev = dev; - rid = PCIR_BAR(0); - sc->vtpci_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, - RF_ACTIVE); - if (sc->vtpci_res == NULL) { - device_printf(dev, "cannot map I/O space\n"); - return (ENXIO); - } + pci_enable_busmaster(dev); + if (modern) + cn->vtpci_flags |= VTPCI_FLAG_MODERN; if (pci_find_cap(dev, PCIY_MSI, NULL) != 0) - sc->vtpci_flags |= VTPCI_FLAG_NO_MSI; - - if (pci_find_cap(dev, PCIY_MSIX, NULL) == 0) { - rid = PCIR_BAR(1); - sc->vtpci_msix_res = bus_alloc_resource_any(dev, - SYS_RES_MEMORY, &rid, RF_ACTIVE); - } - - if (sc->vtpci_msix_res == NULL) - sc->vtpci_flags |= VTPCI_FLAG_NO_MSIX; + cn->vtpci_flags |= VTPCI_FLAG_NO_MSI; + if (pci_find_cap(dev, PCIY_MSIX, NULL) != 0) + cn->vtpci_flags |= VTPCI_FLAG_NO_MSIX; +} - vtpci_reset(sc); +int +vtpci_add_child(struct vtpci_common *cn) +{ + device_t dev, child; - /* Tell the host we've noticed this device. */ - vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_ACK); + dev = cn->vtpci_dev; - if ((child = device_add_child(dev, NULL, -1)) == NULL) { + child = device_add_child(dev, NULL, -1); + if (child == NULL) { device_printf(dev, "cannot create child device\n"); - vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_FAILED); - vtpci_detach(dev); return (ENOMEM); } - sc->vtpci_child_dev = child; - vtpci_probe_and_attach_child(sc); + cn->vtpci_child_dev = child; return (0); } -static int -vtpci_detach(device_t dev) +int +vtpci_delete_child(struct vtpci_common *cn) { - struct vtpci_softc *sc; - device_t child; + device_t dev, child; int error; - sc = device_get_softc(dev); + dev = cn->vtpci_dev; - if ((child = sc->vtpci_child_dev) != NULL) { + child = cn->vtpci_child_dev; + if (child != NULL) { error = device_delete_child(dev, child); if (error) return (error); - sc->vtpci_child_dev = NULL; - } - - vtpci_reset(sc); - - if (sc->vtpci_msix_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(1), - sc->vtpci_msix_res); - sc->vtpci_msix_res = NULL; - } - - if (sc->vtpci_res != NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), - sc->vtpci_res); - sc->vtpci_res = NULL; + cn->vtpci_child_dev = NULL; } return (0); } -static int -vtpci_suspend(device_t dev) +void +vtpci_child_detached(struct vtpci_common *cn) { - return (bus_generic_suspend(dev)); -} - -static int -vtpci_resume(device_t dev) -{ + vtpci_release_child_resources(cn); - return (bus_generic_resume(dev)); + cn->vtpci_child_feat_desc = NULL; + cn->vtpci_features = 0; } -static int -vtpci_shutdown(device_t dev) +int +vtpci_reinit(struct vtpci_common *cn) { + int idx, error; - (void) bus_generic_shutdown(dev); - /* Forcibly stop the host device. */ - vtpci_stop(dev); + for (idx = 0; idx < cn->vtpci_nvqs; idx++) { + error = vtpci_reinit_virtqueue(cn, idx); + if (error) + return (error); + } + + if (vtpci_is_msix_enabled(cn)) { + error = vtpci_set_host_msix_vectors(cn); + if (error) + return (error); + } return (0); } static void -vtpci_driver_added(device_t dev, driver_t *driver) +vtpci_describe_features(struct vtpci_common *cn, const char *msg, + uint64_t features) { - struct vtpci_softc *sc; + device_t dev, child; + + dev = cn->vtpci_dev; + child = cn->vtpci_child_dev; - sc = device_get_softc(dev); + if (device_is_attached(child) || bootverbose == 0) + return; - vtpci_probe_and_attach_child(sc); + virtio_describe(dev, msg, features, cn->vtpci_child_feat_desc); } -static void -vtpci_child_detached(device_t dev, device_t child) +uint64_t +vtpci_negotiate_features(struct vtpci_common *cn, + uint64_t child_features, uint64_t host_features) { - struct vtpci_softc *sc; + uint64_t features; - sc = device_get_softc(dev); + vtpci_describe_features(cn, "host", host_features); - vtpci_reset(sc); - vtpci_release_child_resources(sc); + /* + * Limit negotiated features to what the driver, virtqueue, and + * host all support. + */ + features = host_features & child_features; + features = virtio_filter_transport_features(features); + vtpci_describe_features(cn, "negotiated", features); + + cn->vtpci_features = features; + + return (features); } -static int -vtpci_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) +int +vtpci_with_feature(struct vtpci_common *cn, uint64_t feature) { - struct vtpci_softc *sc; + return ((cn->vtpci_features & feature) != 0); +} - sc = device_get_softc(dev); +int +vtpci_read_ivar(struct vtpci_common *cn, int index, uintptr_t *result) +{ + device_t dev; + int error; - if (sc->vtpci_child_dev != child) - return (ENOENT); + dev = cn->vtpci_dev; + error = 0; switch (index) { - case VIRTIO_IVAR_DEVTYPE: case VIRTIO_IVAR_SUBDEVICE: *result = pci_get_subdevice(dev); break; @@ -425,100 +289,74 @@ vtpci_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) case VIRTIO_IVAR_SUBVENDOR: *result = pci_get_subvendor(dev); break; + case VIRTIO_IVAR_MODERN: + *result = vtpci_is_modern(cn); + break; default: - return (ENOENT); + error = ENOENT; } - return (0); + return (error); } -static int -vtpci_write_ivar(device_t dev, device_t child, int index, uintptr_t value) +int +vtpci_write_ivar(struct vtpci_common *cn, int index, uintptr_t value) { - struct vtpci_softc *sc; - - sc = device_get_softc(dev); + int error; - if (sc->vtpci_child_dev != child) - return (ENOENT); + error = 0; switch (index) { case VIRTIO_IVAR_FEATURE_DESC: - sc->vtpci_child_feat_desc = (void *) value; + cn->vtpci_child_feat_desc = (void *) value; break; default: - return (ENOENT); + error = ENOENT; } - return (0); + return (error); } -static uint64_t -vtpci_negotiate_features(device_t dev, uint64_t child_features) +int +vtpci_alloc_virtqueues(struct vtpci_common *cn, int flags, int nvqs, + struct vq_alloc_info *vq_info) { - struct vtpci_softc *sc; - uint64_t host_features, features; - - sc = device_get_softc(dev); + device_t dev; + int idx, align, error; - host_features = vtpci_read_header_4(sc, VIRTIO_PCI_HOST_FEATURES); - vtpci_describe_features(sc, "host", host_features); + dev = cn->vtpci_dev; /* - * Limit negotiated features to what the driver, virtqueue, and - * host all support. + * This is VIRTIO_PCI_VRING_ALIGN from legacy VirtIO. In modern VirtIO, + * the tables do not have to be allocated contiguously, but we do so + * anyways. */ - features = host_features & child_features; - features = virtqueue_filter_features(features); - sc->vtpci_features = features; - - vtpci_describe_features(sc, "negotiated", features); - vtpci_write_header_4(sc, VIRTIO_PCI_GUEST_FEATURES, features); - - return (features); -} - -static int -vtpci_with_feature(device_t dev, uint64_t feature) -{ - struct vtpci_softc *sc; + align = 4096; - sc = device_get_softc(dev); - - return ((sc->vtpci_features & feature) != 0); -} - -static int -vtpci_alloc_virtqueues(device_t dev, int flags, int nvqs, - struct vq_alloc_info *vq_info) -{ - struct vtpci_softc *sc; - struct virtqueue *vq; - struct vtpci_virtqueue *vqx; - struct vq_alloc_info *info; - int idx, error; - uint16_t size; - - sc = device_get_softc(dev); - - if (sc->vtpci_nvqs != 0) + if (cn->vtpci_nvqs != 0) return (EALREADY); if (nvqs <= 0) return (EINVAL); - sc->vtpci_vqs = malloc(nvqs * sizeof(struct vtpci_virtqueue), + cn->vtpci_vqs = malloc(nvqs * sizeof(struct vtpci_virtqueue), M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->vtpci_vqs == NULL) + if (cn->vtpci_vqs == NULL) return (ENOMEM); for (idx = 0; idx < nvqs; idx++) { - vqx = &sc->vtpci_vqs[idx]; + struct vtpci_virtqueue *vqx; + struct vq_alloc_info *info; + struct virtqueue *vq; + bus_size_t notify_offset; + uint16_t size; + + vqx = &cn->vtpci_vqs[idx]; info = &vq_info[idx]; - vtpci_select_virtqueue(sc, idx); - size = vtpci_read_header_2(sc, VIRTIO_PCI_QUEUE_NUM); + size = vtpci_get_vq_size(cn, idx); + notify_offset = vtpci_get_vq_notify_off(cn, idx); - error = virtqueue_alloc(dev, idx, size, VIRTIO_PCI_VRING_ALIGN, + error = virtqueue_alloc(dev, idx, size, notify_offset, align, ~(vm_paddr_t)0, info, &vq); if (error) { device_printf(dev, @@ -526,270 +364,27 @@ vtpci_alloc_virtqueues(device_t dev, int flags, int nvqs, break; } - vtpci_write_header_4(sc, VIRTIO_PCI_QUEUE_PFN, - virtqueue_paddr(vq) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT); + vtpci_set_vq(cn, vq); vqx->vtv_vq = *info->vqai_vq = vq; vqx->vtv_no_intr = info->vqai_intr == NULL; - sc->vtpci_nvqs++; + cn->vtpci_nvqs++; } if (error) - vtpci_free_virtqueues(sc); + vtpci_free_virtqueues(cn); return (error); } static int -vtpci_setup_intr(device_t dev, enum intr_type type) -{ - struct vtpci_softc *sc; - int attempt, error; - - sc = device_get_softc(dev); - - for (attempt = 0; attempt < 5; attempt++) { - /* - * Start with the most desirable interrupt configuration and - * fallback towards less desirable ones. - */ - switch (attempt) { - case 0: - error = vtpci_alloc_intr_msix_pervq(sc); - break; - case 1: - error = vtpci_alloc_intr_msix_shared(sc); - break; - case 2: - error = vtpci_alloc_intr_msi(sc); - break; - case 3: - error = vtpci_alloc_intr_legacy(sc); - break; - default: - device_printf(dev, - "exhausted all interrupt allocation attempts\n"); - return (ENXIO); - } - - if (error == 0 && vtpci_setup_interrupts(sc, type) == 0) - break; - - vtpci_cleanup_setup_intr_attempt(sc); - } - - if (bootverbose) { - if (sc->vtpci_flags & VTPCI_FLAG_LEGACY) - device_printf(dev, "using legacy interrupt\n"); - else if (sc->vtpci_flags & VTPCI_FLAG_MSI) - device_printf(dev, "using MSI interrupt\n"); - else if (sc->vtpci_flags & VTPCI_FLAG_SHARED_MSIX) - device_printf(dev, "using shared MSIX interrupts\n"); - else - device_printf(dev, "using per VQ MSIX interrupts\n"); - } - - return (0); -} - -static void -vtpci_stop(device_t dev) -{ - - vtpci_reset(device_get_softc(dev)); -} - -static int -vtpci_reinit(device_t dev, uint64_t features) -{ - struct vtpci_softc *sc; - int idx, error; - - sc = device_get_softc(dev); - - /* - * Redrive the device initialization. This is a bit of an abuse of - * the specification, but VirtualBox, QEMU/KVM, and BHyVe seem to - * play nice. - * - * We do not allow the host device to change from what was originally - * negotiated beyond what the guest driver changed. MSIX state should - * not change, number of virtqueues and their size remain the same, etc. - * This will need to be rethought when we want to support migration. - */ - - if (vtpci_get_status(dev) != VIRTIO_CONFIG_STATUS_RESET) - vtpci_stop(dev); - - /* - * Quickly drive the status through ACK and DRIVER. The device - * does not become usable again until vtpci_reinit_complete(). - */ - vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_ACK); - vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_DRIVER); - - vtpci_negotiate_features(dev, features); - - for (idx = 0; idx < sc->vtpci_nvqs; idx++) { - error = vtpci_reinit_virtqueue(sc, idx); - if (error) - return (error); - } - - if (sc->vtpci_flags & VTPCI_FLAG_MSIX) { - error = vtpci_set_host_msix_vectors(sc); - if (error) - return (error); - } - - return (0); -} - -static void -vtpci_reinit_complete(device_t dev) -{ - - vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_DRIVER_OK); -} - -static void -vtpci_notify_virtqueue(device_t dev, uint16_t queue) -{ - struct vtpci_softc *sc; - - sc = device_get_softc(dev); - - vtpci_write_header_2(sc, VIRTIO_PCI_QUEUE_NOTIFY, queue); -} - -static uint8_t -vtpci_get_status(device_t dev) -{ - struct vtpci_softc *sc; - - sc = device_get_softc(dev); - - return (vtpci_read_config_1(sc, VIRTIO_PCI_STATUS)); -} - -static void -vtpci_set_status(device_t dev, uint8_t status) -{ - struct vtpci_softc *sc; - - sc = device_get_softc(dev); - - if (status != VIRTIO_CONFIG_STATUS_RESET) - status |= vtpci_get_status(dev); - - vtpci_write_config_1(sc, VIRTIO_PCI_STATUS, status); -} - -static void -vtpci_read_dev_config(device_t dev, bus_size_t offset, *** 4018 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:04 2021 Return-Path: Delivered-To: dev-commits-src-main@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 58A0F4E5255; Tue, 19 Jan 2021 05:08:04 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9c0043z4X1K; Tue, 19 Jan 2021 05:08:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4323E20D8C; Tue, 19 Jan 2021 05:08:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J583le085600; Tue, 19 Jan 2021 05:08:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J583pG085599; Tue, 19 Jan 2021 05:08:03 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:03 GMT Message-Id: <202101190508.10J583pG085599@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 703f17d60f7f - main - virtio_pci: Add sysctl to show current features MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 703f17d60f7fd2885b5041eec6734804dae49de7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:05 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=703f17d60f7fd2885b5041eec6734804dae49de7 commit 703f17d60f7fd2885b5041eec6734804dae49de7 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:23 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:23 +0000 virtio_pci: Add sysctl to show current features Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27898 --- sys/dev/virtio/pci/virtio_pci.c | 71 ++++++++++++++++++++++++++++++++++++++++- sys/dev/virtio/pci/virtio_pci.h | 1 + sys/dev/virtio/virtio.c | 57 +++++++++++++++++++++------------ sys/dev/virtio/virtio.h | 5 ++- 4 files changed, 112 insertions(+), 22 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci.c b/sys/dev/virtio/pci/virtio_pci.c index 4d6fa929ef19..1a60196b5d02 100644 --- a/sys/dev/virtio/pci/virtio_pci.c +++ b/sys/dev/virtio/pci/virtio_pci.c @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -85,6 +87,8 @@ static int vtpci_vq_intr_filter(void *); static void vtpci_vq_intr(void *); static void vtpci_config_intr(void *); +static void vtpci_setup_sysctl(struct vtpci_common *); + #define vtpci_setup_msi_interrupt vtpci_setup_intx_interrupt /* @@ -156,6 +160,8 @@ vtpci_init(struct vtpci_common *cn, device_t dev, bool modern) cn->vtpci_flags |= VTPCI_FLAG_NO_MSI; if (pci_find_cap(dev, PCIY_MSIX, NULL) != 0) cn->vtpci_flags |= VTPCI_FLAG_NO_MSIX; + + vtpci_setup_sysctl(cn); } int @@ -202,6 +208,7 @@ vtpci_child_detached(struct vtpci_common *cn) vtpci_release_child_resources(cn); cn->vtpci_child_feat_desc = NULL; + cn->vtpci_host_features = 0; cn->vtpci_features = 0; } @@ -246,6 +253,7 @@ vtpci_negotiate_features(struct vtpci_common *cn, { uint64_t features; + cn->vtpci_host_features = host_features; vtpci_describe_features(cn, "host", host_features); /* @@ -254,9 +262,9 @@ vtpci_negotiate_features(struct vtpci_common *cn, */ features = host_features & child_features; features = virtio_filter_transport_features(features); - vtpci_describe_features(cn, "negotiated", features); cn->vtpci_features = features; + vtpci_describe_features(cn, "negotiated", features); return (features); } @@ -930,3 +938,64 @@ vtpci_config_intr(void *xcn) if (child != NULL) VIRTIO_CONFIG_CHANGE(child); } + +static int +vtpci_feature_sysctl(struct sysctl_req *req, struct vtpci_common *cn, + uint64_t features) +{ + struct sbuf *sb; + int error; + + sb = sbuf_new_for_sysctl(NULL, NULL, 256, req); + if (sb == NULL) + return (ENOMEM); + + error = virtio_describe_sbuf(sb, features, cn->vtpci_child_feat_desc); + sbuf_delete(sb); + + return (error); +} + +static int +vtpci_host_features_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct vtpci_common *cn; + + cn = arg1; + + return (vtpci_feature_sysctl(req, cn, cn->vtpci_host_features)); +} + +static int +vtpci_negotiated_features_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct vtpci_common *cn; + + cn = arg1; + + return (vtpci_feature_sysctl(req, cn, cn->vtpci_features)); +} + +static void +vtpci_setup_sysctl(struct vtpci_common *cn) +{ + device_t dev; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + struct sysctl_oid_list *child; + + dev = cn->vtpci_dev; + ctx = device_get_sysctl_ctx(dev); + tree = device_get_sysctl_tree(dev); + child = SYSCTL_CHILDREN(tree); + + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "nvqs", + CTLFLAG_RD, &cn->vtpci_nvqs, 0, "Number of virtqueues"); + + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "host_features", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, cn, 0, + vtpci_host_features_sysctl, "A", "Features supported by the host"); + SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "negotiated_features", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, cn, 0, + vtpci_negotiated_features_sysctl, "A", "Features negotiated"); +} diff --git a/sys/dev/virtio/pci/virtio_pci.h b/sys/dev/virtio/pci/virtio_pci.h index d65ed853c33e..4c9a0e1c4cbe 100644 --- a/sys/dev/virtio/pci/virtio_pci.h +++ b/sys/dev/virtio/pci/virtio_pci.h @@ -45,6 +45,7 @@ struct vtpci_virtqueue { struct vtpci_common { device_t vtpci_dev; + uint64_t vtpci_host_features; uint64_t vtpci_features; struct vtpci_virtqueue *vtpci_vqs; int vtpci_nvqs; diff --git a/sys/dev/virtio/virtio.c b/sys/dev/virtio/virtio.c index 18eace65a12b..53b47004610e 100644 --- a/sys/dev/virtio/virtio.c +++ b/sys/dev/virtio/virtio.c @@ -119,24 +119,15 @@ virtio_feature_name(uint64_t val, struct virtio_feature_desc *desc) return (NULL); } -void -virtio_describe(device_t dev, const char *msg, - uint64_t features, struct virtio_feature_desc *desc) +int +virtio_describe_sbuf(struct sbuf *sb, uint64_t features, + struct virtio_feature_desc *desc) { - struct sbuf sb; - uint64_t val; - char *buf; const char *name; + uint64_t val; int n; - if ((buf = malloc(1024, M_TEMP, M_NOWAIT)) == NULL) { - device_printf(dev, "%s features: %#jx\n", - msg, (uintmax_t) features); - return; - } - - sbuf_new(&sb, buf, 1024, SBUF_FIXEDLEN); - sbuf_printf(&sb, "%s features: %#jx", msg, (uintmax_t) features); + sbuf_printf(sb, "%#jx", (uintmax_t) features); for (n = 0, val = 1ULL << 63; val != 0; val >>= 1) { /* @@ -147,25 +138,51 @@ virtio_describe(device_t dev, const char *msg, continue; if (n++ == 0) - sbuf_cat(&sb, " <"); + sbuf_cat(sb, " <"); else - sbuf_cat(&sb, ","); + sbuf_cat(sb, ","); name = virtio_feature_name(val, desc); if (name == NULL) - sbuf_printf(&sb, "%#jx", (uintmax_t) val); + sbuf_printf(sb, "%#jx", (uintmax_t) val); else - sbuf_cat(&sb, name); + sbuf_cat(sb, name); } if (n > 0) - sbuf_cat(&sb, ">"); + sbuf_cat(sb, ">"); - if (sbuf_finish(&sb) == 0) + return (sbuf_finish(sb)); +} + +void +virtio_describe(device_t dev, const char *msg, uint64_t features, + struct virtio_feature_desc *desc) +{ + struct sbuf sb; + char *buf; + int error; + + if ((buf = malloc(1024, M_TEMP, M_NOWAIT)) == NULL) { + error = ENOMEM; + goto out; + } + + sbuf_new(&sb, buf, 1024, SBUF_FIXEDLEN); + sbuf_printf(&sb, "%s features: ", msg); + + error = virtio_describe_sbuf(&sb, features, desc); + if (error == 0) device_printf(dev, "%s\n", sbuf_data(&sb)); sbuf_delete(&sb); free(buf, M_TEMP); + +out: + if (error != 0) { + device_printf(dev, "%s features: %#jx\n", msg, + (uintmax_t) features); + } } uint64_t diff --git a/sys/dev/virtio/virtio.h b/sys/dev/virtio/virtio.h index 85160eb18d0d..ccac57a5ad96 100644 --- a/sys/dev/virtio/virtio.h +++ b/sys/dev/virtio/virtio.h @@ -35,6 +35,7 @@ #include #include +struct sbuf; struct vq_alloc_info; /* @@ -82,7 +83,9 @@ struct virtio_pnp_match { const char *virtio_device_name(uint16_t devid); void virtio_describe(device_t dev, const char *msg, - uint64_t features, struct virtio_feature_desc *feature_desc); + uint64_t features, struct virtio_feature_desc *desc); +int virtio_describe_sbuf(struct sbuf *sb, uint64_t features, + struct virtio_feature_desc *desc); uint64_t virtio_filter_transport_features(uint64_t features); int virtio_bus_is_modern(device_t dev); void virtio_read_device_config_array(device_t dev, bus_size_t offset, From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:07 2021 Return-Path: Delivered-To: dev-commits-src-main@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 430484E5388; Tue, 19 Jan 2021 05:08:07 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9c5Rntz4XGM; Tue, 19 Jan 2021 05:08:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D4AC20D12; Tue, 19 Jan 2021 05:08:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J5846B085622; Tue, 19 Jan 2021 05:08:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J584CM085619; Tue, 19 Jan 2021 05:08:04 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:04 GMT Message-Id: <202101190508.10J584CM085619@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: d2536a25cc1d - main - virtio_random: Add modern (V1) support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2536a25cc1d9080bc452bf251086a7727f0ebde Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:07 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=d2536a25cc1d9080bc452bf251086a7727f0ebde commit d2536a25cc1d9080bc452bf251086a7727f0ebde Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:23 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:23 +0000 virtio_random: Add modern (V1) support Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27899 --- sys/dev/virtio/random/virtio_random.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/virtio/random/virtio_random.c b/sys/dev/virtio/random/virtio_random.c index dcdb0de95ff0..8c01b1cf6ae3 100644 --- a/sys/dev/virtio/random/virtio_random.c +++ b/sys/dev/virtio/random/virtio_random.c @@ -189,6 +189,7 @@ vtrnd_negotiate_features(device_t dev) sc = device_get_softc(dev); sc->vtrnd_features = virtio_negotiate_features(dev, VTRND_FEATURES); + virtio_finalize_features(dev); } static int From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8600E4E5308; Tue, 19 Jan 2021 05:08:02 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9Z143jz4WvD; Tue, 19 Jan 2021 05:08:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EDF220D8B; Tue, 19 Jan 2021 05:08:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J581KN085578; Tue, 19 Jan 2021 05:08:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J581lo085577; Tue, 19 Jan 2021 05:08:01 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:01 GMT Message-Id: <202101190508.10J581lo085577@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: fbe0c4f4c7f4 - main - virtio: Add modern (v1) virtqueue support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbe0c4f4c7f4474def7b041c29c1e2facf2af08b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:04 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=fbe0c4f4c7f4474def7b041c29c1e2facf2af08b commit fbe0c4f4c7f4474def7b041c29c1e2facf2af08b Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:23 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:23 +0000 virtio: Add modern (v1) virtqueue support This only supports the legacy virtqueue format that is now called "Split Virtqueues". Support for the new "Packed Virtqueues" described in v1.1 is left for a later date. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27857 --- sys/dev/virtio/virtqueue.c | 141 ++++++++++++++++++++++++--------------------- sys/dev/virtio/virtqueue.h | 2 - 2 files changed, 75 insertions(+), 68 deletions(-) diff --git a/sys/dev/virtio/virtqueue.c b/sys/dev/virtio/virtqueue.c index da6e7bf89fd5..14c2088b70a8 100644 --- a/sys/dev/virtio/virtqueue.c +++ b/sys/dev/virtio/virtqueue.c @@ -57,19 +57,15 @@ __FBSDID("$FreeBSD$"); struct virtqueue { device_t vq_dev; - char vq_name[VIRTQUEUE_MAX_NAME_SZ]; uint16_t vq_queue_index; uint16_t vq_nentries; uint32_t vq_flags; -#define VIRTQUEUE_FLAG_INDIRECT 0x0001 -#define VIRTQUEUE_FLAG_EVENT_IDX 0x0002 +#define VIRTQUEUE_FLAG_MODERN 0x0001 +#define VIRTQUEUE_FLAG_INDIRECT 0x0002 +#define VIRTQUEUE_FLAG_EVENT_IDX 0x0004 - bus_size_t vq_notify_offset; - int vq_alignment; - int vq_ring_size; - void *vq_ring_mem; int vq_max_indirect_size; - int vq_indirect_mem_size; + bus_size_t vq_notify_offset; virtqueue_intr_t *vq_intrhand; void *vq_intrhand_arg; @@ -88,6 +84,12 @@ struct virtqueue { */ uint16_t vq_used_cons_idx; + void *vq_ring_mem; + int vq_indirect_mem_size; + int vq_alignment; + int vq_ring_size; + char vq_name[VIRTQUEUE_MAX_NAME_SZ]; + struct vq_desc_extra { void *cookie; struct vring_desc *indirect; @@ -135,17 +137,13 @@ static int vq_ring_must_notify_host(struct virtqueue *); static void vq_ring_notify_host(struct virtqueue *); static void vq_ring_free_chain(struct virtqueue *, uint16_t); -uint64_t -virtqueue_filter_features(uint64_t features) -{ - uint64_t mask; - - mask = (1 << VIRTIO_TRANSPORT_F_START) - 1; - mask |= VIRTIO_RING_F_INDIRECT_DESC; - mask |= VIRTIO_RING_F_EVENT_IDX; - - return (features & mask); -} +#define vq_modern(_vq) (((_vq)->vq_flags & VIRTQUEUE_FLAG_MODERN) != 0) +#define vq_htog16(_vq, _val) virtio_htog16(vq_modern(_vq), _val) +#define vq_htog32(_vq, _val) virtio_htog32(vq_modern(_vq), _val) +#define vq_htog64(_vq, _val) virtio_htog64(vq_modern(_vq), _val) +#define vq_gtoh16(_vq, _val) virtio_gtoh16(vq_modern(_vq), _val) +#define vq_gtoh32(_vq, _val) virtio_gtoh32(vq_modern(_vq), _val) +#define vq_gtoh64(_vq, _val) virtio_gtoh64(vq_modern(_vq), _val) int virtqueue_alloc(device_t dev, uint16_t queue, uint16_t size, @@ -193,6 +191,8 @@ virtqueue_alloc(device_t dev, uint16_t queue, uint16_t size, vq->vq_intrhand = info->vqai_intr; vq->vq_intrhand_arg = info->vqai_intr_arg; + if (VIRTIO_BUS_WITH_FEATURE(dev, VIRTIO_F_VERSION_1) != 0) + vq->vq_flags |= VIRTQUEUE_FLAG_MODERN; if (VIRTIO_BUS_WITH_FEATURE(dev, VIRTIO_RING_F_EVENT_IDX) != 0) vq->vq_flags |= VIRTQUEUE_FLAG_EVENT_IDX; @@ -297,8 +297,8 @@ virtqueue_init_indirect_list(struct virtqueue *vq, bzero(indirect, vq->vq_indirect_mem_size); for (i = 0; i < vq->vq_max_indirect_size - 1; i++) - indirect[i].next = i + 1; - indirect[i].next = VQ_RING_DESC_CHAIN_END; + indirect[i].next = vq_gtoh16(vq, i + 1); + indirect[i].next = vq_gtoh16(vq, VQ_RING_DESC_CHAIN_END); } int @@ -396,6 +396,7 @@ virtqueue_used_paddr(struct virtqueue *vq) uint16_t virtqueue_index(struct virtqueue *vq) { + return (vq->vq_queue_index); } @@ -444,7 +445,7 @@ virtqueue_nused(struct virtqueue *vq) { uint16_t used_idx, nused; - used_idx = vq->vq_ring.used->idx; + used_idx = vq_htog16(vq, vq->vq_ring.used->idx); nused = (uint16_t)(used_idx - vq->vq_used_cons_idx); VQASSERT(vq, nused <= vq->vq_nentries, "used more than available"); @@ -456,7 +457,7 @@ int virtqueue_intr_filter(struct virtqueue *vq) { - if (vq->vq_used_cons_idx == vq->vq_ring.used->idx) + if (vq->vq_used_cons_idx == vq_htog16(vq, vq->vq_ring.used->idx)) return (0); virtqueue_disable_intr(vq); @@ -483,7 +484,7 @@ virtqueue_postpone_intr(struct virtqueue *vq, vq_postpone_t hint) { uint16_t ndesc, avail_idx; - avail_idx = vq->vq_ring.avail->idx; + avail_idx = vq_htog16(vq, vq->vq_ring.avail->idx); ndesc = (uint16_t)(avail_idx - vq->vq_used_cons_idx); switch (hint) { @@ -508,10 +509,12 @@ virtqueue_disable_intr(struct virtqueue *vq) { if (vq->vq_flags & VIRTQUEUE_FLAG_EVENT_IDX) { - vring_used_event(&vq->vq_ring) = vq->vq_used_cons_idx - - vq->vq_nentries - 1; - } else - vq->vq_ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; + vring_used_event(&vq->vq_ring) = vq_gtoh16(vq, + vq->vq_used_cons_idx - vq->vq_nentries - 1); + return; + } + + vq->vq_ring.avail->flags |= vq_gtoh16(vq, VRING_AVAIL_F_NO_INTERRUPT); } int @@ -574,16 +577,16 @@ virtqueue_dequeue(struct virtqueue *vq, uint32_t *len) void *cookie; uint16_t used_idx, desc_idx; - if (vq->vq_used_cons_idx == vq->vq_ring.used->idx) + if (vq->vq_used_cons_idx == vq_htog16(vq, vq->vq_ring.used->idx)) return (NULL); used_idx = vq->vq_used_cons_idx++ & (vq->vq_nentries - 1); uep = &vq->vq_ring.used->ring[used_idx]; rmb(); - desc_idx = (uint16_t) uep->id; + desc_idx = (uint16_t) vq_htog32(vq, uep->id); if (len != NULL) - *len = uep->len; + *len = vq_htog32(vq, uep->len); vq_ring_free_chain(vq, desc_idx); @@ -641,13 +644,13 @@ virtqueue_dump(struct virtqueue *vq) printf("VQ: %s - size=%d; free=%d; used=%d; queued=%d; " "desc_head_idx=%d; avail.idx=%d; used_cons_idx=%d; " "used.idx=%d; used_event_idx=%d; avail.flags=0x%x; used.flags=0x%x\n", - vq->vq_name, vq->vq_nentries, vq->vq_free_cnt, - virtqueue_nused(vq), vq->vq_queued_cnt, vq->vq_desc_head_idx, - vq->vq_ring.avail->idx, vq->vq_used_cons_idx, - vq->vq_ring.used->idx, - vring_used_event(&vq->vq_ring), - vq->vq_ring.avail->flags, - vq->vq_ring.used->flags); + vq->vq_name, vq->vq_nentries, vq->vq_free_cnt, virtqueue_nused(vq), + vq->vq_queued_cnt, vq->vq_desc_head_idx, + vq_htog16(vq, vq->vq_ring.avail->idx), vq->vq_used_cons_idx, + vq_htog16(vq, vq->vq_ring.used->idx), + vq_htog16(vq, vring_used_event(&vq->vq_ring)), + vq_htog16(vq, vq->vq_ring.avail->flags), + vq_htog16(vq, vq->vq_ring.used->flags)); } static void @@ -664,14 +667,14 @@ vq_ring_init(struct virtqueue *vq) vring_init(vr, size, ring_mem, vq->vq_alignment); for (i = 0; i < size - 1; i++) - vr->desc[i].next = i + 1; - vr->desc[i].next = VQ_RING_DESC_CHAIN_END; + vr->desc[i].next = vq_gtoh16(vq, i + 1); + vr->desc[i].next = vq_gtoh16(vq, VQ_RING_DESC_CHAIN_END); } static void vq_ring_update_avail(struct virtqueue *vq, uint16_t desc_idx) { - uint16_t avail_idx; + uint16_t avail_idx, avail_ring_idx; /* * Place the head of the descriptor chain into the next slot and make @@ -680,11 +683,12 @@ vq_ring_update_avail(struct virtqueue *vq, uint16_t desc_idx) * currently running on another CPU, we can keep it processing the new * descriptor. */ - avail_idx = vq->vq_ring.avail->idx & (vq->vq_nentries - 1); - vq->vq_ring.avail->ring[avail_idx] = desc_idx; + avail_idx = vq_htog16(vq, vq->vq_ring.avail->idx); + avail_ring_idx = avail_idx & (vq->vq_nentries - 1); + vq->vq_ring.avail->ring[avail_ring_idx] = vq_gtoh16(vq, desc_idx); wmb(); - vq->vq_ring.avail->idx++; + vq->vq_ring.avail->idx = vq_gtoh16(vq, avail_idx + 1); /* Keep pending count until virtqueue_notify(). */ vq->vq_queued_cnt++; @@ -703,19 +707,19 @@ vq_ring_enqueue_segments(struct virtqueue *vq, struct vring_desc *desc, for (i = 0, idx = head_idx, seg = sg->sg_segs; i < needed; - i++, idx = dp->next, seg++) { + i++, idx = vq_htog16(vq, dp->next), seg++) { VQASSERT(vq, idx != VQ_RING_DESC_CHAIN_END, "premature end of free desc chain"); dp = &desc[idx]; - dp->addr = seg->ss_paddr; - dp->len = seg->ss_len; + dp->addr = vq_gtoh64(vq, seg->ss_paddr); + dp->len = vq_gtoh32(vq, seg->ss_len); dp->flags = 0; if (i < needed - 1) - dp->flags |= VRING_DESC_F_NEXT; + dp->flags |= vq_gtoh16(vq, VRING_DESC_F_NEXT); if (i >= readable) - dp->flags |= VRING_DESC_F_WRITE; + dp->flags |= vq_gtoh16(vq, VRING_DESC_F_WRITE); } return (idx); @@ -760,14 +764,14 @@ vq_ring_enqueue_indirect(struct virtqueue *vq, void *cookie, dxp->cookie = cookie; dxp->ndescs = 1; - dp->addr = dxp->indirect_paddr; - dp->len = needed * sizeof(struct vring_desc); - dp->flags = VRING_DESC_F_INDIRECT; + dp->addr = vq_gtoh64(vq, dxp->indirect_paddr); + dp->len = vq_gtoh32(vq, needed * sizeof(struct vring_desc)); + dp->flags = vq_gtoh16(vq, VRING_DESC_F_INDIRECT); vq_ring_enqueue_segments(vq, dxp->indirect, 0, sg, readable, writable); - vq->vq_desc_head_idx = dp->next; + vq->vq_desc_head_idx = vq_htog16(vq, dp->next); vq->vq_free_cnt--; if (vq->vq_free_cnt == 0) VQ_RING_ASSERT_CHAIN_TERM(vq); @@ -785,10 +789,13 @@ vq_ring_enable_interrupt(struct virtqueue *vq, uint16_t ndesc) * Enable interrupts, making sure we get the latest index of * what's already been consumed. */ - if (vq->vq_flags & VIRTQUEUE_FLAG_EVENT_IDX) - vring_used_event(&vq->vq_ring) = vq->vq_used_cons_idx + ndesc; - else - vq->vq_ring.avail->flags &= ~VRING_AVAIL_F_NO_INTERRUPT; + if (vq->vq_flags & VIRTQUEUE_FLAG_EVENT_IDX) { + vring_used_event(&vq->vq_ring) = + vq_gtoh16(vq, vq->vq_used_cons_idx + ndesc); + } else { + vq->vq_ring.avail->flags &= + vq_gtoh16(vq, ~VRING_AVAIL_F_NO_INTERRUPT); + } mb(); @@ -806,17 +813,18 @@ vq_ring_enable_interrupt(struct virtqueue *vq, uint16_t ndesc) static int vq_ring_must_notify_host(struct virtqueue *vq) { - uint16_t new_idx, prev_idx, event_idx; + uint16_t new_idx, prev_idx, event_idx, flags; if (vq->vq_flags & VIRTQUEUE_FLAG_EVENT_IDX) { - new_idx = vq->vq_ring.avail->idx; + new_idx = vq_htog16(vq, vq->vq_ring.avail->idx); prev_idx = new_idx - vq->vq_queued_cnt; - event_idx = vring_avail_event(&vq->vq_ring); + event_idx = vq_htog16(vq, vring_avail_event(&vq->vq_ring)); return (vring_need_event(event_idx, new_idx, prev_idx) != 0); } - return ((vq->vq_ring.used->flags & VRING_USED_F_NO_NOTIFY) == 0); + flags = vq->vq_ring.used->flags; + return ((flags & vq_gtoh16(vq, VRING_USED_F_NO_NOTIFY)) == 0); } static void @@ -843,10 +851,11 @@ vq_ring_free_chain(struct virtqueue *vq, uint16_t desc_idx) vq->vq_free_cnt += dxp->ndescs; dxp->ndescs--; - if ((dp->flags & VRING_DESC_F_INDIRECT) == 0) { - while (dp->flags & VRING_DESC_F_NEXT) { - VQ_RING_ASSERT_VALID_IDX(vq, dp->next); - dp = &vq->vq_ring.desc[dp->next]; + if ((dp->flags & vq_gtoh16(vq, VRING_DESC_F_INDIRECT)) == 0) { + while (dp->flags & vq_gtoh16(vq, VRING_DESC_F_NEXT)) { + uint16_t next_idx = vq_htog16(vq, dp->next); + VQ_RING_ASSERT_VALID_IDX(vq, next_idx); + dp = &vq->vq_ring.desc[next_idx]; dxp->ndescs--; } } @@ -859,6 +868,6 @@ vq_ring_free_chain(struct virtqueue *vq, uint16_t desc_idx) * newly freed chain. If the virtqueue was completely used, then * head would be VQ_RING_DESC_CHAIN_END (ASSERTed above). */ - dp->next = vq->vq_desc_head_idx; + dp->next = vq_gtoh16(vq, vq->vq_desc_head_idx); vq->vq_desc_head_idx = desc_idx; } diff --git a/sys/dev/virtio/virtqueue.h b/sys/dev/virtio/virtqueue.h index 6ac5899cf0c3..4bde4e32edc6 100644 --- a/sys/dev/virtio/virtqueue.h +++ b/sys/dev/virtio/virtqueue.h @@ -67,8 +67,6 @@ struct vq_alloc_info { (_i)->vqai_vq = (_vqp); \ } while (0) -uint64_t virtqueue_filter_features(uint64_t features); - int virtqueue_alloc(device_t dev, uint16_t queue, uint16_t size, bus_size_t notify_offset, int align, vm_paddr_t highaddr, struct vq_alloc_info *info, struct virtqueue **vqp); From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:12 2021 Return-Path: Delivered-To: dev-commits-src-main@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 56D854E4DDE; Tue, 19 Jan 2021 05:08:12 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9h4GdNz4XDX; Tue, 19 Jan 2021 05:08:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D02D20B3A; Tue, 19 Jan 2021 05:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J587WL085684; Tue, 19 Jan 2021 05:08:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J587n1085683; Tue, 19 Jan 2021 05:08:07 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:07 GMT Message-Id: <202101190508.10J587n1085683@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: d7f979bed092 - main - virtio_blk: Add modern (V1) support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7f979bed0924da1dbe4f79cb3b67554aead6e7f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:12 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=d7f979bed0924da1dbe4f79cb3b67554aead6e7f commit d7f979bed0924da1dbe4f79cb3b67554aead6e7f Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 virtio_blk: Add modern (V1) support Rework the header file changes from 2cc8a52 to use our canonical upstream, Linux. geom_disk already checks DISKFLAG_CANDELETE for BIO_DELETE so remove an unnecessary check. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27902 --- sys/dev/virtio/block/virtio_blk.c | 121 +++++++++++++++++++++++--------------- sys/dev/virtio/block/virtio_blk.h | 69 ++++++++++++++++------ 2 files changed, 125 insertions(+), 65 deletions(-) diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c index 22005f52f4bc..091eb029530e 100644 --- a/sys/dev/virtio/block/virtio_blk.c +++ b/sys/dev/virtio/block/virtio_blk.c @@ -80,8 +80,7 @@ struct vtblk_softc { #define VTBLK_FLAG_DETACH 0x0004 #define VTBLK_FLAG_SUSPEND 0x0008 #define VTBLK_FLAG_BARRIER 0x0010 -#define VTBLK_FLAG_WC_CONFIG 0x0020 -#define VTBLK_FLAG_DISCARD 0x0040 +#define VTBLK_FLAG_WCE_CONFIG 0x0020 struct virtqueue *vtblk_vq; struct sglist *vtblk_sglist; @@ -110,10 +109,13 @@ static struct virtio_feature_desc vtblk_feature_desc[] = { { VIRTIO_BLK_F_RO, "ReadOnly" }, { VIRTIO_BLK_F_BLK_SIZE, "BlockSize" }, { VIRTIO_BLK_F_SCSI, "SCSICmds" }, - { VIRTIO_BLK_F_WCE, "WriteCache" }, + { VIRTIO_BLK_F_FLUSH, "FlushCmd" }, { VIRTIO_BLK_F_TOPOLOGY, "Topology" }, { VIRTIO_BLK_F_CONFIG_WCE, "ConfigWCE" }, + { VIRTIO_BLK_F_MQ, "Multiqueue" }, { VIRTIO_BLK_F_DISCARD, "Discard" }, + { VIRTIO_BLK_F_WRITE_ZEROES, "WriteZeros" }, + { 0, NULL } }; @@ -194,26 +196,35 @@ static int vtblk_write_cache_sysctl(SYSCTL_HANDLER_ARGS); static void vtblk_setup_sysctl(struct vtblk_softc *); static int vtblk_tunable_int(struct vtblk_softc *, const char *, int); +#define vtblk_modern(_sc) (((_sc)->vtblk_features & VIRTIO_F_VERSION_1) != 0) +#define vtblk_htog16(_sc, _val) virtio_htog16(vtblk_modern(_sc), _val) +#define vtblk_htog32(_sc, _val) virtio_htog32(vtblk_modern(_sc), _val) +#define vtblk_htog64(_sc, _val) virtio_htog64(vtblk_modern(_sc), _val) +#define vtblk_gtoh16(_sc, _val) virtio_gtoh16(vtblk_modern(_sc), _val) +#define vtblk_gtoh32(_sc, _val) virtio_gtoh32(vtblk_modern(_sc), _val) +#define vtblk_gtoh64(_sc, _val) virtio_gtoh64(vtblk_modern(_sc), _val) + /* Tunables. */ static int vtblk_no_ident = 0; TUNABLE_INT("hw.vtblk.no_ident", &vtblk_no_ident); static int vtblk_writecache_mode = -1; TUNABLE_INT("hw.vtblk.writecache_mode", &vtblk_writecache_mode); -/* Features desired/implemented by this driver. */ -#define VTBLK_FEATURES \ - (VIRTIO_BLK_F_BARRIER | \ - VIRTIO_BLK_F_SIZE_MAX | \ +#define VTBLK_COMMON_FEATURES \ + (VIRTIO_BLK_F_SIZE_MAX | \ VIRTIO_BLK_F_SEG_MAX | \ VIRTIO_BLK_F_GEOMETRY | \ VIRTIO_BLK_F_RO | \ VIRTIO_BLK_F_BLK_SIZE | \ - VIRTIO_BLK_F_WCE | \ + VIRTIO_BLK_F_FLUSH | \ VIRTIO_BLK_F_TOPOLOGY | \ VIRTIO_BLK_F_CONFIG_WCE | \ VIRTIO_BLK_F_DISCARD | \ VIRTIO_RING_F_INDIRECT_DESC) +#define VTBLK_MODERN_FEATURES (VTBLK_COMMON_FEATURES) +#define VTBLK_LEGACY_FEATURES (VIRTIO_BLK_F_BARRIER | VTBLK_COMMON_FEATURES) + #define VTBLK_MTX(_sc) &(_sc)->vtblk_mtx #define VTBLK_LOCK_INIT(_sc, _name) \ mtx_init(VTBLK_MTX((_sc)), (_name), \ @@ -227,6 +238,7 @@ TUNABLE_INT("hw.vtblk.writecache_mode", &vtblk_writecache_mode); #define VTBLK_DISK_NAME "vtbd" #define VTBLK_QUIESCE_TIMEOUT (30 * hz) +#define VTBLK_BSIZE 512 /* * Each block request uses at least two segments - one for the header @@ -566,13 +578,6 @@ vtblk_strategy(struct bio *bp) return; } - if ((bp->bio_cmd == BIO_DELETE) && - !(sc->vtblk_flags & VTBLK_FLAG_DISCARD)) { - VTBLK_UNLOCK(sc); - vtblk_bio_done(sc, bp, EOPNOTSUPP); - return; - } - bioq_insert_tail(&sc->vtblk_bioq, bp); vtblk_startio(sc); @@ -586,9 +591,11 @@ vtblk_negotiate_features(struct vtblk_softc *sc) uint64_t features; dev = sc->vtblk_dev; - features = VTBLK_FEATURES; + features = virtio_bus_is_modern(dev) ? VTBLK_MODERN_FEATURES : + VTBLK_LEGACY_FEATURES; sc->vtblk_features = virtio_negotiate_features(dev, features); + virtio_finalize_features(dev); } static void @@ -604,12 +611,12 @@ vtblk_setup_features(struct vtblk_softc *sc) sc->vtblk_flags |= VTBLK_FLAG_INDIRECT; if (virtio_with_feature(dev, VIRTIO_BLK_F_RO)) sc->vtblk_flags |= VTBLK_FLAG_READONLY; + if (virtio_with_feature(dev, VIRTIO_BLK_F_CONFIG_WCE)) + sc->vtblk_flags |= VTBLK_FLAG_WCE_CONFIG; + + /* Legacy. */ if (virtio_with_feature(dev, VIRTIO_BLK_F_BARRIER)) sc->vtblk_flags |= VTBLK_FLAG_BARRIER; - if (virtio_with_feature(dev, VIRTIO_BLK_F_CONFIG_WCE)) - sc->vtblk_flags |= VTBLK_FLAG_WC_CONFIG; - if (virtio_with_feature(dev, VIRTIO_BLK_F_DISCARD)) - sc->vtblk_flags |= VTBLK_FLAG_DISCARD; } static int @@ -688,13 +695,15 @@ vtblk_alloc_disk(struct vtblk_softc *sc, struct virtio_blk_config *blkcfg) dp->d_name = VTBLK_DISK_NAME; dp->d_unit = device_get_unit(dev); dp->d_drv1 = sc; - dp->d_flags = DISKFLAG_CANFLUSHCACHE | DISKFLAG_UNMAPPED_BIO | - DISKFLAG_DIRECT_COMPLETION; + dp->d_flags = DISKFLAG_UNMAPPED_BIO | DISKFLAG_DIRECT_COMPLETION; dp->d_hba_vendor = virtio_get_vendor(dev); dp->d_hba_device = virtio_get_device(dev); dp->d_hba_subvendor = virtio_get_subvendor(dev); dp->d_hba_subdevice = virtio_get_subdevice(dev); + if (virtio_with_feature(dev, VIRTIO_BLK_F_FLUSH)) + dp->d_flags |= DISKFLAG_CANFLUSHCACHE; + if ((sc->vtblk_flags & VTBLK_FLAG_READONLY) == 0) dp->d_dump = vtblk_dump; @@ -885,30 +894,31 @@ vtblk_request_bio(struct vtblk_softc *sc) bp = bioq_takefirst(bioq); req->vbr_bp = bp; req->vbr_ack = -1; - req->vbr_hdr.ioprio = 1; + req->vbr_hdr.ioprio = vtblk_gtoh32(sc, 1); switch (bp->bio_cmd) { case BIO_FLUSH: - req->vbr_hdr.type = VIRTIO_BLK_T_FLUSH; + req->vbr_hdr.type = vtblk_gtoh32(sc, VIRTIO_BLK_T_FLUSH); + req->vbr_hdr.sector = 0; break; case BIO_READ: - req->vbr_hdr.type = VIRTIO_BLK_T_IN; - req->vbr_hdr.sector = bp->bio_offset / VTBLK_BSIZE; + req->vbr_hdr.type = vtblk_gtoh32(sc, VIRTIO_BLK_T_IN); + req->vbr_hdr.sector = vtblk_gtoh64(sc, bp->bio_offset / VTBLK_BSIZE); break; case BIO_WRITE: - req->vbr_hdr.type = VIRTIO_BLK_T_OUT; - req->vbr_hdr.sector = bp->bio_offset / VTBLK_BSIZE; + req->vbr_hdr.type = vtblk_gtoh32(sc, VIRTIO_BLK_T_OUT); + req->vbr_hdr.sector = vtblk_gtoh64(sc, bp->bio_offset / VTBLK_BSIZE); break; case BIO_DELETE: - req->vbr_hdr.type = VIRTIO_BLK_T_DISCARD; - req->vbr_hdr.sector = bp->bio_offset / VTBLK_BSIZE; + req->vbr_hdr.type = vtblk_gtoh32(sc, VIRTIO_BLK_T_DISCARD); + req->vbr_hdr.sector = vtblk_gtoh64(sc, bp->bio_offset / VTBLK_BSIZE); break; default: panic("%s: bio with unhandled cmd: %d", __func__, bp->bio_cmd); } if (bp->bio_flags & BIO_ORDERED) - req->vbr_hdr.type |= VIRTIO_BLK_T_BARRIER; + req->vbr_hdr.type |= vtblk_gtoh32(sc, VIRTIO_BLK_T_BARRIER); return (req); } @@ -939,7 +949,8 @@ vtblk_request_execute(struct vtblk_softc *sc, struct vtblk_request *req) if (!virtqueue_empty(vq)) return (EBUSY); ordered = 1; - req->vbr_hdr.type &= ~VIRTIO_BLK_T_BARRIER; + req->vbr_hdr.type &= vtblk_gtoh32(sc, + ~VIRTIO_BLK_T_BARRIER); } } @@ -962,9 +973,10 @@ vtblk_request_execute(struct vtblk_softc *sc, struct vtblk_request *req) discard = malloc(sizeof(*discard), M_DEVBUF, M_NOWAIT | M_ZERO); if (discard == NULL) return (ENOMEM); - discard->sector = bp->bio_offset / VTBLK_BSIZE; - discard->num_sectors = bp->bio_bcount / VTBLK_BSIZE; + bp->bio_driver1 = discard; + discard->sector = vtblk_gtoh64(sc, bp->bio_offset / VTBLK_BSIZE); + discard->num_sectors = vtblk_gtoh32(sc, bp->bio_bcount / VTBLK_BSIZE); error = sglist_append(sg, discard, sizeof(*discard)); if (error || sg->sg_nseg == sg->sg_maxseg) { panic("%s: bio %p data buffer too big %d", @@ -1057,15 +1069,16 @@ vtblk_drain_vq(struct vtblk_softc *sc) static void vtblk_drain(struct vtblk_softc *sc) { - struct bio_queue queue; struct bio_queue_head *bioq; struct vtblk_request *req; struct bio *bp; bioq = &sc->vtblk_bioq; - TAILQ_INIT(&queue); if (sc->vtblk_vq != NULL) { + struct bio_queue queue; + + TAILQ_INIT(&queue); vtblk_queue_completed(sc, &queue); vtblk_done_completed(sc, &queue); @@ -1161,9 +1174,21 @@ vtblk_read_config(struct vtblk_softc *sc, struct virtio_blk_config *blkcfg) /* Read the configuration if the feature was negotiated. */ VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_SIZE_MAX, size_max, blkcfg); VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_SEG_MAX, seg_max, blkcfg); - VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_GEOMETRY, geometry, blkcfg); + VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_GEOMETRY, + geometry.cylinders, blkcfg); + VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_GEOMETRY, + geometry.heads, blkcfg); + VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_GEOMETRY, + geometry.sectors, blkcfg); VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_BLK_SIZE, blk_size, blkcfg); - VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_TOPOLOGY, topology, blkcfg); + VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_TOPOLOGY, + topology.physical_block_exp, blkcfg); + VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_TOPOLOGY, + topology.alignment_offset, blkcfg); + VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_TOPOLOGY, + topology.min_io_size, blkcfg); + VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_TOPOLOGY, + topology.opt_io_size, blkcfg); VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_CONFIG_WCE, wce, blkcfg); VTBLK_GET_CONFIG(dev, VIRTIO_BLK_F_DISCARD, max_discard_sectors, blkcfg); @@ -1193,8 +1218,8 @@ vtblk_ident(struct vtblk_softc *sc) return; req->vbr_ack = -1; - req->vbr_hdr.type = VIRTIO_BLK_T_GET_ID; - req->vbr_hdr.ioprio = 1; + req->vbr_hdr.type = vtblk_gtoh32(sc, VIRTIO_BLK_T_GET_ID); + req->vbr_hdr.ioprio = vtblk_gtoh32(sc, 1); req->vbr_hdr.sector = 0; req->vbr_bp = &buf; @@ -1325,9 +1350,9 @@ vtblk_dump_write(struct vtblk_softc *sc, void *virtual, off_t offset, req = &sc->vtblk_dump_request; req->vbr_ack = -1; - req->vbr_hdr.type = VIRTIO_BLK_T_OUT; - req->vbr_hdr.ioprio = 1; - req->vbr_hdr.sector = offset / VTBLK_BSIZE; + req->vbr_hdr.type = vtblk_gtoh32(sc, VIRTIO_BLK_T_OUT); + req->vbr_hdr.ioprio = vtblk_gtoh32(sc, 1); + req->vbr_hdr.sector = vtblk_gtoh64(sc, offset / VTBLK_BSIZE); req->vbr_bp = &buf; g_reset_bio(&buf); @@ -1347,8 +1372,8 @@ vtblk_dump_flush(struct vtblk_softc *sc) req = &sc->vtblk_dump_request; req->vbr_ack = -1; - req->vbr_hdr.type = VIRTIO_BLK_T_FLUSH; - req->vbr_hdr.ioprio = 1; + req->vbr_hdr.type = vtblk_gtoh32(sc, VIRTIO_BLK_T_FLUSH); + req->vbr_hdr.ioprio = vtblk_gtoh32(sc, 1); req->vbr_hdr.sector = 0; req->vbr_bp = &buf; @@ -1385,7 +1410,7 @@ vtblk_write_cache_enabled(struct vtblk_softc *sc, { int wc; - if (sc->vtblk_flags & VTBLK_FLAG_WC_CONFIG) { + if (sc->vtblk_flags & VTBLK_FLAG_WCE_CONFIG) { wc = vtblk_tunable_int(sc, "writecache_mode", vtblk_writecache_mode); if (wc >= 0 && wc < VTBLK_CACHE_MAX) @@ -1393,7 +1418,7 @@ vtblk_write_cache_enabled(struct vtblk_softc *sc, else wc = blkcfg->wce; } else - wc = virtio_with_feature(sc->vtblk_dev, VIRTIO_BLK_F_WCE); + wc = virtio_with_feature(sc->vtblk_dev, VIRTIO_BLK_F_FLUSH); return (wc); } @@ -1410,7 +1435,7 @@ vtblk_write_cache_sysctl(SYSCTL_HANDLER_ARGS) error = sysctl_handle_int(oidp, &wc, 0, req); if (error || req->newptr == NULL) return (error); - if ((sc->vtblk_flags & VTBLK_FLAG_WC_CONFIG) == 0) + if ((sc->vtblk_flags & VTBLK_FLAG_WCE_CONFIG) == 0) return (EPERM); if (wc < 0 || wc >= VTBLK_CACHE_MAX) return (EINVAL); diff --git a/sys/dev/virtio/block/virtio_blk.h b/sys/dev/virtio/block/virtio_blk.h index 519886bad892..4c4a5caf51e8 100644 --- a/sys/dev/virtio/block/virtio_blk.h +++ b/sys/dev/virtio/block/virtio_blk.h @@ -33,26 +33,27 @@ #ifndef _VIRTIO_BLK_H #define _VIRTIO_BLK_H -#define VTBLK_BSIZE 512 - /* Feature bits */ - -#define VIRTIO_BLK_F_BARRIER 0x0001 /* Does host support barriers? */ #define VIRTIO_BLK_F_SIZE_MAX 0x0002 /* Indicates maximum segment size */ #define VIRTIO_BLK_F_SEG_MAX 0x0004 /* Indicates maximum # of segments */ #define VIRTIO_BLK_F_GEOMETRY 0x0010 /* Legacy geometry available */ #define VIRTIO_BLK_F_RO 0x0020 /* Disk is read-only */ #define VIRTIO_BLK_F_BLK_SIZE 0x0040 /* Block size of disk is available*/ -#define VIRTIO_BLK_F_SCSI 0x0080 /* Supports scsi command passthru */ #define VIRTIO_BLK_F_FLUSH 0x0200 /* Flush command supported */ -#define VIRTIO_BLK_F_WCE 0x0200 /* Legacy alias for FLUSH */ #define VIRTIO_BLK_F_TOPOLOGY 0x0400 /* Topology information is available */ #define VIRTIO_BLK_F_CONFIG_WCE 0x0800 /* Writeback mode available in config */ #define VIRTIO_BLK_F_MQ 0x1000 /* Support more than one vq */ -#define VIRTIO_BLK_F_DISCARD 0x2000 /* Trim blocks */ -#define VIRTIO_BLK_F_WRITE_ZEROES 0x4000 /* Write zeros */ +#define VIRTIO_BLK_F_DISCARD 0x2000 /* DISCARD is supported */ +#define VIRTIO_BLK_F_WRITE_ZEROES 0x4000 /* WRITE ZEROES is supported */ + +/* Legacy feature bits */ +#define VIRTIO_BLK_F_BARRIER 0x0001 /* Does host support barriers? */ +#define VIRTIO_BLK_F_SCSI 0x0080 /* Supports scsi command passthru */ + +/* Old (deprecated) name for VIRTIO_BLK_F_FLUSH. */ +#define VIRTIO_BLK_F_WCE VIRTIO_BLK_F_FLUSH -#define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ +#define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ struct virtio_blk_config { /* The capacity (in 512-byte sectors). */ @@ -87,14 +88,43 @@ struct virtio_blk_config { /* Writeback mode (if VIRTIO_BLK_F_CONFIG_WCE) */ uint8_t wce; uint8_t unused; + /* Number of vqs, only available when VIRTIO_BLK_F_MQ is set */ uint16_t num_queues; + + /* + * The next 3 entries are guarded by VIRTIO_BLK_F_DISCARD. + * + * The maximum discard sectors (in 512-byte sectors) for + * one segment. + */ uint32_t max_discard_sectors; + /* + * The maximum number of discard segments in a + * discard command. + */ uint32_t max_discard_seg; + /* Discard commands must be aligned to this number of sectors. */ uint32_t discard_sector_alignment; + + /* + * The next 3 entries are guarded by VIRTIO_BLK_F_WRITE_ZEROES + * + * The maximum number of write zeroes sectors (in 512-byte sectors) in + * one segment. + */ uint32_t max_write_zeroes_sectors; + /* + * The maximum number of segments in a write zeroes + * command. + */ uint32_t max_write_zeroes_seg; + /* + * Set if a VIRTIO_BLK_T_WRITE_ZEROES request may result in the + * deallocation of one or more of the sectors. + */ uint8_t write_zeroes_may_unmap; + uint8_t unused1[3]; } __packed; @@ -133,13 +163,14 @@ struct virtio_blk_config { /* Barrier before this op. */ #define VIRTIO_BLK_T_BARRIER 0x80000000 -/* ID string length */ -#define VIRTIO_BLK_ID_BYTES 20 - /* Unmap this range (only valid for write zeroes command) */ #define VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP 0x00000001 -/* This is the first element of the read scatter-gather list. */ +/* + * This comes first in the read scatter-gather list. + * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, + * this is the first element of the read scatter-gather list. + */ struct virtio_blk_outhdr { /* VIRTIO_BLK_T* */ uint32_t type; @@ -149,13 +180,17 @@ struct virtio_blk_outhdr { uint64_t sector; }; +/* Unmap this range (only valid for write zeroes command) */ +#define VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP 0x00000001 + +/* Discard/write zeroes range for each request. */ struct virtio_blk_discard_write_zeroes { + /* Discard/write zeroes start sector */ uint64_t sector; + /* Number of discard/write zeroes sectors */ uint32_t num_sectors; - struct { - uint32_t unmap:1; - uint32_t reserved:31; - } flags; + /* Flags for this range */ + uint32_t flags; }; struct virtio_scsi_inhdr { From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:11 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1399B4E5318; Tue, 19 Jan 2021 05:08:11 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9h4Lsfz4XBD; Tue, 19 Jan 2021 05:08:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 703CE20D8D; Tue, 19 Jan 2021 05:08:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J585Hq085640; Tue, 19 Jan 2021 05:08:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J585HU085639; Tue, 19 Jan 2021 05:08:05 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:05 GMT Message-Id: <202101190508.10J585HU085639@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: f7f9c266e439 - main - virtio_balloon: Add modern (V1) support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7f9c266e439ee494b5f1bca8158ee99d7f56819 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:12 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=f7f9c266e439ee494b5f1bca8158ee99d7f56819 commit f7f9c266e439ee494b5f1bca8158ee99d7f56819 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:23 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:23 +0000 virtio_balloon: Add modern (V1) support Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27900 --- sys/dev/virtio/balloon/virtio_balloon.c | 29 ++++++++++++++++++++++------- sys/dev/virtio/balloon/virtio_balloon.h | 28 +++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/sys/dev/virtio/balloon/virtio_balloon.c b/sys/dev/virtio/balloon/virtio_balloon.c index 2292ca384ba9..0973528887c5 100644 --- a/sys/dev/virtio/balloon/virtio_balloon.c +++ b/sys/dev/virtio/balloon/virtio_balloon.c @@ -80,6 +80,8 @@ struct vtballoon_softc { static struct virtio_feature_desc vtballoon_feature_desc[] = { { VIRTIO_BALLOON_F_MUST_TELL_HOST, "MustTellHost" }, { VIRTIO_BALLOON_F_STATS_VQ, "StatsVq" }, + { VIRTIO_BALLOON_F_DEFLATE_ON_OOM, "DeflateOnOOM" }, + { 0, NULL } }; @@ -110,8 +112,11 @@ static int vtballoon_sleep(struct vtballoon_softc *); static void vtballoon_thread(void *); static void vtballoon_add_sysctl(struct vtballoon_softc *); +#define vtballoon_modern(_sc) \ + (((_sc)->vtballoon_features & VIRTIO_F_VERSION_1) != 0) + /* Features desired/implemented by this driver. */ -#define VTBALLOON_FEATURES 0 +#define VTBALLOON_FEATURES VIRTIO_BALLOON_F_MUST_TELL_HOST /* Timeout between retries when the balloon needs inflating. */ #define VTBALLOON_LOWMEM_TIMEOUT hz @@ -278,8 +283,10 @@ vtballoon_negotiate_features(struct vtballoon_softc *sc) uint64_t features; dev = sc->vtballoon_dev; - features = virtio_negotiate_features(dev, VTBALLOON_FEATURES); - sc->vtballoon_features = features; + features = VTBALLOON_FEATURES; + + sc->vtballoon_features = virtio_negotiate_features(dev, features); + virtio_finalize_features(dev); } static int @@ -440,7 +447,8 @@ vtballoon_alloc_page(struct vtballoon_softc *sc) { vm_page_t m; - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); + m = vm_page_alloc(NULL, 0, + VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP); if (m != NULL) sc->vtballoon_current_npages++; @@ -463,16 +471,23 @@ vtballoon_desired_size(struct vtballoon_softc *sc) desired = virtio_read_dev_config_4(sc->vtballoon_dev, offsetof(struct virtio_balloon_config, num_pages)); - return (le32toh(desired)); + if (vtballoon_modern(sc)) + return (desired); + else + return (le32toh(desired)); } static void vtballoon_update_size(struct vtballoon_softc *sc) { + uint32_t npages; + + npages = sc->vtballoon_current_npages; + if (!vtballoon_modern(sc)) + npages = htole32(npages); virtio_write_dev_config_4(sc->vtballoon_dev, - offsetof(struct virtio_balloon_config, actual), - htole32(sc->vtballoon_current_npages)); + offsetof(struct virtio_balloon_config, actual), npages); } static int diff --git a/sys/dev/virtio/balloon/virtio_balloon.h b/sys/dev/virtio/balloon/virtio_balloon.h index b871dfb01c56..07802d84ce52 100644 --- a/sys/dev/virtio/balloon/virtio_balloon.h +++ b/sys/dev/virtio/balloon/virtio_balloon.h @@ -36,6 +36,7 @@ /* Feature bits. */ #define VIRTIO_BALLOON_F_MUST_TELL_HOST 0x1 /* Tell before reclaiming pages */ #define VIRTIO_BALLOON_F_STATS_VQ 0x2 /* Memory stats virtqueue */ +#define VIRTIO_BALLOON_F_DEFLATE_ON_OOM 0x4 /* Deflate balloon on OOM */ /* Size of a PFN in the balloon interface. */ #define VIRTIO_BALLOON_PFN_SHIFT 12 @@ -54,8 +55,33 @@ struct virtio_balloon_config { #define VIRTIO_BALLOON_S_MINFLT 3 /* Number of minor faults */ #define VIRTIO_BALLOON_S_MEMFREE 4 /* Total amount of free memory */ #define VIRTIO_BALLOON_S_MEMTOT 5 /* Total amount of memory */ -#define VIRTIO_BALLOON_S_NR 6 +#define VIRTIO_BALLOON_S_AVAIL 6 /* Available memory as in /proc */ +#define VIRTIO_BALLOON_S_CACHES 7 /* Disk caches */ +#define VIRTIO_BALLOON_S_NR 8 +/* + * Memory statistics structure. + * Driver fills an array of these structures and passes to device. + * + * NOTE: fields are laid out in a way that would make compiler add padding + * between and after fields, so we have to use compiler-specific attributes to + * pack it, to disable this padding. This also often causes compiler to + * generate suboptimal code. + * + * We maintain this statistics structure format for backwards compatibility, + * but don't follow this example. + * + * If implementing a similar structure, do something like the below instead: + * struct virtio_balloon_stat { + * __virtio16 tag; + * __u8 reserved[6]; + * __virtio64 val; + * }; + * + * In other words, add explicit reserved fields to align field and + * structure boundaries at field size, avoiding compiler padding + * without the packed attribute. + */ struct virtio_balloon_stat { uint16_t tag; uint64_t val; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:10 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2410E4E52A3; Tue, 19 Jan 2021 05:08:10 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9h0wdYz4XJn; Tue, 19 Jan 2021 05:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8777920D8E; Tue, 19 Jan 2021 05:08:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J5860s085662; Tue, 19 Jan 2021 05:08:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J586mX085661; Tue, 19 Jan 2021 05:08:06 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:06 GMT Message-Id: <202101190508.10J586mX085661@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: edf7c8ddceca - main - virtio_console: Add modern (V1) support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: edf7c8ddcecae93ced005144b6eeac14e08ade8e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:10 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=edf7c8ddcecae93ced005144b6eeac14e08ade8e commit edf7c8ddcecae93ced005144b6eeac14e08ade8e Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 virtio_console: Add modern (V1) support Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27901 --- sys/dev/virtio/console/virtio_console.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/sys/dev/virtio/console/virtio_console.c b/sys/dev/virtio/console/virtio_console.c index f3c5db17e764..0bd7c982e3f5 100644 --- a/sys/dev/virtio/console/virtio_console.c +++ b/sys/dev/virtio/console/virtio_console.c @@ -226,6 +226,14 @@ static void vtcon_get_console_size(struct vtcon_softc *, uint16_t *, static void vtcon_enable_interrupts(struct vtcon_softc *); static void vtcon_disable_interrupts(struct vtcon_softc *); +#define vtcon_modern(_sc) (((_sc)->vtcon_features & VIRTIO_F_VERSION_1) != 0) +#define vtcon_htog16(_sc, _val) virtio_htog16(vtcon_modern(_sc), _val) +#define vtcon_htog32(_sc, _val) virtio_htog32(vtcon_modern(_sc), _val) +#define vtcon_htog64(_sc, _val) virtio_htog64(vtcon_modern(_sc), _val) +#define vtcon_gtoh16(_sc, _val) virtio_gtoh16(vtcon_modern(_sc), _val) +#define vtcon_gtoh32(_sc, _val) virtio_gtoh32(vtcon_modern(_sc), _val) +#define vtcon_gtoh64(_sc, _val) virtio_gtoh64(vtcon_modern(_sc), _val) + static int vtcon_pending_free; static struct ttydevsw vtcon_tty_class = { @@ -430,6 +438,7 @@ vtcon_negotiate_features(struct vtcon_softc *sc) features = VTCON_FEATURES; sc->vtcon_features = virtio_negotiate_features(dev, features); + virtio_finalize_features(dev); } static void @@ -846,17 +855,20 @@ vtcon_ctrl_process_event(struct vtcon_softc *sc, struct virtio_console_control *control, void *data, size_t data_len) { device_t dev; - int id; + uint32_t id; + uint16_t event; dev = sc->vtcon_dev; - id = control->id; + id = vtcon_htog32(sc, control->id); + event = vtcon_htog16(sc, control->event); - if (id < 0 || id >= sc->vtcon_max_ports) { - device_printf(dev, "%s: invalid port ID %d\n", __func__, id); + if (id >= sc->vtcon_max_ports) { + device_printf(dev, "%s: event %d invalid port ID %d\n", + __func__, event, id); return; } - switch (control->event) { + switch (event) { case VIRTIO_CONSOLE_PORT_ADD: vtcon_ctrl_port_add_event(sc, id); break; @@ -984,9 +996,9 @@ vtcon_ctrl_send_control(struct vtcon_softc *sc, uint32_t portid, if ((sc->vtcon_flags & VTCON_FLAG_MULTIPORT) == 0) return; - control.id = portid; - control.event = event; - control.value = value; + control.id = vtcon_gtoh32(sc, portid); + control.event = vtcon_gtoh16(sc, event); + control.value = vtcon_gtoh16(sc, value); vtcon_ctrl_poll(sc, &control); } From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:13 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6B15B4E4DE6; Tue, 19 Jan 2021 05:08:13 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9m4Qczz4XGy; Tue, 19 Jan 2021 05:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C47402066B; Tue, 19 Jan 2021 05:08:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J589Xi085724; Tue, 19 Jan 2021 05:08:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J589XK085723; Tue, 19 Jan 2021 05:08:09 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:09 GMT Message-Id: <202101190508.10J589XK085723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 5e2208117787 - main - if_vtnet: Add initial modern (V1) support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e2208117787f3f0b9dc079e1060edf91eb2b5fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:14 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=5e2208117787f3f0b9dc079e1060edf91eb2b5fc commit 5e2208117787f3f0b9dc079e1060edf91eb2b5fc Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 if_vtnet: Add initial modern (V1) support Very basic support to get packets flowing on modern QEMU but still several conformance issues remain that will be addressed in later commits. First of many passes at cleaning up various accumulated cruft Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27904 --- sys/dev/virtio/network/if_vtnet.c | 614 +++++++++++++++++------------------ sys/dev/virtio/network/if_vtnetvar.h | 56 +++- sys/dev/virtio/network/virtio_net.h | 103 ++++-- 3 files changed, 421 insertions(+), 352 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index e16570f7b4f1..60b87aa16703 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -190,7 +190,7 @@ static void vtnet_exec_ctrl_cmd(struct vtnet_softc *, void *, struct sglist *, int, int); static int vtnet_ctrl_mac_cmd(struct vtnet_softc *, uint8_t *); static int vtnet_ctrl_mq_cmd(struct vtnet_softc *, uint16_t); -static int vtnet_ctrl_rx_cmd(struct vtnet_softc *, int, int); +static int vtnet_ctrl_rx_cmd(struct vtnet_softc *, uint8_t, int); static int vtnet_set_promisc(struct vtnet_softc *, int); static int vtnet_set_allmulti(struct vtnet_softc *, int); static void vtnet_attach_disable_promisc(struct vtnet_softc *); @@ -234,6 +234,13 @@ static int vtnet_tunable_int(struct vtnet_softc *, const char *, int); DEBUGNET_DEFINE(vtnet); +#define vtnet_htog16(_sc, _val) virtio_htog16(vtnet_modern(_sc), _val) +#define vtnet_htog32(_sc, _val) virtio_htog32(vtnet_modern(_sc), _val) +#define vtnet_htog64(_sc, _val) virtio_htog64(vtnet_modern(_sc), _val) +#define vtnet_gtoh16(_sc, _val) virtio_gtoh16(vtnet_modern(_sc), _val) +#define vtnet_gtoh32(_sc, _val) virtio_gtoh32(vtnet_modern(_sc), _val) +#define vtnet_gtoh64(_sc, _val) virtio_gtoh64(vtnet_modern(_sc), _val) + /* Tunables. */ static SYSCTL_NODE(_hw, OID_AUTO, vtnet, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "VNET driver parameters"); @@ -266,27 +273,30 @@ SYSCTL_INT(_hw_vtnet, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, static uma_zone_t vtnet_tx_header_zone; static struct virtio_feature_desc vtnet_feature_desc[] = { - { VIRTIO_NET_F_CSUM, "TxChecksum" }, - { VIRTIO_NET_F_GUEST_CSUM, "RxChecksum" }, - { VIRTIO_NET_F_MAC, "MacAddress" }, - { VIRTIO_NET_F_GSO, "TxAllGSO" }, - { VIRTIO_NET_F_GUEST_TSO4, "RxTSOv4" }, - { VIRTIO_NET_F_GUEST_TSO6, "RxTSOv6" }, - { VIRTIO_NET_F_GUEST_ECN, "RxECN" }, - { VIRTIO_NET_F_GUEST_UFO, "RxUFO" }, - { VIRTIO_NET_F_HOST_TSO4, "TxTSOv4" }, - { VIRTIO_NET_F_HOST_TSO6, "TxTSOv6" }, - { VIRTIO_NET_F_HOST_ECN, "TxTSOECN" }, - { VIRTIO_NET_F_HOST_UFO, "TxUFO" }, - { VIRTIO_NET_F_MRG_RXBUF, "MrgRxBuf" }, - { VIRTIO_NET_F_STATUS, "Status" }, - { VIRTIO_NET_F_CTRL_VQ, "ControlVq" }, - { VIRTIO_NET_F_CTRL_RX, "RxMode" }, - { VIRTIO_NET_F_CTRL_VLAN, "VLanFilter" }, - { VIRTIO_NET_F_CTRL_RX_EXTRA, "RxModeExtra" }, - { VIRTIO_NET_F_GUEST_ANNOUNCE, "GuestAnnounce" }, - { VIRTIO_NET_F_MQ, "Multiqueue" }, - { VIRTIO_NET_F_CTRL_MAC_ADDR, "SetMacAddress" }, + { VIRTIO_NET_F_CSUM, "TxChecksum" }, + { VIRTIO_NET_F_GUEST_CSUM, "RxChecksum" }, + { VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, "CtrlRxOffloads" }, + { VIRTIO_NET_F_MAC, "MAC" }, + { VIRTIO_NET_F_GSO, "TxGSO" }, + { VIRTIO_NET_F_GUEST_TSO4, "RxLROv4" }, + { VIRTIO_NET_F_GUEST_TSO6, "RxLROv6" }, + { VIRTIO_NET_F_GUEST_ECN, "RxLROECN" }, + { VIRTIO_NET_F_GUEST_UFO, "RxUFO" }, + { VIRTIO_NET_F_HOST_TSO4, "TxTSOv4" }, + { VIRTIO_NET_F_HOST_TSO6, "TxTSOv6" }, + { VIRTIO_NET_F_HOST_ECN, "TxTSOECN" }, + { VIRTIO_NET_F_HOST_UFO, "TxUFO" }, + { VIRTIO_NET_F_MRG_RXBUF, "MrgRxBuf" }, + { VIRTIO_NET_F_STATUS, "Status" }, + { VIRTIO_NET_F_CTRL_VQ, "CtrlVq" }, + { VIRTIO_NET_F_CTRL_RX, "CtrlRxMode" }, + { VIRTIO_NET_F_CTRL_VLAN, "CtrlVLANFilter" }, + { VIRTIO_NET_F_CTRL_RX_EXTRA, "CtrlRxModeExtra" }, + { VIRTIO_NET_F_GUEST_ANNOUNCE, "GuestAnnounce" }, + { VIRTIO_NET_F_MQ, "Multiqueue" }, + { VIRTIO_NET_F_CTRL_MAC_ADDR, "CtrlMacAddr" }, + { VIRTIO_NET_F_SPEED_DUPLEX, "SpeedDuplex" }, + { 0, NULL } }; @@ -308,12 +318,12 @@ static device_method_t vtnet_methods[] = { #ifdef DEV_NETMAP #include -#endif /* DEV_NETMAP */ +#endif static driver_t vtnet_driver = { - "vtnet", - vtnet_methods, - sizeof(struct vtnet_softc) + .name = "vtnet", + .methods = vtnet_methods, + .size = sizeof(struct vtnet_softc) }; static devclass_t vtnet_devclass; @@ -325,7 +335,7 @@ MODULE_VERSION(vtnet, 1); MODULE_DEPEND(vtnet, virtio, 1, 1, 1); #ifdef DEV_NETMAP MODULE_DEPEND(vtnet, netmap, 1, 1, 1); -#endif /* DEV_NETMAP */ +#endif VIRTIO_SIMPLE_PNPTABLE(vtnet, VIRTIO_ID_NETWORK, "VirtIO Networking Adapter"); VIRTIO_SIMPLE_PNPINFO(virtio_mmio, vtnet); @@ -390,7 +400,6 @@ vtnet_attach(device_t dev) sc = device_get_softc(dev); sc->vtnet_dev = dev; - /* Register our feature descriptions. */ virtio_set_feature_desc(dev, vtnet_feature_desc); VTNET_CORE_LOCK_INIT(sc); @@ -425,16 +434,14 @@ vtnet_attach(device_t dev) error = virtio_setup_intr(dev, INTR_TYPE_NET); if (error) { - device_printf(dev, "cannot setup virtqueue interrupts\n"); - /* BMV: This will crash if during boot! */ + device_printf(dev, "cannot setup interrupts\n"); ether_ifdetach(sc->vtnet_ifp); goto fail; } #ifdef DEV_NETMAP vtnet_netmap_attach(sc); -#endif /* DEV_NETMAP */ - +#endif vtnet_start_taskqueues(sc); fail: @@ -466,7 +473,7 @@ vtnet_detach(device_t dev) #ifdef DEV_NETMAP netmap_detach(ifp); -#endif /* DEV_NETMAP */ +#endif vtnet_free_taskqueues(sc); @@ -533,7 +540,6 @@ vtnet_resume(device_t dev) static int vtnet_shutdown(device_t dev) { - /* * Suspend already does all of what we need to * do here; we just never expect to be resumed. @@ -570,31 +576,32 @@ static void vtnet_negotiate_features(struct vtnet_softc *sc) { device_t dev; - uint64_t mask, features; + uint64_t features; + int no_csum; dev = sc->vtnet_dev; - mask = 0; + features = virtio_bus_is_modern(dev) ? VTNET_MODERN_FEATURES : + VTNET_LEGACY_FEATURES; /* * TSO and LRO are only available when their corresponding checksum * offload feature is also negotiated. */ - if (vtnet_tunable_int(sc, "csum_disable", vtnet_csum_disable)) { - mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM; - mask |= VTNET_TSO_FEATURES | VTNET_LRO_FEATURES; - } - if (vtnet_tunable_int(sc, "tso_disable", vtnet_tso_disable)) - mask |= VTNET_TSO_FEATURES; - if (vtnet_tunable_int(sc, "lro_disable", vtnet_lro_disable)) - mask |= VTNET_LRO_FEATURES; + no_csum = vtnet_tunable_int(sc, "csum_disable", vtnet_csum_disable); + if (no_csum) + features &= ~(VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM); + if (no_csum || vtnet_tunable_int(sc, "tso_disable", vtnet_tso_disable)) + features &= ~VTNET_TSO_FEATURES; + if (no_csum || vtnet_tunable_int(sc, "lro_disable", vtnet_lro_disable)) + features &= ~VTNET_LRO_FEATURES; + #ifndef VTNET_LEGACY_TX if (vtnet_tunable_int(sc, "mq_disable", vtnet_mq_disable)) - mask |= VIRTIO_NET_F_MQ; + features &= ~VIRTIO_NET_F_MQ; #else - mask |= VIRTIO_NET_F_MQ; + features &= ~VIRTIO_NET_F_MQ; #endif - features = VTNET_FEATURES & ~mask; sc->vtnet_features = virtio_negotiate_features(dev, features); if (virtio_with_feature(dev, VTNET_LRO_FEATURES) && @@ -619,6 +626,8 @@ vtnet_negotiate_features(struct vtnet_softc *sc) } else sc->vtnet_flags |= VTNET_FLAG_LRO_NOMRG; } + + virtio_finalize_features(dev); } static void @@ -630,6 +639,8 @@ vtnet_setup_features(struct vtnet_softc *sc) vtnet_negotiate_features(sc); + if (virtio_with_feature(dev, VIRTIO_F_VERSION_1)) + sc->vtnet_flags |= VTNET_FLAG_MODERN; if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) sc->vtnet_flags |= VTNET_FLAG_INDIRECT; if (virtio_with_feature(dev, VIRTIO_RING_F_EVENT_IDX)) @@ -643,11 +654,21 @@ vtnet_setup_features(struct vtnet_softc *sc) if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) { sc->vtnet_flags |= VTNET_FLAG_MRG_RXBUFS; sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf); + } else if (vtnet_modern(sc)) { + /* + * The V1 header is the same size and layout as the mergeable + * buffer header, but num_buffers will always be one. Depending + * on the context, the driver uses the mergeable header for + * either case. + */ + sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr_v1); } else sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr); if (sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) sc->vtnet_rx_nsegs = VTNET_MRG_RX_SEGS; + else if (vtnet_modern(sc)) /* TODO: And ANY_LAYOUT when supported */ + sc->vtnet_rx_nsegs = VTNET_MODERN_RX_SEGS; else if (sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG) sc->vtnet_rx_nsegs = VTNET_MAX_RX_SEGS; else @@ -660,6 +681,8 @@ vtnet_setup_features(struct vtnet_softc *sc) else sc->vtnet_tx_nsegs = VTNET_MIN_TX_SEGS; + sc->vtnet_max_vq_pairs = 1; + if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_VQ)) { sc->vtnet_flags |= VTNET_FLAG_CTRL_VQ; @@ -669,23 +692,22 @@ vtnet_setup_features(struct vtnet_softc *sc) sc->vtnet_flags |= VTNET_FLAG_VLAN_FILTER; if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_MAC_ADDR)) sc->vtnet_flags |= VTNET_FLAG_CTRL_MAC; - } - if (virtio_with_feature(dev, VIRTIO_NET_F_MQ) && - sc->vtnet_flags & VTNET_FLAG_CTRL_VQ) { - sc->vtnet_max_vq_pairs = virtio_read_dev_config_2(dev, - offsetof(struct virtio_net_config, max_virtqueue_pairs)); - } else - sc->vtnet_max_vq_pairs = 1; + if (virtio_with_feature(dev, VIRTIO_NET_F_MQ)) { + sc->vtnet_max_vq_pairs = virtio_read_dev_config_2(dev, + offsetof(struct virtio_net_config, + max_virtqueue_pairs)); + } + } if (sc->vtnet_max_vq_pairs > 1) { + int max; + /* * Limit the maximum number of queue pairs to the lower of - * the number of CPUs and the configured maximum. - * The actual number of queues that get used may be less. + * the number of CPUs and the configured maximum. The actual + * number of queues that get used may be less. */ - int max; - max = vtnet_tunable_int(sc, "mq_max_pairs", vtnet_mq_max_pairs); if (max > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN) { if (max > mp_ncpus) @@ -694,7 +716,7 @@ vtnet_setup_features(struct vtnet_softc *sc) max = VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX; if (max > 1) { sc->vtnet_requested_vq_pairs = max; - sc->vtnet_flags |= VTNET_FLAG_MULTIQ; + sc->vtnet_flags |= VTNET_FLAG_MQ; } } } @@ -903,7 +925,7 @@ vtnet_alloc_virtqueues(struct vtnet_softc *sc) if (info == NULL) return (ENOMEM); - for (i = 0, idx = 0; i < sc->vtnet_max_vq_pairs; i++, idx+=2) { + for (i = 0, idx = 0; i < sc->vtnet_max_vq_pairs; i++, idx += 2) { rxq = &sc->vtnet_rxqs[i]; VQ_ALLOC_INFO_INIT(&info[idx], sc->vtnet_rx_nsegs, vtnet_rx_vq_intr, rxq, &rxq->vtnrx_vq, @@ -921,10 +943,10 @@ vtnet_alloc_virtqueues(struct vtnet_softc *sc) } /* - * Enable interrupt binding if this is multiqueue. This only matters - * when per-vq MSIX is available. + * TODO: Enable interrupt binding if this is multiqueue. This will + * only matter when per-vq MSIX is available. */ - if (sc->vtnet_flags & VTNET_FLAG_MULTIQ) + if (sc->vtnet_flags & VTNET_FLAG_MQ) flags |= 0; error = virtio_alloc_virtqueues(dev, flags, nvqs, info); @@ -972,9 +994,7 @@ vtnet_setup_interface(struct vtnet_softc *sc) ifmedia_add(&sc->vtnet_media, VTNET_MEDIATYPE, 0, NULL); ifmedia_set(&sc->vtnet_media, VTNET_MEDIATYPE); - /* Read (or generate) the MAC address for the adapter. */ vtnet_get_hwaddr(sc); - ether_ifattach(ifp, sc->vtnet_hwaddr); if (virtio_with_feature(dev, VIRTIO_NET_F_STATUS)) @@ -985,21 +1005,19 @@ vtnet_setup_interface(struct vtnet_softc *sc) ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU; if (virtio_with_feature(dev, VIRTIO_NET_F_CSUM)) { + int gso; + ifp->if_capabilities |= IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6; - if (virtio_with_feature(dev, VIRTIO_NET_F_GSO)) { - ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_TSO6; + gso = virtio_with_feature(dev, VIRTIO_NET_F_GSO); + if (gso || virtio_with_feature(dev, VIRTIO_NET_F_HOST_TSO4)) + ifp->if_capabilities |= IFCAP_TSO4; + if (gso || virtio_with_feature(dev, VIRTIO_NET_F_HOST_TSO6)) + ifp->if_capabilities |= IFCAP_TSO6; + if (gso || virtio_with_feature(dev, VIRTIO_NET_F_HOST_ECN)) sc->vtnet_flags |= VTNET_FLAG_TSO_ECN; - } else { - if (virtio_with_feature(dev, VIRTIO_NET_F_HOST_TSO4)) - ifp->if_capabilities |= IFCAP_TSO4; - if (virtio_with_feature(dev, VIRTIO_NET_F_HOST_TSO6)) - ifp->if_capabilities |= IFCAP_TSO6; - if (virtio_with_feature(dev, VIRTIO_NET_F_HOST_ECN)) - sc->vtnet_flags |= VTNET_FLAG_TSO_ECN; - } - if (ifp->if_capabilities & IFCAP_TSO) + if (ifp->if_capabilities & (IFCAP_TSO4 | IFCAP_TSO6)) ifp->if_capabilities |= IFCAP_VLAN_HWTSO; } @@ -1007,7 +1025,8 @@ vtnet_setup_interface(struct vtnet_softc *sc) ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || - virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6)) + virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6) || + virtio_with_feature(dev, VIRTIO_NET_F_GUEST_ECN)) ifp->if_capabilities |= IFCAP_LRO; } @@ -1027,7 +1046,6 @@ vtnet_setup_interface(struct vtnet_softc *sc) /* * Capabilities after here are not enabled by default. */ - if (sc->vtnet_flags & VTNET_FLAG_VLAN_FILTER) { ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; @@ -1051,36 +1069,40 @@ vtnet_setup_interface(struct vtnet_softc *sc) return (0); } +/* BMV: This needs rethinking. */ static int vtnet_change_mtu(struct vtnet_softc *sc, int new_mtu) { struct ifnet *ifp; - int frame_size, clsize; + int frame_size, clustersz; ifp = sc->vtnet_ifp; if (new_mtu < ETHERMIN || new_mtu > VTNET_MAX_MTU) return (EINVAL); - frame_size = sc->vtnet_hdr_size + sizeof(struct ether_vlan_header) + - new_mtu; + frame_size = sc->vtnet_hdr_size; + frame_size += sizeof(struct ether_vlan_header) + new_mtu; /* - * Based on the new MTU (and hence frame size) determine which - * cluster size is most appropriate for the receive queues. + * Based on the new MTU, determine which cluster size is appropriate + * for the receive queues. + * + * BMV: This likely needs rethinking wrt LRO enabled/disabled and + * the size of the virtqueue. */ - if (frame_size <= MCLBYTES) { - clsize = MCLBYTES; - } else if ((sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) == 0) { - /* Avoid going past 9K jumbos. */ + if (frame_size <= MCLBYTES) + clustersz = MCLBYTES; + else if (sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) + clustersz = MJUMPAGESIZE; + else { if (frame_size > MJUM9BYTES) return (EINVAL); - clsize = MJUM9BYTES; - } else - clsize = MJUMPAGESIZE; + clustersz = MJUM9BYTES; + } ifp->if_mtu = new_mtu; - sc->vtnet_rx_new_clsize = clsize; + sc->vtnet_rx_new_clustersz = clustersz; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; @@ -1137,10 +1159,9 @@ vtnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCADDMULTI: case SIOCDELMULTI: - if ((sc->vtnet_flags & VTNET_FLAG_CTRL_RX) == 0) - break; VTNET_CORE_LOCK(sc); - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (sc->vtnet_flags & VTNET_FLAG_CTRL_RX && + ifp->if_drv_flags & IFF_DRV_RUNNING) vtnet_rx_filter_mac(sc); VTNET_CORE_UNLOCK(sc); break; @@ -1268,27 +1289,27 @@ static struct mbuf * vtnet_rx_alloc_buf(struct vtnet_softc *sc, int nbufs, struct mbuf **m_tailp) { struct mbuf *m_head, *m_tail, *m; - int i, clsize; + int i, clustersz; - clsize = sc->vtnet_rx_clsize; + clustersz = sc->vtnet_rx_clustersz; KASSERT(nbufs == 1 || sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG, ("%s: chained mbuf %d request without LRO_NOMRG", __func__, nbufs)); - m_head = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, clsize); + m_head = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, clustersz); if (m_head == NULL) goto fail; - m_head->m_len = clsize; + m_head->m_len = clustersz; m_tail = m_head; /* Allocate the rest of the chain. */ for (i = 1; i < nbufs; i++) { - m = m_getjcl(M_NOWAIT, MT_DATA, 0, clsize); + m = m_getjcl(M_NOWAIT, MT_DATA, 0, clustersz); if (m == NULL) goto fail; - m->m_len = clsize; + m->m_len = clustersz; m_tail->m_next = m; m_tail = m; } @@ -1315,10 +1336,10 @@ vtnet_rxq_replace_lro_nomgr_buf(struct vtnet_rxq *rxq, struct mbuf *m0, struct vtnet_softc *sc; struct mbuf *m, *m_prev; struct mbuf *m_new, *m_tail; - int len, clsize, nreplace, error; + int len, clustersz, nreplace, error; sc = rxq->vtnrx_sc; - clsize = sc->vtnet_rx_clsize; + clustersz = sc->vtnet_rx_clustersz; m_prev = NULL; m_tail = NULL; @@ -1344,9 +1365,9 @@ vtnet_rxq_replace_lro_nomgr_buf(struct vtnet_rxq *rxq, struct mbuf *m0, } /* We always allocate the same cluster size. */ - KASSERT(m->m_len == clsize, + KASSERT(m->m_len == clustersz, ("%s: mbuf size %d is not the cluster size %d", - __func__, m->m_len, clsize)); + __func__, m->m_len, clustersz)); m->m_len = MIN(m->m_len, len); len -= m->m_len; @@ -1362,7 +1383,7 @@ vtnet_rxq_replace_lro_nomgr_buf(struct vtnet_rxq *rxq, struct mbuf *m0, m_new = vtnet_rx_alloc_buf(sc, nreplace, &m_tail); if (m_new == NULL) { - m_prev->m_len = clsize; + m_prev->m_len = clustersz; return (ENOBUFS); } @@ -1392,7 +1413,7 @@ vtnet_rxq_replace_lro_nomgr_buf(struct vtnet_rxq *rxq, struct mbuf *m0, m_tail->m_next = NULL; } - m_prev->m_len = clsize; + m_prev->m_len = clustersz; m_freem(m_new); } @@ -1442,39 +1463,40 @@ vtnet_rxq_enqueue_buf(struct vtnet_rxq *rxq, struct mbuf *m) { struct vtnet_softc *sc; struct sglist *sg; - struct vtnet_rx_header *rxhdr; - uint8_t *mdata; - int offset, error; + int error; sc = rxq->vtnrx_sc; sg = rxq->vtnrx_sg; - mdata = mtod(m, uint8_t *); + KASSERT(m->m_next == NULL || sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG, + ("%s: mbuf chain without LRO_NOMRG", __func__)); + KASSERT(m->m_len == sc->vtnet_rx_clustersz, ("%s: unexpected mbuf " + "length %d %d", __func__, m->m_len, sc->vtnet_rx_clustersz)); VTNET_RXQ_LOCK_ASSERT(rxq); - KASSERT(sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG || m->m_next == NULL, - ("%s: chained mbuf without LRO_NOMRG", __func__)); - KASSERT(m->m_len == sc->vtnet_rx_clsize, - ("%s: unexpected cluster size %d/%d", __func__, m->m_len, - sc->vtnet_rx_clsize)); sglist_reset(sg); - if ((sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) == 0) { + if (vtnet_modern(sc) || sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) { + error = sglist_append_mbuf(sg, m); + } else { + struct vtnet_rx_header *rxhdr; + + rxhdr = mtod(m, struct vtnet_rx_header *); MPASS(sc->vtnet_hdr_size == sizeof(struct virtio_net_hdr)); - rxhdr = (struct vtnet_rx_header *) mdata; - sglist_append(sg, &rxhdr->vrh_hdr, sc->vtnet_hdr_size); - offset = sizeof(struct vtnet_rx_header); - } else - offset = 0; - sglist_append(sg, mdata + offset, m->m_len - offset); - if (m->m_next != NULL) { - error = sglist_append_mbuf(sg, m->m_next); - MPASS(error == 0); + /* Append inlined header and then rest of the mbuf chain. */ + error = sglist_append(sg, &rxhdr->vrh_hdr, sc->vtnet_hdr_size); + if (error == 0) { + error = sglist_append(sg, &rxhdr[1], + m->m_len - sizeof(struct vtnet_rx_header)); + } + if (error == 0 && m->m_next != NULL) + error = sglist_append_mbuf(sg, m->m_next); } - error = virtqueue_enqueue(rxq->vtnrx_vq, m, sg, 0, sg->sg_nseg); + if (error) + return (error); - return (error); + return (virtqueue_enqueue(rxq->vtnrx_vq, m, sg, 0, sg->sg_nseg)); } static int @@ -1783,16 +1805,12 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) struct vtnet_softc *sc; struct ifnet *ifp; struct virtqueue *vq; - struct mbuf *m, *mr; - struct virtio_net_hdr_mrg_rxbuf *mhdr; + struct mbuf *m; int len, deq, nbufs, adjsz, count; - pfil_return_t pfil; - bool pfil_done; sc = rxq->vtnrx_sc; vq = rxq->vtnrx_vq; ifp = sc->vtnet_ifp; - hdr = &lhdr; deq = 0; count = sc->vtnet_rx_process_limit; @@ -1810,49 +1828,23 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) continue; } - if ((sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) == 0) { - nbufs = 1; - adjsz = sizeof(struct vtnet_rx_header); + if (vtnet_modern(sc) || + sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) { /* - * Account for our pad inserted between the header - * and the actual start of the frame. + * For our purposes here, the V1 header is the same as + * the mergeable buffers header. */ - len += VTNET_RX_HEADER_PAD; - } else { - mhdr = mtod(m, struct virtio_net_hdr_mrg_rxbuf *); - nbufs = mhdr->num_buffers; + struct virtio_net_hdr_mrg_rxbuf *mhdr = + mtod(m, struct virtio_net_hdr_mrg_rxbuf *); + nbufs = vtnet_htog16(sc, mhdr->num_buffers); adjsz = sizeof(struct virtio_net_hdr_mrg_rxbuf); + } else { + nbufs = 1; + adjsz = sizeof(struct vtnet_rx_header); + /* Our pad between the header and start of the frame. */ + len += VTNET_RX_HEADER_PAD; } - /* - * If we have enough data in first mbuf, run it through - * pfil as a memory buffer before dequeueing the rest. - */ - if (PFIL_HOOKED_IN(sc->vtnet_pfil) && - len - adjsz >= ETHER_HDR_LEN + max_protohdr) { - pfil = pfil_run_hooks(sc->vtnet_pfil, - m->m_data + adjsz, ifp, - (len - adjsz) | PFIL_MEMPTR | PFIL_IN, NULL); - switch (pfil) { - case PFIL_REALLOCED: - mr = pfil_mem2mbuf(m->m_data + adjsz); - vtnet_rxq_input(rxq, mr, hdr); - /* FALLTHROUGH */ - case PFIL_DROPPED: - case PFIL_CONSUMED: - vtnet_rxq_discard_buf(rxq, m); - if (nbufs > 1) - vtnet_rxq_discard_merged_bufs(rxq, - nbufs); - continue; - default: - KASSERT(pfil == PFIL_PASS, - ("Filter returned %d!\n", pfil)); - }; - pfil_done = true; - } else - pfil_done = false; - if (vtnet_rxq_replace_buf(rxq, m, len) != 0) { rxq->vtnrx_stats.vrxs_iqdrops++; vtnet_rxq_discard_buf(rxq, m); @@ -1872,31 +1864,39 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) } /* - * Save copy of header before we strip it. For both mergeable - * and non-mergeable, the header is at the beginning of the - * mbuf data. We no longer need num_buffers, so always use a - * regular header. - * - * BMV: Is this memcpy() expensive? We know the mbuf data is - * still valid even after the m_adj(). + * Save an endian swapped version of the header prior to it + * being stripped. For both mergeable and non-mergeable, the + * header is at the start of the mbuf data. num_buffers was + * already saved (and longer need it) so use a regular header. */ - memcpy(hdr, mtod(m, void *), sizeof(struct virtio_net_hdr)); + hdr = mtod(m, struct virtio_net_hdr *); + lhdr.flags = hdr->flags; + lhdr.gso_type = hdr->gso_type; + lhdr.hdr_len = vtnet_htog16(sc, hdr->hdr_len); + lhdr.gso_size = vtnet_htog16(sc, hdr->gso_size); + lhdr.csum_start = vtnet_htog16(sc, hdr->csum_start); + lhdr.csum_offset = vtnet_htog16(sc, hdr->csum_offset); m_adj(m, adjsz); - if (PFIL_HOOKED_IN(sc->vtnet_pfil) && pfil_done == false) { + if (PFIL_HOOKED_IN(sc->vtnet_pfil)) { + pfil_return_t pfil; + pfil = pfil_run_hooks(sc->vtnet_pfil, &m, ifp, PFIL_IN, NULL); switch (pfil) { + case PFIL_REALLOCED: + m = pfil_mem2mbuf(m->m_data); + break; case PFIL_DROPPED: case PFIL_CONSUMED: continue; default: KASSERT(pfil == PFIL_PASS, - ("Filter returned %d!\n", pfil)); + ("Filter returned %d!", pfil)); } } - vtnet_rxq_input(rxq, m, hdr); + vtnet_rxq_input(rxq, m, &lhdr); /* Must recheck after dropping the Rx lock. */ if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -2062,12 +2062,11 @@ vtnet_txq_free_mbufs(struct vtnet_txq *txq) } /* - * BMV: Much of this can go away once we finally have offsets in - * the mbuf packet header. Bug andre@. + * BMV: This can go away once we finally have offsets in the mbuf header. */ static int -vtnet_txq_offload_ctx(struct vtnet_txq *txq, struct mbuf *m, - int *etype, int *proto, int *start) +vtnet_txq_offload_ctx(struct vtnet_txq *txq, struct mbuf *m, int *etype, + int *proto, int *start) { struct vtnet_softc *sc; struct ether_vlan_header *evh; @@ -2135,8 +2134,8 @@ vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int eth_type, } else tcp = (struct tcphdr *)(m->m_data + offset); - hdr->hdr_len = offset + (tcp->th_off << 2); - hdr->gso_size = m->m_pkthdr.tso_segsz; + hdr->hdr_len = vtnet_gtoh16(sc, offset + (tcp->th_off << 2)); + hdr->gso_size = vtnet_gtoh16(sc, m->m_pkthdr.tso_segsz); hdr->gso_type = eth_type == ETHERTYPE_IP ? VIRTIO_NET_HDR_GSO_TCPV4 : VIRTIO_NET_HDR_GSO_TCPV6; @@ -2181,8 +2180,8 @@ vtnet_txq_offload(struct vtnet_txq *txq, struct mbuf *m, * but that really should not be necessary. */ hdr->flags |= VIRTIO_NET_HDR_F_NEEDS_CSUM; - hdr->csum_start = csum_start; - hdr->csum_offset = m->m_pkthdr.csum_data; + hdr->csum_start = vtnet_gtoh16(sc, csum_start); + hdr->csum_offset = vtnet_gtoh16(sc, m->m_pkthdr.csum_data); txq->vtntx_stats.vtxs_csum++; } @@ -2226,8 +2225,11 @@ vtnet_txq_enqueue_buf(struct vtnet_txq *txq, struct mbuf **m_head, sglist_reset(sg); error = sglist_append(sg, &txhdr->vth_uhdr, sc->vtnet_hdr_size); - KASSERT(error == 0 && sg->sg_nseg == 1, - ("%s: error %d adding header to sglist", __func__, error)); + if (error != 0 || sg->sg_nseg != 1) { + KASSERT(0, ("%s: cannot add header to sglist error %d nseg %d", + __func__, error, sg->sg_nseg)); + goto fail; + } error = sglist_append_mbuf(sg, m); if (error) { @@ -2275,9 +2277,9 @@ vtnet_txq_encap(struct vtnet_txq *txq, struct mbuf **m_head, int flags) } /* - * Always use the non-mergeable header, regardless if the feature - * was negotiated. For transmit, num_buffers is always zero. The - * vtnet_hdr_size is used to enqueue the correct header size. + * Always use the non-mergeable header, regardless if mergable headers + * were negotiated, because for transmit num_buffers is always zero. + * The vtnet_hdr_size is used to enqueue the right header size segment. */ hdr = &txhdr->vth_uhdr.hdr; @@ -2299,11 +2301,9 @@ vtnet_txq_encap(struct vtnet_txq *txq, struct mbuf **m_head, int flags) } error = vtnet_txq_enqueue_buf(txq, m_head, txhdr); - if (error == 0) - return (0); - fail: - uma_zfree(vtnet_tx_header_zone, txhdr); + if (error) + uma_zfree(vtnet_tx_header_zone, txhdr); return (error); } @@ -2452,7 +2452,6 @@ vtnet_txq_mq_start(struct ifnet *ifp, struct mbuf *m) sc = ifp->if_softc; npairs = sc->vtnet_act_vq_pairs; - /* check if flowid is set */ if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) i = m->m_pkthdr.flowid % npairs; else @@ -2988,7 +2987,7 @@ vtnet_init_rx_queues(struct vtnet_softc *sc) { device_t dev; struct vtnet_rxq *rxq; - int i, clsize, error; + int i, clustersz, error; dev = sc->vtnet_dev; @@ -2999,14 +2998,14 @@ vtnet_init_rx_queues(struct vtnet_softc *sc) * BMV: It might make sense to use page sized clusters as * the default (depending on the features negotiated). */ - if (sc->vtnet_rx_new_clsize != 0) { - clsize = sc->vtnet_rx_new_clsize; - sc->vtnet_rx_new_clsize = 0; + if (sc->vtnet_rx_new_clustersz != 0) { + clustersz = sc->vtnet_rx_new_clustersz; + sc->vtnet_rx_new_clustersz = 0; } else - clsize = MCLBYTES; + clustersz = MCLBYTES; - sc->vtnet_rx_clsize = clsize; - sc->vtnet_rx_nmbufs = VTNET_NEEDED_RX_MBUFS(sc, clsize); + sc->vtnet_rx_clustersz = clustersz; + sc->vtnet_rx_nmbufs = VTNET_NEEDED_RX_MBUFS(sc, clustersz); KASSERT(sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS || sc->vtnet_rx_nmbufs < sc->vtnet_rx_nsegs, @@ -3072,7 +3071,7 @@ vtnet_set_active_vq_pairs(struct vtnet_softc *sc) dev = sc->vtnet_dev; - if ((sc->vtnet_flags & VTNET_FLAG_MULTIQ) == 0) { + if ((sc->vtnet_flags & VTNET_FLAG_MQ) == 0) { sc->vtnet_act_vq_pairs = 1; return; } @@ -3191,16 +3190,13 @@ vtnet_init(void *xsc) static void vtnet_free_ctrl_vq(struct vtnet_softc *sc) { - struct virtqueue *vq; - - vq = sc->vtnet_ctrl_vq; /* * The control virtqueue is only polled and therefore it should * already be empty. */ - KASSERT(virtqueue_empty(vq), - ("%s: ctrl vq %p not empty", __func__, vq)); + KASSERT(virtqueue_empty(sc->vtnet_ctrl_vq), + ("%s: ctrl vq %p not empty", __func__, sc->vtnet_ctrl_vq)); } static void @@ -3212,46 +3208,53 @@ vtnet_exec_ctrl_cmd(struct vtnet_softc *sc, void *cookie, vq = sc->vtnet_ctrl_vq; VTNET_CORE_LOCK_ASSERT(sc); - KASSERT(sc->vtnet_flags & VTNET_FLAG_CTRL_VQ, - ("%s: CTRL_VQ feature not negotiated", __func__)); + MPASS(sc->vtnet_flags & VTNET_FLAG_CTRL_VQ); if (!virtqueue_empty(vq)) return; - if (virtqueue_enqueue(vq, cookie, sg, readable, writable) != 0) - return; /* - * Poll for the response, but the command is likely already - * done when we return from the notify. + * Poll for the response, but the command is likely completed before + * returning from the notify. */ - virtqueue_notify(vq); - virtqueue_poll(vq, NULL); + if (virtqueue_enqueue(vq, cookie, sg, readable, writable) == 0) { + virtqueue_notify(vq); + virtqueue_poll(vq, NULL); + } } static int vtnet_ctrl_mac_cmd(struct vtnet_softc *sc, uint8_t *hwaddr) { - struct virtio_net_ctrl_hdr hdr __aligned(2); struct sglist_seg segs[3]; struct sglist sg; - uint8_t ack; + struct { + struct virtio_net_ctrl_hdr hdr __aligned(2); + uint8_t pad1; + uint8_t addr[ETHER_ADDR_LEN] __aligned(8); + uint8_t pad2; + uint8_t ack; + } s; int error; - hdr.class = VIRTIO_NET_CTRL_MAC; - hdr.cmd = VIRTIO_NET_CTRL_MAC_ADDR_SET; - ack = VIRTIO_NET_ERR; - - sglist_init(&sg, 3, segs); error = 0; - error |= sglist_append(&sg, &hdr, sizeof(struct virtio_net_ctrl_hdr)); - error |= sglist_append(&sg, hwaddr, ETHER_ADDR_LEN); - error |= sglist_append(&sg, &ack, sizeof(uint8_t)); - KASSERT(error == 0 && sg.sg_nseg == 3, - ("%s: error %d adding set MAC msg to sglist", __func__, error)); + MPASS(sc->vtnet_flags & VTNET_FLAG_CTRL_MAC); + + s.hdr.class = VIRTIO_NET_CTRL_MAC; + s.hdr.cmd = VIRTIO_NET_CTRL_MAC_ADDR_SET; + bcopy(hwaddr, &s.addr[0], ETHER_ADDR_LEN); + s.ack = VIRTIO_NET_ERR; + + sglist_init(&sg, nitems(segs), segs); + error |= sglist_append(&sg, &s.hdr, sizeof(struct virtio_net_ctrl_hdr)); + error |= sglist_append(&sg, &s.addr[0], ETHER_ADDR_LEN); + error |= sglist_append(&sg, &s.ack, sizeof(uint8_t)); + MPASS(error == 0 && sg.sg_nseg == nitems(segs)); - vtnet_exec_ctrl_cmd(sc, &ack, &sg, sg.sg_nseg - 1, 1); + if (error == 0) + vtnet_exec_ctrl_cmd(sc, &s.ack, &sg, sg.sg_nseg - 1, 1); - return (ack == VIRTIO_NET_OK ? 0 : EIO); + return (s.ack == VIRTIO_NET_OK ? 0 : EIO); } static int @@ -3260,63 +3263,64 @@ vtnet_ctrl_mq_cmd(struct vtnet_softc *sc, uint16_t npairs) struct sglist_seg segs[3]; struct sglist sg; struct { - struct virtio_net_ctrl_hdr hdr; + struct virtio_net_ctrl_hdr hdr __aligned(2); uint8_t pad1; - struct virtio_net_ctrl_mq mq; + struct virtio_net_ctrl_mq mq __aligned(2); uint8_t pad2; uint8_t ack; - } s __aligned(2); + } s; int error; + error = 0; + MPASS(sc->vtnet_flags & VTNET_FLAG_MQ); + s.hdr.class = VIRTIO_NET_CTRL_MQ; s.hdr.cmd = VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET; - s.mq.virtqueue_pairs = npairs; + s.mq.virtqueue_pairs = vtnet_gtoh16(sc, npairs); s.ack = VIRTIO_NET_ERR; - sglist_init(&sg, 3, segs); - error = 0; + sglist_init(&sg, nitems(segs), segs); error |= sglist_append(&sg, &s.hdr, sizeof(struct virtio_net_ctrl_hdr)); error |= sglist_append(&sg, &s.mq, sizeof(struct virtio_net_ctrl_mq)); error |= sglist_append(&sg, &s.ack, sizeof(uint8_t)); - KASSERT(error == 0 && sg.sg_nseg == 3, - ("%s: error %d adding MQ message to sglist", __func__, error)); + MPASS(error == 0 && sg.sg_nseg == nitems(segs)); *** 584 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:17 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8C7A24E52BA; Tue, 19 Jan 2021 05:08:17 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9r4zggz4Wy7; Tue, 19 Jan 2021 05:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32369208E3; Tue, 19 Jan 2021 05:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58DRD085786; Tue, 19 Jan 2021 05:08:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58DlF085785; Tue, 19 Jan 2021 05:08:13 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:13 GMT Message-Id: <202101190508.10J58DlF085785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: aabdf5b6e8e8 - main - if_vtnet: Support VIRTIO_NET_F_MTU MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aabdf5b6e8e82cda0ca2064ef78e2724bd486e7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:17 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=aabdf5b6e8e82cda0ca2064ef78e2724bd486e7e commit aabdf5b6e8e82cda0ca2064ef78e2724bd486e7e Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 if_vtnet: Support VIRTIO_NET_F_MTU This feature lets the guest driver know the maximum MTU size supported by the host device. If set, use this to limit the acceptable MTUs, and improve how the receive mbuf cluster size then is selected. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27907 --- sys/dev/virtio/network/if_vtnet.c | 15 ++++++++++----- sys/dev/virtio/network/if_vtnetvar.h | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index d90fd3bc43aa..ca60e51c57d2 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -668,6 +668,12 @@ vtnet_setup_features(struct vtnet_softc *sc) sc->vtnet_flags |= VTNET_FLAG_MAC; } + if (virtio_with_feature(dev, VIRTIO_NET_F_MTU)) { + sc->vtnet_max_mtu = virtio_read_dev_config_2(dev, + offsetof(struct virtio_net_config, mtu)); + } else + sc->vtnet_max_mtu = VTNET_MAX_MTU; + if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) { sc->vtnet_flags |= VTNET_FLAG_MRG_RXBUFS; sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf); @@ -1094,10 +1100,9 @@ vtnet_rx_cluster_size(struct vtnet_softc *sc, int mtu) return (MCLBYTES); /* - * Try to scale the receive mbuf cluster size from the MTU. Without - * the GUEST_TSO[46] features, the VirtIO specification says the - * driver must only be able to receive ~1500 byte frames. But if - * jumbo frames can be transmitted then try to receive jumbo. + * Try to scale the receive mbuf cluster size from the MTU. We + * could also use the VQ size to influence the selected size, + * but that would only matter for very small queues. */ if (vtnet_modern(sc)) { MPASS(sc->vtnet_hdr_size == sizeof(struct virtio_net_hdr_v1)); @@ -1128,7 +1133,7 @@ vtnet_ioctl_mtu(struct vtnet_softc *sc, int mtu) if (ifp->if_mtu == mtu) return (0); - else if (mtu < ETHERMIN || mtu > VTNET_MAX_MTU) + else if (mtu < ETHERMIN || mtu > sc->vtnet_max_mtu) return (EINVAL); ifp->if_mtu = mtu; diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index eaf6eaf8d504..29a0dbbb734f 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -164,6 +164,7 @@ struct vtnet_softc { int vtnet_tx_intr_thresh; int vtnet_tx_nsegs; int vtnet_if_flags; + int vtnet_max_mtu; int vtnet_act_vq_pairs; int vtnet_max_vq_pairs; int vtnet_requested_vq_pairs; @@ -297,6 +298,7 @@ CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE); #define VTNET_COMMON_FEATURES \ (VIRTIO_NET_F_MAC | \ VIRTIO_NET_F_STATUS | \ + VIRTIO_NET_F_MTU | \ VIRTIO_NET_F_CTRL_VQ | \ VIRTIO_NET_F_CTRL_RX | \ VIRTIO_NET_F_CTRL_MAC_ADDR | \ From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:24 2021 Return-Path: Delivered-To: dev-commits-src-main@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 F29A74E5584; Tue, 19 Jan 2021 05:08:23 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9y2J9cz4XFN; Tue, 19 Jan 2021 05:08:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99039208E4; Tue, 19 Jan 2021 05:08:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58HAj085870; Tue, 19 Jan 2021 05:08:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58H4u085869; Tue, 19 Jan 2021 05:08:17 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:17 GMT Message-Id: <202101190508.10J58H4u085869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: baa5234fbec6 - main - if_vtnet: Move the Tx interrupt threshold into the Txq structure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: baa5234fbec6befdc6c3fd7beea2f318e7e97d0c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:24 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=baa5234fbec6befdc6c3fd7beea2f318e7e97d0c commit baa5234fbec6befdc6c3fd7beea2f318e7e97d0c Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 if_vtnet: Move the Tx interrupt threshold into the Txq structure Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27911 --- sys/dev/virtio/network/if_vtnet.c | 67 +++++++++++++++++------------------- sys/dev/virtio/network/if_vtnetvar.h | 2 +- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index f55bd59ef749..39009a1de3f0 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -140,6 +140,7 @@ static void vtnet_rx_vq_process(struct vtnet_rxq *rxq, int tries); static void vtnet_rx_vq_intr(void *); static void vtnet_rxq_tq_intr(void *, int); +static int vtnet_txq_intr_threshold(struct vtnet_txq *); static int vtnet_txq_below_threshold(struct vtnet_txq *); static int vtnet_txq_notify(struct vtnet_txq *); static void vtnet_txq_free_mbufs(struct vtnet_txq *); @@ -219,7 +220,6 @@ static void vtnet_set_macaddr(struct vtnet_softc *); static void vtnet_attached_set_macaddr(struct vtnet_softc *); static void vtnet_vlan_tag_remove(struct mbuf *); static void vtnet_set_rx_process_limit(struct vtnet_softc *); -static void vtnet_set_tx_intr_threshold(struct vtnet_softc *); static void vtnet_setup_rxq_sysctl(struct sysctl_ctx_list *, struct sysctl_oid_list *, struct vtnet_rxq *); @@ -1090,7 +1090,6 @@ vtnet_setup_interface(struct vtnet_softc *sc) } vtnet_set_rx_process_limit(sc); - vtnet_set_tx_intr_threshold(sc); DEBUGNET_SET(ifp, vtnet); @@ -2024,15 +2023,42 @@ vtnet_rxq_tq_intr(void *xrxq, int pending) } static int -vtnet_txq_below_threshold(struct vtnet_txq *txq) +vtnet_txq_intr_threshold(struct vtnet_txq *txq) { struct vtnet_softc *sc; - struct virtqueue *vq; + int threshold; sc = txq->vtntx_sc; + + /* + * The Tx interrupt is disabled until the queue free count falls + * below our threshold. Completed frames are drained from the Tx + * virtqueue before transmitting new frames and in the watchdog + * callout, so the frequency of Tx interrupts is greatly reduced, + * at the cost of not freeing mbufs as quickly as they otherwise + * would be. + */ + threshold = virtqueue_size(txq->vtntx_vq) / 4; + + /* + * Without indirect descriptors, leave enough room for the most + * segments we handle. + */ + if ((sc->vtnet_flags & VTNET_FLAG_INDIRECT) == 0 && + threshold < sc->vtnet_tx_nsegs) + threshold = sc->vtnet_tx_nsegs; + + return (threshold); +} + +static int +vtnet_txq_below_threshold(struct vtnet_txq *txq) +{ + struct virtqueue *vq; + vq = txq->vtntx_vq; - return (virtqueue_nfree(vq) <= sc->vtnet_tx_intr_thresh); + return (virtqueue_nfree(vq) <= txq->vtntx_intr_threshold); } static int @@ -3058,6 +3084,7 @@ vtnet_init_tx_queues(struct vtnet_softc *sc) for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { txq = &sc->vtnet_txqs[i]; txq->vtntx_watchdog = 0; + txq->vtntx_intr_threshold = vtnet_txq_intr_threshold(txq); #ifdef DEV_NETMAP netmap_reset(NA(sc->vtnet_ifp), NR_TX, i, 0); #endif /* DEV_NETMAP */ @@ -3749,36 +3776,6 @@ vtnet_set_rx_process_limit(struct vtnet_softc *sc) sc->vtnet_rx_process_limit = limit; } -static void -vtnet_set_tx_intr_threshold(struct vtnet_softc *sc) -{ - int size, thresh; - - size = virtqueue_size(sc->vtnet_txqs[0].vtntx_vq); - - /* - * The Tx interrupt is disabled until the queue free count falls - * below our threshold. Completed frames are drained from the Tx - * virtqueue before transmitting new frames and in the watchdog - * callout, so the frequency of Tx interrupts is greatly reduced, - * at the cost of not freeing mbufs as quickly as they otherwise - * would be. - * - * N.B. We assume all the Tx queues are the same size. - */ - thresh = size / 4; - - /* - * Without indirect descriptors, leave enough room for the most - * segments we handle. - */ - if ((sc->vtnet_flags & VTNET_FLAG_INDIRECT) == 0 && - thresh < sc->vtnet_tx_nsegs) - thresh = sc->vtnet_tx_nsegs; - - sc->vtnet_tx_intr_thresh = thresh; -} - static void vtnet_setup_rxq_sysctl(struct sysctl_ctx_list *ctx, struct sysctl_oid_list *child, struct vtnet_rxq *rxq) diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 4189bb4d966f..82dd2514472d 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -112,6 +112,7 @@ struct vtnet_txq { #endif int vtntx_id; int vtntx_watchdog; + int vtntx_intr_threshold; struct vtnet_txq_stats vtntx_stats; struct taskqueue *vtntx_tq; struct task vtntx_intrtask; @@ -161,7 +162,6 @@ struct vtnet_softc { int vtnet_rx_nsegs; int vtnet_rx_nmbufs; int vtnet_rx_clustersz; - int vtnet_tx_intr_thresh; int vtnet_tx_nsegs; int vtnet_if_flags; int vtnet_max_mtu; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:27 2021 Return-Path: Delivered-To: dev-commits-src-main@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 520AD4E54A0; Tue, 19 Jan 2021 05:08:27 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcB15pjpz4XKm; Tue, 19 Jan 2021 05:08:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1998820BA4; Tue, 19 Jan 2021 05:08:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58KIM085932; Tue, 19 Jan 2021 05:08:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58KOG085931; Tue, 19 Jan 2021 05:08:20 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:20 GMT Message-Id: <202101190508.10J58KOG085931@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 44559b26af14 - main - if_vtnet: Cleanup the reinit process MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 44559b26af1403513dabc0f15e23649aaf40d5d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:27 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=44559b26af1403513dabc0f15e23649aaf40d5d9 commit 44559b26af1403513dabc0f15e23649aaf40d5d9 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Cleanup the reinit process In modern VirtIO, the virtqueues cannot be notified before setting DRIVER_OK status. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27932 --- sys/dev/virtio/network/if_vtnet.c | 91 ++++++++++++++++++------------------ sys/dev/virtio/network/if_vtnetvar.h | 1 + 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 33d421b32b1f..d0c98afe5b20 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -600,7 +600,7 @@ static void vtnet_negotiate_features(struct vtnet_softc *sc) { device_t dev; - uint64_t features; + uint64_t features, negotiated_features; int no_csum; dev = sc->vtnet_dev; @@ -626,7 +626,7 @@ vtnet_negotiate_features(struct vtnet_softc *sc) features &= ~VIRTIO_NET_F_MQ; #endif - sc->vtnet_features = virtio_negotiate_features(dev, features); + negotiated_features = virtio_negotiate_features(dev, features); if (virtio_with_feature(dev, VTNET_LRO_FEATURES) && virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF) == 0) { @@ -644,12 +644,15 @@ vtnet_negotiate_features(struct vtnet_softc *sc) "LRO disabled since both mergeable buffers and " "indirect descriptors were not negotiated\n"); features &= ~VTNET_LRO_FEATURES; - sc->vtnet_features = + negotiated_features = virtio_negotiate_features(dev, features); } else sc->vtnet_flags |= VTNET_FLAG_LRO_NOMRG; } + sc->vtnet_features = negotiated_features; + sc->vtnet_negotiated_features = negotiated_features; + virtio_finalize_features(dev); } @@ -2964,19 +2967,11 @@ vtnet_virtio_reinit(struct vtnet_softc *sc) device_t dev; struct ifnet *ifp; uint64_t features; - int mask, error; + int error; dev = sc->vtnet_dev; ifp = sc->vtnet_ifp; - features = sc->vtnet_features; - - mask = 0; -#if defined(INET) - mask |= IFCAP_RXCSUM; -#endif -#if defined (INET6) - mask |= IFCAP_RXCSUM_IPV6; -#endif + features = sc->vtnet_negotiated_features; /* * Re-negotiate with the host, removing any disabled receive @@ -2984,14 +2979,17 @@ vtnet_virtio_reinit(struct vtnet_softc *sc) * via if_capenable and if_hwassist. */ - if (ifp->if_capabilities & mask) { + if (ifp->if_capabilities & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { /* - * We require both IPv4 and IPv6 offloading to be enabled - * in order to negotiated it: VirtIO does not distinguish - * between the two. + * VirtIO does not distinguish between the IPv4 and IPv6 + * checksums so require both. Guest TSO (LRO) requires + * Rx checksums. */ - if ((ifp->if_capenable & mask) != mask) + if ((ifp->if_capenable & + (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) == 0) { features &= ~VIRTIO_NET_F_GUEST_CSUM; + features &= ~VTNET_LRO_FEATURES; + } } if (ifp->if_capabilities & IFCAP_LRO) { @@ -3005,10 +3003,15 @@ vtnet_virtio_reinit(struct vtnet_softc *sc) } error = virtio_reinit(dev, features); - if (error) + if (error) { device_printf(dev, "virtio reinit error %d\n", error); + return (error); + } - return (error); + sc->vtnet_features = features; + virtio_reinit_complete(dev); + + return (0); } static void @@ -3019,9 +3022,7 @@ vtnet_init_rx_filters(struct vtnet_softc *sc) ifp = sc->vtnet_ifp; if (sc->vtnet_flags & VTNET_FLAG_CTRL_RX) { - /* Restore promiscuous and all-multicast modes. */ vtnet_rx_filter(sc); - /* Restore filtered MAC addresses. */ vtnet_rx_filter_mac(sc); } @@ -3130,17 +3131,25 @@ vtnet_set_active_vq_pairs(struct vtnet_softc *sc) static int vtnet_reinit(struct vtnet_softc *sc) { + device_t dev; struct ifnet *ifp; int error; + dev = sc->vtnet_dev; ifp = sc->vtnet_ifp; - /* Use the current MAC address. */ bcopy(IF_LLADDR(ifp), sc->vtnet_hwaddr, ETHER_ADDR_LEN); - vtnet_set_macaddr(sc); + error = vtnet_virtio_reinit(sc); + if (error) + return (error); + + vtnet_set_macaddr(sc); vtnet_set_active_vq_pairs(sc); + if (sc->vtnet_flags & VTNET_FLAG_CTRL_VQ) + vtnet_init_rx_filters(sc); + ifp->if_hwassist = 0; if (ifp->if_capenable & IFCAP_TXCSUM) ifp->if_hwassist |= VTNET_CSUM_OFFLOAD; @@ -3151,16 +3160,10 @@ vtnet_reinit(struct vtnet_softc *sc) if (ifp->if_capenable & IFCAP_TSO6) ifp->if_hwassist |= CSUM_IP6_TSO; - if (sc->vtnet_flags & VTNET_FLAG_CTRL_VQ) - vtnet_init_rx_filters(sc); - error = vtnet_init_rxtx_queues(sc); if (error) return (error); - vtnet_enable_interrupts(sc); - ifp->if_drv_flags |= IFF_DRV_RUNNING; - return (0); } @@ -3192,27 +3195,20 @@ vtnet_init_locked(struct vtnet_softc *sc, int init_mode) } #endif /* DEV_NETMAP */ - /* Reinitialize with the host. */ - if (vtnet_virtio_reinit(sc) != 0) - goto fail; - - if (vtnet_reinit(sc) != 0) - goto fail; - - virtio_reinit_complete(dev); + if (vtnet_reinit(sc) != 0) { + vtnet_stop(sc); + return; + } + ifp->if_drv_flags |= IFF_DRV_RUNNING; vtnet_update_link_status(sc); + vtnet_enable_interrupts(sc); callout_reset(&sc->vtnet_tick_ch, hz, vtnet_tick, sc); #ifdef DEV_NETMAP /* Re-enable txsync/rxsync. */ netmap_enable_all_rings(ifp); #endif /* DEV_NETMAP */ - - return; - -fail: - vtnet_stop(sc); } static void @@ -3247,8 +3243,8 @@ vtnet_exec_ctrl_cmd(struct vtnet_softc *sc, void *cookie, vq = sc->vtnet_ctrl_vq; - VTNET_CORE_LOCK_ASSERT(sc); MPASS(sc->vtnet_flags & VTNET_FLAG_CTRL_VQ); + VTNET_CORE_LOCK_ASSERT(sc); if (!virtqueue_empty(vq)) return; @@ -3707,19 +3703,22 @@ vtnet_get_macaddr(struct vtnet_softc *sc) static void vtnet_set_macaddr(struct vtnet_softc *sc) { + device_t dev; int error; + dev = sc->vtnet_dev; + if (sc->vtnet_flags & VTNET_FLAG_CTRL_MAC) { error = vtnet_ctrl_mac_cmd(sc, sc->vtnet_hwaddr); if (error) - if_printf(sc->vtnet_ifp, "unable to set MAC address\n"); + device_printf(dev, "unable to set MAC address\n"); return; } /* MAC in config is read-only in modern VirtIO. */ if (!vtnet_modern(sc) && sc->vtnet_flags & VTNET_FLAG_MAC) { for (int i = 0; i < ETHER_ADDR_LEN; i++) { - virtio_write_dev_config_1(sc->vtnet_dev, + virtio_write_dev_config_1(dev, offsetof(struct virtio_net_config, mac) + i, sc->vtnet_hwaddr[i]); } diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 82dd2514472d..0fd1238b2dcb 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -174,6 +174,7 @@ struct vtnet_softc { uint32_t *vtnet_vlan_filter; uint64_t vtnet_features; + uint64_t vtnet_negotiated_features; struct vtnet_statistics vtnet_stats; struct callout vtnet_tick_ch; struct ifmedia vtnet_media; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:13 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E1B444E50DB; Tue, 19 Jan 2021 05:08:13 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9m4BMfz4XDk; Tue, 19 Jan 2021 05:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B52E72066A; Tue, 19 Jan 2021 05:08:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J5882f085702; Tue, 19 Jan 2021 05:08:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J588ox085701; Tue, 19 Jan 2021 05:08:08 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:08 GMT Message-Id: <202101190508.10J588ox085701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 15be49535dce - main - virtio_scsi: Add modern (V1) support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15be49535dce17e5ad70755491162a8b6e4d5d72 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:14 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=15be49535dce17e5ad70755491162a8b6e4d5d72 commit 15be49535dce17e5ad70755491162a8b6e4d5d72 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 virtio_scsi: Add modern (V1) support Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27903 --- sys/dev/virtio/scsi/virtio_scsi.c | 61 ++++++++++++++++++++++++--------------- sys/dev/virtio/scsi/virtio_scsi.h | 39 ++++++++++++++++++++----- 2 files changed, 69 insertions(+), 31 deletions(-) diff --git a/sys/dev/virtio/scsi/virtio_scsi.c b/sys/dev/virtio/scsi/virtio_scsi.c index 332f71ef26bf..f4c716af3725 100644 --- a/sys/dev/virtio/scsi/virtio_scsi.c +++ b/sys/dev/virtio/scsi/virtio_scsi.c @@ -135,10 +135,10 @@ static int vtscsi_execute_reset_dev_cmd(struct vtscsi_softc *, static void vtscsi_get_request_lun(uint8_t [], target_id_t *, lun_id_t *); static void vtscsi_set_request_lun(struct ccb_hdr *, uint8_t []); -static void vtscsi_init_scsi_cmd_req(struct ccb_scsiio *, - struct virtio_scsi_cmd_req *); -static void vtscsi_init_ctrl_tmf_req(struct ccb_hdr *, uint32_t, - uintptr_t, struct virtio_scsi_ctrl_tmf_req *); +static void vtscsi_init_scsi_cmd_req(struct vtscsi_softc *, + struct ccb_scsiio *, struct virtio_scsi_cmd_req *); +static void vtscsi_init_ctrl_tmf_req(struct vtscsi_softc *, struct ccb_hdr *, + uint32_t, uintptr_t, struct virtio_scsi_ctrl_tmf_req *); static void vtscsi_freeze_simq(struct vtscsi_softc *, int); static int vtscsi_thaw_simq(struct vtscsi_softc *, int); @@ -189,6 +189,14 @@ static void vtscsi_add_sysctl(struct vtscsi_softc *); static void vtscsi_printf_req(struct vtscsi_request *, const char *, const char *, ...); +#define vtscsi_modern(_sc) (((_sc)->vtscsi_features & VIRTIO_F_VERSION_1) != 0) +#define vtscsi_htog16(_sc, _val) virtio_htog16(vtscsi_modern(_sc), _val) +#define vtscsi_htog32(_sc, _val) virtio_htog32(vtscsi_modern(_sc), _val) +#define vtscsi_htog64(_sc, _val) virtio_htog64(vtscsi_modern(_sc), _val) +#define vtscsi_gtoh16(_sc, _val) virtio_gtoh16(vtscsi_modern(_sc), _val) +#define vtscsi_gtoh32(_sc, _val) virtio_gtoh32(vtscsi_modern(_sc), _val) +#define vtscsi_gtoh64(_sc, _val) virtio_gtoh64(vtscsi_modern(_sc), _val) + /* Global tunables. */ /* * The current QEMU VirtIO SCSI implementation does not cancel in-flight @@ -206,6 +214,9 @@ TUNABLE_INT("hw.vtscsi.bus_reset_disable", &vtscsi_bus_reset_disable); static struct virtio_feature_desc vtscsi_feature_desc[] = { { VIRTIO_SCSI_F_INOUT, "InOut" }, { VIRTIO_SCSI_F_HOTPLUG, "Hotplug" }, + { VIRTIO_SCSI_F_CHANGE, "ChangeEvent" }, + { VIRTIO_SCSI_F_T10_PI, "T10PI" }, + { 0, NULL } }; @@ -409,8 +420,10 @@ vtscsi_negotiate_features(struct vtscsi_softc *sc) uint64_t features; dev = sc->vtscsi_dev; - features = virtio_negotiate_features(dev, VTSCSI_FEATURES); - sc->vtscsi_features = features; + features = VTSCSI_FEATURES; + + sc->vtscsi_features = virtio_negotiate_features(dev, features); + virtio_finalize_features(dev); } #define VTSCSI_GET_CONFIG(_dev, _field, _cfg) \ @@ -530,8 +543,8 @@ vtscsi_reinit(struct vtscsi_softc *sc) error = virtio_reinit(dev, sc->vtscsi_features); if (error == 0) { vtscsi_write_device_config(sc); - vtscsi_reinit_event_vq(sc); virtio_reinit_complete(dev); + vtscsi_reinit_event_vq(sc); vtscsi_enable_vqs_intr(sc); } @@ -1085,7 +1098,7 @@ vtscsi_execute_scsi_cmd(struct vtscsi_softc *sc, struct vtscsi_request *req) cmd_req = &req->vsr_cmd_req; cmd_resp = &req->vsr_cmd_resp; - vtscsi_init_scsi_cmd_req(csio, cmd_req); + vtscsi_init_scsi_cmd_req(sc, csio, cmd_req); error = vtscsi_fill_scsi_cmd_sglist(sc, req, &readable, &writable); if (error) @@ -1205,7 +1218,7 @@ vtscsi_abort_timedout_scsi_cmd(struct vtscsi_softc *sc, tmf_req = &req->vsr_tmf_req; tmf_resp = &req->vsr_tmf_resp; - vtscsi_init_ctrl_tmf_req(to_ccbh, VIRTIO_SCSI_T_TMF_ABORT_TASK, + vtscsi_init_ctrl_tmf_req(sc, to_ccbh, VIRTIO_SCSI_T_TMF_ABORT_TASK, (uintptr_t) to_ccbh, tmf_req); sglist_reset(sg); @@ -1313,22 +1326,24 @@ static cam_status vtscsi_complete_scsi_cmd_response(struct vtscsi_softc *sc, struct ccb_scsiio *csio, struct virtio_scsi_cmd_resp *cmd_resp) { + uint32_t resp_sense_length; cam_status status; csio->scsi_status = cmd_resp->status; - csio->resid = cmd_resp->resid; + csio->resid = vtscsi_htog32(sc, cmd_resp->resid); if (csio->scsi_status == SCSI_STATUS_OK) status = CAM_REQ_CMP; else status = CAM_SCSI_STATUS_ERROR; - if (cmd_resp->sense_len > 0) { + resp_sense_length = vtscsi_htog32(sc, cmd_resp->sense_len); + + if (resp_sense_length > 0) { status |= CAM_AUTOSNS_VALID; - if (cmd_resp->sense_len < csio->sense_len) - csio->sense_resid = csio->sense_len - - cmd_resp->sense_len; + if (resp_sense_length < csio->sense_len) + csio->sense_resid = csio->sense_len - resp_sense_length; else csio->sense_resid = 0; @@ -1493,7 +1508,7 @@ vtscsi_execute_abort_task_cmd(struct vtscsi_softc *sc, if (abort_req->vsr_flags & VTSCSI_REQ_FLAG_TIMEOUT_SET) callout_stop(&abort_req->vsr_callout); - vtscsi_init_ctrl_tmf_req(ccbh, VIRTIO_SCSI_T_TMF_ABORT_TASK, + vtscsi_init_ctrl_tmf_req(sc, ccbh, VIRTIO_SCSI_T_TMF_ABORT_TASK, (uintptr_t) abort_ccbh, tmf_req); sglist_reset(sg); @@ -1562,7 +1577,7 @@ vtscsi_execute_reset_dev_cmd(struct vtscsi_softc *sc, else subtype = VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET; - vtscsi_init_ctrl_tmf_req(ccbh, subtype, 0, tmf_req); + vtscsi_init_ctrl_tmf_req(sc, ccbh, subtype, 0, tmf_req); sglist_reset(sg); sglist_append(sg, tmf_req, sizeof(struct virtio_scsi_ctrl_tmf_req)); @@ -1599,7 +1614,7 @@ vtscsi_set_request_lun(struct ccb_hdr *ccbh, uint8_t lun[]) } static void -vtscsi_init_scsi_cmd_req(struct ccb_scsiio *csio, +vtscsi_init_scsi_cmd_req(struct vtscsi_softc *sc, struct ccb_scsiio *csio, struct virtio_scsi_cmd_req *cmd_req) { uint8_t attr; @@ -1620,7 +1635,7 @@ vtscsi_init_scsi_cmd_req(struct ccb_scsiio *csio, } vtscsi_set_request_lun(&csio->ccb_h, cmd_req->lun); - cmd_req->tag = (uintptr_t) csio; + cmd_req->tag = vtscsi_gtoh64(sc, (uintptr_t) csio); cmd_req->task_attr = attr; memcpy(cmd_req->cdb, @@ -1630,15 +1645,15 @@ vtscsi_init_scsi_cmd_req(struct ccb_scsiio *csio, } static void -vtscsi_init_ctrl_tmf_req(struct ccb_hdr *ccbh, uint32_t subtype, - uintptr_t tag, struct virtio_scsi_ctrl_tmf_req *tmf_req) +vtscsi_init_ctrl_tmf_req(struct vtscsi_softc *sc, struct ccb_hdr *ccbh, + uint32_t subtype, uintptr_t tag, struct virtio_scsi_ctrl_tmf_req *tmf_req) { vtscsi_set_request_lun(ccbh, tmf_req->lun); - tmf_req->type = VIRTIO_SCSI_T_TMF; - tmf_req->subtype = subtype; - tmf_req->tag = tag; + tmf_req->type = vtscsi_gtoh32(sc, VIRTIO_SCSI_T_TMF); + tmf_req->subtype = vtscsi_gtoh32(sc, subtype); + tmf_req->tag = vtscsi_gtoh64(sc, tag); } static void diff --git a/sys/dev/virtio/scsi/virtio_scsi.h b/sys/dev/virtio/scsi/virtio_scsi.h index 9a9c5232dfee..c4435559f4e6 100644 --- a/sys/dev/virtio/scsi/virtio_scsi.h +++ b/sys/dev/virtio/scsi/virtio_scsi.h @@ -31,13 +31,7 @@ #ifndef _VIRTIO_SCSI_H #define _VIRTIO_SCSI_H -/* Feature bits */ -#define VIRTIO_SCSI_F_INOUT 0x0001 /* Single request can contain both - * read and write buffers */ -#define VIRTIO_SCSI_F_HOTPLUG 0x0002 /* Host should enable hot plug/unplug - * of new LUNs and targets. - */ - +/* Default values of the CDB and sense data size configuration fields */ #define VIRTIO_SCSI_CDB_SIZE 32 #define VIRTIO_SCSI_SENSE_SIZE 96 @@ -46,8 +40,20 @@ struct virtio_scsi_cmd_req { uint8_t lun[8]; /* Logical Unit Number */ uint64_t tag; /* Command identifier */ uint8_t task_attr; /* Task attribute */ - uint8_t prio; + uint8_t prio; /* SAM command priority field */ + uint8_t crn; + uint8_t cdb[VIRTIO_SCSI_CDB_SIZE]; +} __packed; + +/* SCSI command request, followed by protection information */ +struct virtio_scsi_cmd_req_pi { + uint8_t lun[8]; /* Logical Unit Number */ + uint64_t tag; /* Command identifier */ + uint8_t task_attr; /* Task attribute */ + uint8_t prio; /* SAM command priority field */ uint8_t crn; + uint32_t pi_bytesout; /* DataOUT PI Number of bytes */ + uint32_t pi_bytesin; /* DataIN PI Number of bytes */ uint8_t cdb[VIRTIO_SCSI_CDB_SIZE]; } __packed; @@ -104,6 +110,22 @@ struct virtio_scsi_config { uint32_t max_lun; } __packed; +/* Feature bits */ +#define VIRTIO_SCSI_F_INOUT 0x0001 /* Single request can contain both + * read and write buffers. + */ +#define VIRTIO_SCSI_F_HOTPLUG 0x0002 /* Host should enable hot plug/unplug + * of new LUNs and targets. + */ +#define VIRTIO_SCSI_F_CHANGE 0x0004 /* Host will report changes to LUN + * parameters via a + * VIRTIO_SCSI_T_PARAM_CHANGE event. + */ +#define VIRTIO_SCSI_F_T10_PI 0x0008 /* Extended fields for T10 protection + * information (DIF/DIX) are included + * in the SCSI request header. + */ + /* Response codes */ #define VIRTIO_SCSI_S_OK 0 #define VIRTIO_SCSI_S_FUNCTION_COMPLETE 0 @@ -140,6 +162,7 @@ struct virtio_scsi_config { #define VIRTIO_SCSI_T_NO_EVENT 0 #define VIRTIO_SCSI_T_TRANSPORT_RESET 1 #define VIRTIO_SCSI_T_ASYNC_NOTIFY 2 +#define VIRTIO_SCSI_T_PARAM_CHANGE 3 /* Reasons of transport reset event */ #define VIRTIO_SCSI_EVT_RESET_HARD 0 From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:19 2021 Return-Path: Delivered-To: dev-commits-src-main@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 427FA4E50E4; Tue, 19 Jan 2021 05:08:19 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9t6DvNz4XHH; Tue, 19 Jan 2021 05:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5467F20B3C; Tue, 19 Jan 2021 05:08:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58EtN085808; Tue, 19 Jan 2021 05:08:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58EK0085807; Tue, 19 Jan 2021 05:08:14 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:14 GMT Message-Id: <202101190508.10J58EK0085807@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 6a73339365cf - main - if_vtnet: Support VIRTIO_NET_F_SPEED_DUPLEX MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a73339365cf625b983355e4c5d960184cd09224 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:19 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=6a73339365cf625b983355e4c5d960184cd09224 commit 6a73339365cf625b983355e4c5d960184cd09224 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 if_vtnet: Support VIRTIO_NET_F_SPEED_DUPLEX This features lets the guest driver know the speed and duplex of the "link". Instead of trying to support many media types based on the possible/likely speeds/duplexes, only use the speed to set the interface baudrate. Cleanup ifmedia code to match other drivers. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27908 --- sys/dev/virtio/network/if_vtnet.c | 55 +++++++++++++++++++++++++----------- sys/dev/virtio/network/if_vtnetvar.h | 7 +---- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index ca60e51c57d2..f20a798a16ed 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -210,6 +210,7 @@ static void vtnet_update_vlan_filter(struct vtnet_softc *, int, uint16_t); static void vtnet_register_vlan(void *, struct ifnet *, uint16_t); static void vtnet_unregister_vlan(void *, struct ifnet *, uint16_t); +static void vtnet_update_speed_duplex(struct vtnet_softc *); static int vtnet_is_link_up(struct vtnet_softc *); static void vtnet_update_link_status(struct vtnet_softc *); static int vtnet_ifmedia_upd(struct ifnet *); @@ -987,7 +988,6 @@ vtnet_setup_interface(struct vtnet_softc *sc) } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_baudrate = IF_Gbps(10); /* Approx. */ ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_KNOWSEPOCH; @@ -1005,10 +1005,19 @@ vtnet_setup_interface(struct vtnet_softc *sc) IFQ_SET_READY(&ifp->if_snd); #endif - ifmedia_init(&sc->vtnet_media, IFM_IMASK, vtnet_ifmedia_upd, - vtnet_ifmedia_sts); - ifmedia_add(&sc->vtnet_media, VTNET_MEDIATYPE, 0, NULL); - ifmedia_set(&sc->vtnet_media, VTNET_MEDIATYPE); + if (virtio_with_feature(dev, VIRTIO_NET_F_SPEED_DUPLEX)) { + uint32_t speed = virtio_read_dev_config_4(dev, + offsetof(struct virtio_net_config, speed)); + if (speed != -1) + ifp->if_baudrate = IF_Mbps(speed); + else + ifp->if_baudrate = IF_Gbps(10); /* Approx. */ + } else + ifp->if_baudrate = IF_Gbps(10); /* Approx. */ + + ifmedia_init(&sc->vtnet_media, 0, vtnet_ifmedia_upd, vtnet_ifmedia_sts); + ifmedia_add(&sc->vtnet_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->vtnet_media, IFM_ETHER | IFM_AUTO); vtnet_get_hwaddr(sc); ether_ifattach(ifp, sc->vtnet_hwaddr); @@ -3598,6 +3607,27 @@ vtnet_unregister_vlan(void *arg, struct ifnet *ifp, uint16_t tag) vtnet_update_vlan_filter(arg, 0, tag); } +static void +vtnet_update_speed_duplex(struct vtnet_softc *sc) +{ + device_t dev; + struct ifnet *ifp; + uint32_t speed; + + dev = sc->vtnet_dev; + ifp = sc->vtnet_ifp; + + /* BMV: Ignore duplex. */ + if ((sc->vtnet_features & VIRTIO_NET_F_SPEED_DUPLEX) == 0) + speed = -1; + else + speed = virtio_read_dev_config_4(dev, + offsetof(struct virtio_net_config, speed)); + + if (speed != -1) + ifp->if_baudrate = IF_Mbps(speed); +} + static int vtnet_is_link_up(struct vtnet_softc *sc) { @@ -3624,12 +3654,12 @@ vtnet_update_link_status(struct vtnet_softc *sc) int link; ifp = sc->vtnet_ifp; - VTNET_CORE_LOCK_ASSERT(sc); link = vtnet_is_link_up(sc); /* Notify if the link status has changed. */ if (link != 0 && sc->vtnet_link_active == 0) { + vtnet_update_speed_duplex(sc); sc->vtnet_link_active = 1; if_link_state_change(ifp, LINK_STATE_UP); } else if (link == 0 && sc->vtnet_link_active != 0) { @@ -3641,16 +3671,7 @@ vtnet_update_link_status(struct vtnet_softc *sc) static int vtnet_ifmedia_upd(struct ifnet *ifp) { - struct vtnet_softc *sc; - struct ifmedia *ifm; - - sc = ifp->if_softc; - ifm = &sc->vtnet_media; - - if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) - return (EINVAL); - - return (0); + return (EOPNOTSUPP); } static void @@ -3666,7 +3687,7 @@ vtnet_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) VTNET_CORE_LOCK(sc); if (vtnet_is_link_up(sc) != 0) { ifmr->ifm_status |= IFM_ACTIVE; - ifmr->ifm_active |= VTNET_MEDIATYPE; + ifmr->ifm_active |= IFM_10G_T | IFM_FDX; } else ifmr->ifm_active |= IFM_NONE; VTNET_CORE_UNLOCK(sc); diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 29a0dbbb734f..4189bb4d966f 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -211,12 +211,6 @@ vtnet_modern(struct vtnet_softc *sc) */ #define VTNET_NOTIFY_RETRIES 4 -/* - * Fake the media type. The host does not provide us with any real media - * information. - */ -#define VTNET_MEDIATYPE (IFM_ETHER | IFM_10G_T | IFM_FDX) - /* * Number of words to allocate for the VLAN shadow table. There is one * bit for each VLAN. @@ -313,6 +307,7 @@ CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE); VIRTIO_NET_F_GUEST_ECN | \ VIRTIO_NET_F_MRG_RXBUF | \ VIRTIO_NET_F_MQ | \ + VIRTIO_NET_F_SPEED_DUPLEX | \ VIRTIO_RING_F_EVENT_IDX | \ VIRTIO_RING_F_INDIRECT_DESC) From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:21 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0C03D4E5489; Tue, 19 Jan 2021 05:08:21 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9w3dQdz4XW0; Tue, 19 Jan 2021 05:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E0F220B3D; Tue, 19 Jan 2021 05:08:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58F02085826; Tue, 19 Jan 2021 05:08:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58FdV085825; Tue, 19 Jan 2021 05:08:15 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:15 GMT Message-Id: <202101190508.10J58FdV085825@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 25dbc30ef5c9 - main - if_vtnet: Remove at attach PROMISC handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25dbc30ef5c99d8251fd7c43075295ca01049c89 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:21 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=25dbc30ef5c99d8251fd7c43075295ca01049c89 commit 25dbc30ef5c99d8251fd7c43075295ca01049c89 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 if_vtnet: Remove at attach PROMISC handling This may have been required in an early, early, early version of the specification but I cannot find any reference to it, and a promiscuous default seems very odd so remove this code. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27909 --- sys/dev/virtio/network/if_vtnet.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index f20a798a16ed..4a26e403071d 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -201,7 +201,6 @@ static int vtnet_ctrl_mq_cmd(struct vtnet_softc *, uint16_t); static int vtnet_ctrl_rx_cmd(struct vtnet_softc *, uint8_t, int); static int vtnet_set_promisc(struct vtnet_softc *, int); static int vtnet_set_allmulti(struct vtnet_softc *, int); -static void vtnet_attach_disable_promisc(struct vtnet_softc *); static void vtnet_rx_filter(struct vtnet_softc *); static void vtnet_rx_filter_mac(struct vtnet_softc *); static int vtnet_exec_vlan_filter(struct vtnet_softc *, int, uint16_t); @@ -570,8 +569,6 @@ static int vtnet_attach_completed(device_t dev) { - vtnet_attach_disable_promisc(device_get_softc(dev)); - return (0); } @@ -3351,28 +3348,6 @@ vtnet_set_allmulti(struct vtnet_softc *sc, int on) return (vtnet_ctrl_rx_cmd(sc, VIRTIO_NET_CTRL_RX_ALLMULTI, on)); } -/* - * The device defaults to promiscuous mode for backwards compatibility. - * Turn it off at attach time if possible. - */ -static void -vtnet_attach_disable_promisc(struct vtnet_softc *sc) -{ - struct ifnet *ifp; - - ifp = sc->vtnet_ifp; - - VTNET_CORE_LOCK(sc); - if ((sc->vtnet_flags & VTNET_FLAG_CTRL_RX) == 0) { - ifp->if_flags |= IFF_PROMISC; - } else if (vtnet_set_promisc(sc, 0) != 0) { - ifp->if_flags |= IFF_PROMISC; - device_printf(sc->vtnet_dev, - "cannot disable default promiscuous mode\n"); - } - VTNET_CORE_UNLOCK(sc); -} - static void vtnet_rx_filter(struct vtnet_softc *sc) { From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:14 2021 Return-Path: Delivered-To: dev-commits-src-main@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 159CF4E504F; Tue, 19 Jan 2021 05:08:14 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9m5x5wz4XBR; Tue, 19 Jan 2021 05:08:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA0C720B3B; Tue, 19 Jan 2021 05:08:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58AX3085746; Tue, 19 Jan 2021 05:08:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58AJK085745; Tue, 19 Jan 2021 05:08:10 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:10 GMT Message-Id: <202101190508.10J58AJK085745@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 149ab110dd5c - main - virtio_blk: Use DISKFLAG_WRITE_PROTECT for RO disks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 149ab110dd5c9b6058142408a44ef2aa18b30037 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:14 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=149ab110dd5c9b6058142408a44ef2aa18b30037 commit 149ab110dd5c9b6058142408a44ef2aa18b30037 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 virtio_blk: Use DISKFLAG_WRITE_PROTECT for RO disks Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27905 --- sys/dev/virtio/block/virtio_blk.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c index 091eb029530e..08df77d6de5b 100644 --- a/sys/dev/virtio/block/virtio_blk.c +++ b/sys/dev/virtio/block/virtio_blk.c @@ -76,11 +76,10 @@ struct vtblk_softc { uint64_t vtblk_features; uint32_t vtblk_flags; #define VTBLK_FLAG_INDIRECT 0x0001 -#define VTBLK_FLAG_READONLY 0x0002 -#define VTBLK_FLAG_DETACH 0x0004 -#define VTBLK_FLAG_SUSPEND 0x0008 -#define VTBLK_FLAG_BARRIER 0x0010 -#define VTBLK_FLAG_WCE_CONFIG 0x0020 +#define VTBLK_FLAG_DETACH 0x0002 +#define VTBLK_FLAG_SUSPEND 0x0004 +#define VTBLK_FLAG_BARRIER 0x0008 +#define VTBLK_FLAG_WCE_CONFIG 0x0010 struct virtqueue *vtblk_vq; struct sglist *vtblk_sglist; @@ -553,17 +552,6 @@ vtblk_strategy(struct bio *bp) return; } - /* - * Fail any write if RO. Unfortunately, there does not seem to - * be a better way to report our readonly'ness to GEOM above. - */ - if (sc->vtblk_flags & VTBLK_FLAG_READONLY && - (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_FLUSH || - bp->bio_cmd == BIO_DELETE)) { - vtblk_bio_done(sc, bp, EROFS); - return; - } - if ((bp->bio_cmd != BIO_READ) && (bp->bio_cmd != BIO_WRITE) && (bp->bio_cmd != BIO_FLUSH) && (bp->bio_cmd != BIO_DELETE)) { vtblk_bio_done(sc, bp, EOPNOTSUPP); @@ -609,8 +597,6 @@ vtblk_setup_features(struct vtblk_softc *sc) if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) sc->vtblk_flags |= VTBLK_FLAG_INDIRECT; - if (virtio_with_feature(dev, VIRTIO_BLK_F_RO)) - sc->vtblk_flags |= VTBLK_FLAG_READONLY; if (virtio_with_feature(dev, VIRTIO_BLK_F_CONFIG_WCE)) sc->vtblk_flags |= VTBLK_FLAG_WCE_CONFIG; @@ -701,11 +687,13 @@ vtblk_alloc_disk(struct vtblk_softc *sc, struct virtio_blk_config *blkcfg) dp->d_hba_subvendor = virtio_get_subvendor(dev); dp->d_hba_subdevice = virtio_get_subdevice(dev); - if (virtio_with_feature(dev, VIRTIO_BLK_F_FLUSH)) - dp->d_flags |= DISKFLAG_CANFLUSHCACHE; - - if ((sc->vtblk_flags & VTBLK_FLAG_READONLY) == 0) + if (virtio_with_feature(dev, VIRTIO_BLK_F_RO)) + dp->d_flags |= DISKFLAG_WRITE_PROTECT; + else { + if (virtio_with_feature(dev, VIRTIO_BLK_F_FLUSH)) + dp->d_flags |= DISKFLAG_CANFLUSHCACHE; dp->d_dump = vtblk_dump; + } /* Capacity is always in 512-byte units. */ dp->d_mediasize = blkcfg->capacity * VTBLK_BSIZE; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:16 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B0A644E5271; Tue, 19 Jan 2021 05:08:16 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9r103wz4XBb; Tue, 19 Jan 2021 05:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FACD206E6; Tue, 19 Jan 2021 05:08:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58Cf4085764; Tue, 19 Jan 2021 05:08:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58CHd085763; Tue, 19 Jan 2021 05:08:12 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:12 GMT Message-Id: <202101190508.10J58CHd085763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: fa7ca1e33241 - main - if_vtnet: Rx path cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa7ca1e332414a8c5e05aff3e6bb17854b91cec6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:17 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=fa7ca1e332414a8c5e05aff3e6bb17854b91cec6 commit fa7ca1e332414a8c5e05aff3e6bb17854b91cec6 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 if_vtnet: Rx path cleanup - Fix the NEEDS_CSUM and DATA_VALID checksum flags. The NEEDS_CSUM checksum is incomplete (partial) so offer a fallback for the driver to calculate the checksum. Simplify DATA_VALID because we know the host has validated the checksum. - Default 4K mbuf clusters for mergeable buffers. May need to scale this down to 2K clusters in certain configurations such many queue pairs, big queues (like 4096 in GCP), and low memory. - Use the MTU when calculated the receive mbuf cluster size when not doing TSO/LRO. This will need more adjustment once the MTU feature is supported. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27906 --- sys/dev/virtio/network/if_vtnet.c | 568 +++++++++++++++++------------------ sys/dev/virtio/network/if_vtnetvar.h | 39 +-- 2 files changed, 296 insertions(+), 311 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 60b87aa16703..d90fd3bc43aa 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -86,6 +86,10 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" +#if defined(INET) || defined(INET6) +#include +#endif + static int vtnet_modevent(module_t, int, void *); static int vtnet_probe(device_t); @@ -107,7 +111,7 @@ static int vtnet_alloc_rx_filters(struct vtnet_softc *); static void vtnet_free_rx_filters(struct vtnet_softc *); static int vtnet_alloc_virtqueues(struct vtnet_softc *); static int vtnet_setup_interface(struct vtnet_softc *); -static int vtnet_change_mtu(struct vtnet_softc *, int); +static int vtnet_ioctl_mtu(struct vtnet_softc *, int); static int vtnet_ioctl(struct ifnet *, u_long, caddr_t); static uint64_t vtnet_get_counter(struct ifnet *, ift_counter); @@ -115,11 +119,15 @@ static int vtnet_rxq_populate(struct vtnet_rxq *); static void vtnet_rxq_free_mbufs(struct vtnet_rxq *); static struct mbuf * vtnet_rx_alloc_buf(struct vtnet_softc *, int , struct mbuf **); -static int vtnet_rxq_replace_lro_nomgr_buf(struct vtnet_rxq *, +static int vtnet_rxq_replace_lro_nomrg_buf(struct vtnet_rxq *, struct mbuf *, int); static int vtnet_rxq_replace_buf(struct vtnet_rxq *, struct mbuf *, int); static int vtnet_rxq_enqueue_buf(struct vtnet_rxq *, struct mbuf *); static int vtnet_rxq_new_buf(struct vtnet_rxq *); +static int vtnet_rxq_csum_needs_csum(struct vtnet_rxq *, struct mbuf *, + uint16_t, int, struct virtio_net_hdr *); +static int vtnet_rxq_csum_data_valid(struct vtnet_rxq *, struct mbuf *, + uint16_t, int, struct virtio_net_hdr *); static int vtnet_rxq_csum(struct vtnet_rxq *, struct mbuf *, struct virtio_net_hdr *); static void vtnet_rxq_discard_merged_bufs(struct vtnet_rxq *, int); @@ -243,32 +251,42 @@ DEBUGNET_DEFINE(vtnet); /* Tunables. */ static SYSCTL_NODE(_hw, OID_AUTO, vtnet, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, - "VNET driver parameters"); + "VirtIO Net driver parameters"); + static int vtnet_csum_disable = 0; TUNABLE_INT("hw.vtnet.csum_disable", &vtnet_csum_disable); SYSCTL_INT(_hw_vtnet, OID_AUTO, csum_disable, CTLFLAG_RDTUN, &vtnet_csum_disable, 0, "Disables receive and send checksum offload"); + +static int vtnet_fixup_needs_csum = 0; +SYSCTL_INT(_hw_vtnet, OID_AUTO, fixup_needs_csum, CTLFLAG_RDTUN, + &vtnet_fixup_needs_csum, 0, + "Calculate valid checksum for NEEDS_CSUM packets"); + static int vtnet_tso_disable = 0; TUNABLE_INT("hw.vtnet.tso_disable", &vtnet_tso_disable); SYSCTL_INT(_hw_vtnet, OID_AUTO, tso_disable, CTLFLAG_RDTUN, &vtnet_tso_disable, 0, "Disables TCP Segmentation Offload"); + static int vtnet_lro_disable = 0; TUNABLE_INT("hw.vtnet.lro_disable", &vtnet_lro_disable); SYSCTL_INT(_hw_vtnet, OID_AUTO, lro_disable, CTLFLAG_RDTUN, &vtnet_lro_disable, 0, "Disables TCP Large Receive Offload"); + static int vtnet_mq_disable = 0; TUNABLE_INT("hw.vtnet.mq_disable", &vtnet_mq_disable); SYSCTL_INT(_hw_vtnet, OID_AUTO, mq_disable, CTLFLAG_RDTUN, &vtnet_mq_disable, - 0, "Disables Multi Queue support"); + 0, "Disables multiqueue support"); + static int vtnet_mq_max_pairs = VTNET_MAX_QUEUE_PAIRS; TUNABLE_INT("hw.vtnet.mq_max_pairs", &vtnet_mq_max_pairs); SYSCTL_INT(_hw_vtnet, OID_AUTO, mq_max_pairs, CTLFLAG_RDTUN, - &vtnet_mq_max_pairs, 0, "Sets the maximum number of Multi Queue pairs"); -static int vtnet_rx_process_limit = 512; + &vtnet_mq_max_pairs, 0, "Sets the maximum number of multiqueue pairs"); + +static int vtnet_rx_process_limit = 1024; TUNABLE_INT("hw.vtnet.rx_process_limit", &vtnet_rx_process_limit); SYSCTL_INT(_hw_vtnet, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, - &vtnet_rx_process_limit, 0, - "Limits the number RX segments processed in a single pass"); + &vtnet_rx_process_limit, 0, "Limits RX segments processed in a single pass"); static uma_zone_t vtnet_tx_header_zone; @@ -617,9 +635,8 @@ vtnet_negotiate_features(struct vtnet_softc *sc) */ if (!virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) { device_printf(dev, - "LRO disabled due to both mergeable buffers and " - "indirect descriptors not negotiated\n"); - + "LRO disabled since both mergeable buffers and " + "indirect descriptors were not negotiated\n"); features &= ~VTNET_LRO_FEATURES; sc->vtnet_features = virtio_negotiate_features(dev, features); @@ -655,31 +672,24 @@ vtnet_setup_features(struct vtnet_softc *sc) sc->vtnet_flags |= VTNET_FLAG_MRG_RXBUFS; sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf); } else if (vtnet_modern(sc)) { - /* - * The V1 header is the same size and layout as the mergeable - * buffer header, but num_buffers will always be one. Depending - * on the context, the driver uses the mergeable header for - * either case. - */ + /* This is identical to the mergeable header. */ sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr_v1); } else sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr); - if (sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) - sc->vtnet_rx_nsegs = VTNET_MRG_RX_SEGS; - else if (vtnet_modern(sc)) /* TODO: And ANY_LAYOUT when supported */ - sc->vtnet_rx_nsegs = VTNET_MODERN_RX_SEGS; + if (vtnet_modern(sc) || sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) + sc->vtnet_rx_nsegs = VTNET_RX_SEGS_HDR_INLINE; else if (sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG) - sc->vtnet_rx_nsegs = VTNET_MAX_RX_SEGS; + sc->vtnet_rx_nsegs = VTNET_RX_SEGS_LRO_NOMRG; else - sc->vtnet_rx_nsegs = VTNET_MIN_RX_SEGS; + sc->vtnet_rx_nsegs = VTNET_RX_SEGS_HDR_SEPARATE; if (virtio_with_feature(dev, VIRTIO_NET_F_GSO) || virtio_with_feature(dev, VIRTIO_NET_F_HOST_TSO4) || virtio_with_feature(dev, VIRTIO_NET_F_HOST_TSO6)) - sc->vtnet_tx_nsegs = VTNET_MAX_TX_SEGS; + sc->vtnet_tx_nsegs = VTNET_TX_SEGS_MAX; else - sc->vtnet_tx_nsegs = VTNET_MIN_TX_SEGS; + sc->vtnet_tx_nsegs = VTNET_TX_SEGS_MIN; sc->vtnet_max_vq_pairs = 1; @@ -944,7 +954,7 @@ vtnet_alloc_virtqueues(struct vtnet_softc *sc) /* * TODO: Enable interrupt binding if this is multiqueue. This will - * only matter when per-vq MSIX is available. + * only matter when per-virtqueue MSIX is available. */ if (sc->vtnet_flags & VTNET_FLAG_MQ) flags |= 0; @@ -1024,6 +1034,10 @@ vtnet_setup_interface(struct vtnet_softc *sc) if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) { ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; + if (vtnet_tunable_int(sc, "fixup_needs_csum", + vtnet_fixup_needs_csum) != 0) + sc->vtnet_flags |= VTNET_FLAG_FIXUP_NEEDS_CSUM; + if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6) || virtio_with_feature(dev, VIRTIO_NET_F_GUEST_ECN)) @@ -1069,42 +1083,59 @@ vtnet_setup_interface(struct vtnet_softc *sc) return (0); } -/* BMV: This needs rethinking. */ static int -vtnet_change_mtu(struct vtnet_softc *sc, int new_mtu) +vtnet_rx_cluster_size(struct vtnet_softc *sc, int mtu) +{ + int framesz; + + if (sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) + return (MJUMPAGESIZE); + else if (sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG) + return (MCLBYTES); + + /* + * Try to scale the receive mbuf cluster size from the MTU. Without + * the GUEST_TSO[46] features, the VirtIO specification says the + * driver must only be able to receive ~1500 byte frames. But if + * jumbo frames can be transmitted then try to receive jumbo. + */ + if (vtnet_modern(sc)) { + MPASS(sc->vtnet_hdr_size == sizeof(struct virtio_net_hdr_v1)); + framesz = sizeof(struct virtio_net_hdr_v1); + } else + framesz = sizeof(struct vtnet_rx_header); + framesz += sizeof(struct ether_vlan_header) + mtu; + + if (framesz <= MCLBYTES) + return (MCLBYTES); + else if (framesz <= MJUMPAGESIZE) + return (MJUMPAGESIZE); + else if (framesz <= MJUM9BYTES) + return (MJUM9BYTES); + + /* Sane default; avoid 16KB clusters. */ + return (MCLBYTES); +} + +static int +vtnet_ioctl_mtu(struct vtnet_softc *sc, int mtu) { struct ifnet *ifp; - int frame_size, clustersz; + int clustersz; ifp = sc->vtnet_ifp; + VTNET_CORE_LOCK_ASSERT(sc); - if (new_mtu < ETHERMIN || new_mtu > VTNET_MAX_MTU) + if (ifp->if_mtu == mtu) + return (0); + else if (mtu < ETHERMIN || mtu > VTNET_MAX_MTU) return (EINVAL); - frame_size = sc->vtnet_hdr_size; - frame_size += sizeof(struct ether_vlan_header) + new_mtu; + ifp->if_mtu = mtu; + clustersz = vtnet_rx_cluster_size(sc, mtu); - /* - * Based on the new MTU, determine which cluster size is appropriate - * for the receive queues. - * - * BMV: This likely needs rethinking wrt LRO enabled/disabled and - * the size of the virtqueue. - */ - if (frame_size <= MCLBYTES) - clustersz = MCLBYTES; - else if (sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) - clustersz = MJUMPAGESIZE; - else { - if (frame_size > MJUM9BYTES) - return (EINVAL); - clustersz = MJUM9BYTES; - } - - ifp->if_mtu = new_mtu; - sc->vtnet_rx_new_clustersz = clustersz; - - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (clustersz != sc->vtnet_rx_clustersz && + ifp->if_drv_flags & IFF_DRV_RUNNING) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; vtnet_init_locked(sc, 0); } @@ -1125,11 +1156,9 @@ vtnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) switch (cmd) { case SIOCSIFMTU: - if (ifp->if_mtu != ifr->ifr_mtu) { - VTNET_CORE_LOCK(sc); - error = vtnet_change_mtu(sc, ifr->ifr_mtu); - VTNET_CORE_UNLOCK(sc); - } + VTNET_CORE_LOCK(sc); + error = vtnet_ioctl_mtu(sc, ifr->ifr_mtu); + VTNET_CORE_UNLOCK(sc); break; case SIOCSIFFLAGS: @@ -1160,7 +1189,7 @@ vtnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCADDMULTI: case SIOCDELMULTI: VTNET_CORE_LOCK(sc); - if (sc->vtnet_flags & VTNET_FLAG_CTRL_RX && + if (sc->vtnet_flags & VTNET_FLAG_CTRL_RX && ifp->if_drv_flags & IFF_DRV_RUNNING) vtnet_rx_filter_mac(sc); VTNET_CORE_UNLOCK(sc); @@ -1289,53 +1318,45 @@ static struct mbuf * vtnet_rx_alloc_buf(struct vtnet_softc *sc, int nbufs, struct mbuf **m_tailp) { struct mbuf *m_head, *m_tail, *m; - int i, clustersz; + int i, size; - clustersz = sc->vtnet_rx_clustersz; + m_head = NULL; + size = sc->vtnet_rx_clustersz; KASSERT(nbufs == 1 || sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG, - ("%s: chained mbuf %d request without LRO_NOMRG", __func__, nbufs)); + ("%s: mbuf %d chain requested without LRO_NOMRG", __func__, nbufs)); - m_head = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, clustersz); - if (m_head == NULL) - goto fail; - - m_head->m_len = clustersz; - m_tail = m_head; - - /* Allocate the rest of the chain. */ - for (i = 1; i < nbufs; i++) { - m = m_getjcl(M_NOWAIT, MT_DATA, 0, clustersz); - if (m == NULL) - goto fail; + for (i = 0; i < nbufs; i++) { + m = m_getjcl(M_NOWAIT, MT_DATA, i == 0 ? M_PKTHDR : 0, size); + if (m == NULL) { + sc->vtnet_stats.mbuf_alloc_failed++; + m_freem(m_head); + return (NULL); + } - m->m_len = clustersz; - m_tail->m_next = m; - m_tail = m; + m->m_len = size; + if (m_head != NULL) { + m_tail->m_next = m; + m_tail = m; + } else + m_head = m_tail = m; } if (m_tailp != NULL) *m_tailp = m_tail; return (m_head); - -fail: - sc->vtnet_stats.mbuf_alloc_failed++; - m_freem(m_head); - - return (NULL); } /* * Slow path for when LRO without mergeable buffers is negotiated. */ static int -vtnet_rxq_replace_lro_nomgr_buf(struct vtnet_rxq *rxq, struct mbuf *m0, +vtnet_rxq_replace_lro_nomrg_buf(struct vtnet_rxq *rxq, struct mbuf *m0, int len0) { struct vtnet_softc *sc; - struct mbuf *m, *m_prev; - struct mbuf *m_new, *m_tail; + struct mbuf *m, *m_prev, *m_new, *m_tail; int len, clustersz, nreplace, error; sc = rxq->vtnrx_sc; @@ -1349,25 +1370,23 @@ vtnet_rxq_replace_lro_nomgr_buf(struct vtnet_rxq *rxq, struct mbuf *m0, len = len0; /* - * Since these mbuf chains are so large, we avoid allocating an - * entire replacement chain if possible. When the received frame - * did not consume the entire chain, the unused mbufs are moved - * to the replacement chain. + * Since these mbuf chains are so large, avoid allocating a complete + * replacement when the received frame did not consume the entire + * chain. Unused mbufs are moved to the tail of the replacement mbuf. */ while (len > 0) { - /* - * Something is seriously wrong if we received a frame - * larger than the chain. Drop it. - */ if (m == NULL) { sc->vtnet_stats.rx_frame_too_large++; return (EMSGSIZE); } - /* We always allocate the same cluster size. */ + /* + * Every mbuf should have the expected cluster size since that + * is also used to allocate the replacements. + */ KASSERT(m->m_len == clustersz, - ("%s: mbuf size %d is not the cluster size %d", - __func__, m->m_len, clustersz)); + ("%s: mbuf size %d not expected cluster size %d", __func__, + m->m_len, clustersz)); m->m_len = MIN(m->m_len, len); len -= m->m_len; @@ -1377,9 +1396,9 @@ vtnet_rxq_replace_lro_nomgr_buf(struct vtnet_rxq *rxq, struct mbuf *m0, nreplace++; } - KASSERT(nreplace <= sc->vtnet_rx_nmbufs, - ("%s: too many replacement mbufs %d max %d", __func__, nreplace, - sc->vtnet_rx_nmbufs)); + KASSERT(nreplace > 0 && nreplace <= sc->vtnet_rx_nmbufs, + ("%s: invalid replacement mbuf count %d max %d", __func__, + nreplace, sc->vtnet_rx_nmbufs)); m_new = vtnet_rx_alloc_buf(sc, nreplace, &m_tail); if (m_new == NULL) { @@ -1388,8 +1407,8 @@ vtnet_rxq_replace_lro_nomgr_buf(struct vtnet_rxq *rxq, struct mbuf *m0, } /* - * Move any unused mbufs from the received chain onto the end - * of the new chain. + * Move any unused mbufs from the received mbuf chain onto the + * end of the replacement chain. */ if (m_prev->m_next != NULL) { m_tail->m_next = m_prev->m_next; @@ -1399,21 +1418,18 @@ vtnet_rxq_replace_lro_nomgr_buf(struct vtnet_rxq *rxq, struct mbuf *m0, error = vtnet_rxq_enqueue_buf(rxq, m_new); if (error) { /* - * BAD! We could not enqueue the replacement mbuf chain. We - * must restore the m0 chain to the original state if it was - * modified so we can subsequently discard it. + * The replacement is suppose to be an copy of the one + * dequeued so this is a very unexpected error. * - * NOTE: The replacement is suppose to be an identical copy - * to the one just dequeued so this is an unexpected error. + * Restore the m0 chain to the original state if it was + * modified so we can then discard it. */ - sc->vtnet_stats.rx_enq_replacement_failed++; - if (m_tail->m_next != NULL) { m_prev->m_next = m_tail->m_next; m_tail->m_next = NULL; } - m_prev->m_len = clustersz; + sc->vtnet_stats.rx_enq_replacement_failed++; m_freem(m_new); } @@ -1429,31 +1445,23 @@ vtnet_rxq_replace_buf(struct vtnet_rxq *rxq, struct mbuf *m, int len) sc = rxq->vtnrx_sc; - KASSERT(sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG || m->m_next == NULL, - ("%s: chained mbuf without LRO_NOMRG", __func__)); + if (sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG) + return (vtnet_rxq_replace_lro_nomrg_buf(rxq, m, len)); - if (m->m_next == NULL) { - /* Fast-path for the common case of just one mbuf. */ - if (m->m_len < len) - return (EINVAL); + MPASS(m->m_next == NULL); + if (m->m_len < len) + return (EMSGSIZE); - m_new = vtnet_rx_alloc_buf(sc, 1, NULL); - if (m_new == NULL) - return (ENOBUFS); + m_new = vtnet_rx_alloc_buf(sc, 1, NULL); + if (m_new == NULL) + return (ENOBUFS); - error = vtnet_rxq_enqueue_buf(rxq, m_new); - if (error) { - /* - * The new mbuf is suppose to be an identical - * copy of the one just dequeued so this is an - * unexpected error. - */ - m_freem(m_new); - sc->vtnet_stats.rx_enq_replacement_failed++; - } else - m->m_len = len; + error = vtnet_rxq_enqueue_buf(rxq, m_new); + if (error) { + sc->vtnet_stats.rx_enq_replacement_failed++; + m_freem(m_new); } else - error = vtnet_rxq_replace_lro_nomgr_buf(rxq, m, len); + m->m_len = len; return (error); } @@ -1463,33 +1471,36 @@ vtnet_rxq_enqueue_buf(struct vtnet_rxq *rxq, struct mbuf *m) { struct vtnet_softc *sc; struct sglist *sg; - int error; + int header_inlined, error; sc = rxq->vtnrx_sc; sg = rxq->vtnrx_sg; KASSERT(m->m_next == NULL || sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG, ("%s: mbuf chain without LRO_NOMRG", __func__)); - KASSERT(m->m_len == sc->vtnet_rx_clustersz, ("%s: unexpected mbuf " - "length %d %d", __func__, m->m_len, sc->vtnet_rx_clustersz)); VTNET_RXQ_LOCK_ASSERT(rxq); sglist_reset(sg); - if (vtnet_modern(sc) || sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) { - error = sglist_append_mbuf(sg, m); - } else { - struct vtnet_rx_header *rxhdr; + header_inlined = vtnet_modern(sc) || + (sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) != 0; /* TODO: ANY_LAYOUT */ - rxhdr = mtod(m, struct vtnet_rx_header *); + if (header_inlined) + error = sglist_append_mbuf(sg, m); + else { + struct vtnet_rx_header *rxhdr = + mtod(m, struct vtnet_rx_header *); MPASS(sc->vtnet_hdr_size == sizeof(struct virtio_net_hdr)); - /* Append inlined header and then rest of the mbuf chain. */ + /* Append the header and remaining mbuf data. */ error = sglist_append(sg, &rxhdr->vrh_hdr, sc->vtnet_hdr_size); - if (error == 0) { - error = sglist_append(sg, &rxhdr[1], - m->m_len - sizeof(struct vtnet_rx_header)); - } - if (error == 0 && m->m_next != NULL) + if (error) + return (error); + error = sglist_append(sg, &rxhdr[1], + m->m_len - sizeof(struct vtnet_rx_header)); + if (error) + return (error); + + if (m->m_next != NULL) error = sglist_append_mbuf(sg, m->m_next); } @@ -1519,54 +1530,73 @@ vtnet_rxq_new_buf(struct vtnet_rxq *rxq) return (error); } -/* - * Use the checksum offset in the VirtIO header to set the - * correct CSUM_* flags. - */ static int -vtnet_rxq_csum_by_offset(struct vtnet_rxq *rxq, struct mbuf *m, - uint16_t eth_type, int ip_start, struct virtio_net_hdr *hdr) +vtnet_rxq_csum_needs_csum(struct vtnet_rxq *rxq, struct mbuf *m, uint16_t etype, + int hoff, struct virtio_net_hdr *hdr) { struct vtnet_softc *sc; -#if defined(INET) || defined(INET6) - int offset = hdr->csum_start + hdr->csum_offset; -#endif + int error; sc = rxq->vtnrx_sc; - /* Only do a basic sanity check on the offset. */ - switch (eth_type) { -#if defined(INET) - case ETHERTYPE_IP: - if (__predict_false(offset < ip_start + sizeof(struct ip))) - return (1); - break; -#endif -#if defined(INET6) - case ETHERTYPE_IPV6: - if (__predict_false(offset < ip_start + sizeof(struct ip6_hdr))) - return (1); - break; -#endif - default: - sc->vtnet_stats.rx_csum_bad_ethtype++; - return (1); + /* + * NEEDS_CSUM corresponds to Linux's CHECKSUM_PARTIAL, but FreeBSD does + * not have an analogous CSUM flag. The checksum has been validated, + * but is incomplete (TCP/UDP pseudo header). + * + * The packet is likely from another VM on the same host that itself + * performed checksum offloading so Tx/Rx is basically a memcpy and + * the checksum has little value. + * + * Default to receiving the packet as-is for performance reasons, but + * this can cause issues if the packet is to be forwarded because it + * does not contain a valid checksum. This patch may be helpful: + * https://reviews.freebsd.org/D6611. In the meantime, have the driver + * compute the checksum if requested. + * + * BMV: Need to add an CSUM_PARTIAL flag? + */ + if ((sc->vtnet_flags & VTNET_FLAG_FIXUP_NEEDS_CSUM) == 0) { + error = vtnet_rxq_csum_data_valid(rxq, m, etype, hoff, hdr); + return (error); } /* - * Use the offset to determine the appropriate CSUM_* flags. This is - * a bit dirty, but we can get by with it since the checksum offsets - * happen to be different. We assume the host host does not do IPv4 - * header checksum offloading. + * Compute the checksum in the driver so the packet will contain a + * valid checksum. The checksum is at csum_offset from csum_start. */ - switch (hdr->csum_offset) { - case offsetof(struct udphdr, uh_sum): - case offsetof(struct tcphdr, th_sum): + switch (etype) { +#if defined(INET) || defined(INET6) + case ETHERTYPE_IP: + case ETHERTYPE_IPV6: { + int csum_off, csum_end; + uint16_t csum; + + csum_off = hdr->csum_start + hdr->csum_offset; + csum_end = csum_off + sizeof(uint16_t); + + /* Assume checksum will be in the first mbuf. */ + if (m->m_len < csum_end || m->m_pkthdr.len < csum_end) + return (1); + + /* + * Like in_delayed_cksum()/in6_delayed_cksum(), compute the + * checksum and write it at the specified offset. We could + * try to verify the packet: csum_start should probably + * correspond to the start of the TCP/UDP header. + * + * BMV: Need to properly handle UDP with zero checksum. Is + * the IPv4 header checksum implicitly validated? + */ + csum = in_cksum_skip(m, m->m_pkthdr.len, hdr->csum_start); + *(uint16_t *)(mtodo(m, csum_off)) = csum; m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xFFFF; break; + } +#endif default: - sc->vtnet_stats.rx_csum_bad_offset++; + sc->vtnet_stats.rx_csum_bad_ethtype++; return (1); } @@ -1574,64 +1604,55 @@ vtnet_rxq_csum_by_offset(struct vtnet_rxq *rxq, struct mbuf *m, } static int -vtnet_rxq_csum_by_parse(struct vtnet_rxq *rxq, struct mbuf *m, - uint16_t eth_type, int ip_start, struct virtio_net_hdr *hdr) +vtnet_rxq_csum_data_valid(struct vtnet_rxq *rxq, struct mbuf *m, + uint16_t etype, int hoff, struct virtio_net_hdr *hdr) { struct vtnet_softc *sc; - int offset, proto; + int protocol; sc = rxq->vtnrx_sc; - switch (eth_type) { + switch (etype) { #if defined(INET) - case ETHERTYPE_IP: { - struct ip *ip; - if (__predict_false(m->m_len < ip_start + sizeof(struct ip))) - return (1); - ip = (struct ip *)(m->m_data + ip_start); - proto = ip->ip_p; - offset = ip_start + (ip->ip_hl << 2); + case ETHERTYPE_IP: + if (__predict_false(m->m_len < hoff + sizeof(struct ip))) + protocol = IPPROTO_DONE; + else { + struct ip *ip = (struct ip *)(m->m_data + hoff); + protocol = ip->ip_p; + } break; - } #endif #if defined(INET6) case ETHERTYPE_IPV6: - if (__predict_false(m->m_len < ip_start + - sizeof(struct ip6_hdr))) - return (1); - offset = ip6_lasthdr(m, ip_start, IPPROTO_IPV6, &proto); - if (__predict_false(offset < 0)) - return (1); + if (__predict_false(m->m_len < hoff + sizeof(struct ip6_hdr)) + || ip6_lasthdr(m, hoff, IPPROTO_IPV6, &protocol) < 0) + protocol = IPPROTO_DONE; break; #endif default: - sc->vtnet_stats.rx_csum_bad_ethtype++; - return (1); + protocol = IPPROTO_DONE; + break; } - switch (proto) { + switch (protocol) { case IPPROTO_TCP: - if (__predict_false(m->m_len < offset + sizeof(struct tcphdr))) - return (1); - m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - m->m_pkthdr.csum_data = 0xFFFF; - break; case IPPROTO_UDP: - if (__predict_false(m->m_len < offset + sizeof(struct udphdr))) - return (1); m->m_pkthdr.csum_flags |= CSUM_DATA_VALID | CSUM_PSEUDO_HDR; m->m_pkthdr.csum_data = 0xFFFF; break; default: /* - * For the remaining protocols, FreeBSD does not support - * checksum offloading, so the checksum will be recomputed. + * FreeBSD does not support checksum offloading of this + * protocol. Let the stack re-verify the checksum later + * if the protocol is supported. */ #if 0 - if_printf(sc->vtnet_ifp, "cksum offload of unsupported " - "protocol eth_type=%#x proto=%d csum_start=%d " - "csum_offset=%d\n", __func__, eth_type, proto, - hdr->csum_start, hdr->csum_offset); + if_printf(sc->vtnet_ifp, + "%s: checksum offload of unsupported protocol " + "etype=%#x protocol=%d csum_start=%d csum_offset=%d\n", + __func__, etype, protocol, hdr->csum_start, + hdr->csum_offset); #endif break; } @@ -1639,41 +1660,29 @@ vtnet_rxq_csum_by_parse(struct vtnet_rxq *rxq, struct mbuf *m, return (0); } -/* - * Set the appropriate CSUM_* flags. Unfortunately, the information - * provided is not directly useful to us. The VirtIO header gives the - * offset of the checksum, which is all Linux needs, but this is not - * how FreeBSD does things. We are forced to peek inside the packet - * a bit. - * - * It would be nice if VirtIO gave us the L4 protocol or if FreeBSD - * could accept the offsets and let the stack figure it out. - */ static int vtnet_rxq_csum(struct vtnet_rxq *rxq, struct mbuf *m, struct virtio_net_hdr *hdr) { - struct ether_header *eh; - struct ether_vlan_header *evh; - uint16_t eth_type; - int offset, error; - - eh = mtod(m, struct ether_header *); - eth_type = ntohs(eh->ether_type); - if (eth_type == ETHERTYPE_VLAN) { - /* BMV: We should handle nested VLAN tags too. */ - evh = mtod(m, struct ether_vlan_header *); - eth_type = ntohs(evh->evl_proto); - offset = sizeof(struct ether_vlan_header); + const struct ether_header *eh; + int hoff; + uint16_t etype; + + eh = mtod(m, const struct ether_header *); + etype = ntohs(eh->ether_type); + if (etype == ETHERTYPE_VLAN) { + /* TODO BMV: Handle QinQ. */ + const struct ether_vlan_header *evh = + mtod(m, const struct ether_vlan_header *); + etype = ntohs(evh->evl_proto); + hoff = sizeof(struct ether_vlan_header); } else - offset = sizeof(struct ether_header); + hoff = sizeof(struct ether_header); if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) - error = vtnet_rxq_csum_by_offset(rxq, m, eth_type, offset, hdr); - else - error = vtnet_rxq_csum_by_parse(rxq, m, eth_type, offset, hdr); - - return (error); + return (vtnet_rxq_csum_needs_csum(rxq, m, etype, hoff, hdr)); + else /* VIRTIO_NET_HDR_F_DATA_VALID */ + return (vtnet_rxq_csum_data_valid(rxq, m, etype, hoff, hdr)); } static void @@ -1708,14 +1717,16 @@ vtnet_rxq_merged_eof(struct vtnet_rxq *rxq, struct mbuf *m_head, int nbufs) { struct vtnet_softc *sc; struct virtqueue *vq; - struct mbuf *m, *m_tail; - int len; + struct mbuf *m_tail; sc = rxq->vtnrx_sc; vq = rxq->vtnrx_vq; m_tail = m_head; while (--nbufs > 0) { + struct mbuf *m; + int len; + m = virtqueue_dequeue(vq, &len); if (m == NULL) { rxq->vtnrx_stats.vrxs_ierrors++; @@ -1756,13 +1767,12 @@ vtnet_rxq_input(struct vtnet_rxq *rxq, struct mbuf *m, { struct vtnet_softc *sc; struct ifnet *ifp; - struct ether_header *eh; sc = rxq->vtnrx_sc; ifp = sc->vtnet_ifp; if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { - eh = mtod(m, struct ether_header *); + struct ether_header *eh = mtod(m, struct ether_header *); if (eh->ether_type == htons(ETHERTYPE_VLAN)) { vtnet_vlan_tag_remove(m); /* @@ -1777,13 +1787,8 @@ vtnet_rxq_input(struct vtnet_rxq *rxq, struct mbuf *m, m->m_pkthdr.flowid = rxq->vtnrx_id; M_HASHTYPE_SET(m, M_HASHTYPE_OPAQUE); - /* - * BMV: FreeBSD does not have the UNNECESSARY and PARTIAL checksum - * distinction that Linux does. Need to reevaluate if performing - * offloading for the NEEDS_CSUM case is really appropriate. - */ - if (hdr->flags & (VIRTIO_NET_HDR_F_NEEDS_CSUM | - VIRTIO_NET_HDR_F_DATA_VALID)) { + if (hdr->flags & + (VIRTIO_NET_HDR_F_NEEDS_CSUM | VIRTIO_NET_HDR_F_DATA_VALID)) { if (vtnet_rxq_csum(rxq, m, hdr) == 0) rxq->vtnrx_stats.vrxs_csum++; else @@ -1805,8 +1810,7 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) struct vtnet_softc *sc; struct ifnet *ifp; struct virtqueue *vq; - struct mbuf *m; - int len, deq, nbufs, adjsz, count; + int deq, count; sc = rxq->vtnrx_sc; vq = rxq->vtnrx_vq; @@ -1817,6 +1821,9 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) VTNET_RXQ_LOCK_ASSERT(rxq); while (count-- > 0) { + struct mbuf *m; + int len, nbufs, adjsz; + m = virtqueue_dequeue(vq, &len); if (m == NULL) break; @@ -1828,20 +1835,21 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) continue; } - if (vtnet_modern(sc) || - sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) { - /* - * For our purposes here, the V1 header is the same as - * the mergeable buffers header. - */ + if (sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) { struct virtio_net_hdr_mrg_rxbuf *mhdr = mtod(m, struct virtio_net_hdr_mrg_rxbuf *); nbufs = vtnet_htog16(sc, mhdr->num_buffers); adjsz = sizeof(struct virtio_net_hdr_mrg_rxbuf); + } else if (vtnet_modern(sc)) { + nbufs = 1; /* num_buffers is always 1 */ + adjsz = sizeof(struct virtio_net_hdr_v1); } else { nbufs = 1; adjsz = sizeof(struct vtnet_rx_header); - /* Our pad between the header and start of the frame. */ + /* + * Account for our gap between the header and start of + * data to keep the segments separated. + */ len += VTNET_RX_HEADER_PAD; } @@ -1865,9 +1873,9 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) /* * Save an endian swapped version of the header prior to it - * being stripped. For both mergeable and non-mergeable, the - * header is at the start of the mbuf data. num_buffers was - * already saved (and longer need it) so use a regular header. + * being stripped. The header is always at the start of the + * mbuf data. num_buffers was already saved (and not needed) + * so use the standard header. */ hdr = mtod(m, struct virtio_net_hdr *); lhdr.flags = hdr->flags; @@ -2986,31 +2994,24 @@ static int vtnet_init_rx_queues(struct vtnet_softc *sc) { device_t dev; + struct ifnet *ifp; struct vtnet_rxq *rxq; int i, clustersz, error; dev = sc->vtnet_dev; + ifp = sc->vtnet_ifp; - /* - * Use the new cluster size if one has been set (via a MTU - * change). Otherwise, use the standard 2K clusters. - * - * BMV: It might make sense to use page sized clusters as - * the default (depending on the features negotiated). - */ - if (sc->vtnet_rx_new_clustersz != 0) { - clustersz = sc->vtnet_rx_new_clustersz; - sc->vtnet_rx_new_clustersz = 0; - } else - clustersz = MCLBYTES; - + clustersz = vtnet_rx_cluster_size(sc, ifp->if_mtu); sc->vtnet_rx_clustersz = clustersz; - sc->vtnet_rx_nmbufs = VTNET_NEEDED_RX_MBUFS(sc, clustersz); - KASSERT(sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS || - sc->vtnet_rx_nmbufs < sc->vtnet_rx_nsegs, - ("%s: too many rx mbufs %d for %d segments", __func__, - sc->vtnet_rx_nmbufs, sc->vtnet_rx_nsegs)); + if (sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG) { + sc->vtnet_rx_nmbufs = howmany(sizeof(struct vtnet_rx_header) + + VTNET_MAX_RX_SIZE, clustersz); + KASSERT(sc->vtnet_rx_nmbufs < sc->vtnet_rx_nsegs, + ("%s: too many rx mbufs %d for %d segments", __func__, + sc->vtnet_rx_nmbufs, sc->vtnet_rx_nsegs)); + } else + sc->vtnet_rx_nmbufs = 1; for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { rxq = &sc->vtnet_rxqs[i]; @@ -3021,8 +3022,7 @@ vtnet_init_rx_queues(struct vtnet_softc *sc) VTNET_RXQ_UNLOCK(rxq); if (error) { - device_printf(dev, - "cannot allocate mbufs for Rx queue %d\n", i); + device_printf(dev, "cannot populate Rx queue %d\n", i); return (error); } } diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 662eea8c88c8..eaf6eaf8d504 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -153,6 +153,7 @@ struct vtnet_softc { #define VTNET_FLAG_INDIRECT 0x0400 #define VTNET_FLAG_EVENT_IDX 0x0800 *** 73 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:26 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1E3E64E5509; Tue, 19 Jan 2021 05:08:26 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcB06r0Lz4XNF; Tue, 19 Jan 2021 05:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F294C20CE6; Tue, 19 Jan 2021 05:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58J4c085910; Tue, 19 Jan 2021 05:08:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58J25085909; Tue, 19 Jan 2021 05:08:19 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:19 GMT Message-Id: <202101190508.10J58J25085909@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 32e0493c9245 - main - if_vtnet: Cleanup the interface setup methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 32e0493c92458dc885167e5e3d76b2918ff72c24 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:26 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=32e0493c92458dc885167e5e3d76b2918ff72c24 commit 32e0493c92458dc885167e5e3d76b2918ff72c24 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Cleanup the interface setup methods Defer the ether_ifattach until the interface capabilities are configured Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27913 --- sys/dev/virtio/network/if_vtnet.c | 59 ++++++++++++++------------------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index ec1fc8de1a90..33d421b32b1f 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -827,6 +827,7 @@ vtnet_alloc_rxtx_queues(struct vtnet_softc *sc) return (error); } + vtnet_set_rx_process_limit(sc); vtnet_setup_queue_sysctl(sc); return (0); @@ -996,6 +997,7 @@ vtnet_setup_interface(struct vtnet_softc *sc) ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_KNOWSEPOCH; + ifp->if_baudrate = IF_Gbps(10); ifp->if_init = vtnet_init; ifp->if_ioctl = vtnet_ioctl; ifp->if_get_counter = vtnet_get_counter; @@ -1010,29 +1012,15 @@ vtnet_setup_interface(struct vtnet_softc *sc) IFQ_SET_READY(&ifp->if_snd); #endif - if (virtio_with_feature(dev, VIRTIO_NET_F_SPEED_DUPLEX)) { - uint32_t speed = virtio_read_dev_config_4(dev, - offsetof(struct virtio_net_config, speed)); - if (speed != -1) - ifp->if_baudrate = IF_Mbps(speed); - else - ifp->if_baudrate = IF_Gbps(10); /* Approx. */ - } else - ifp->if_baudrate = IF_Gbps(10); /* Approx. */ - - ifmedia_init(&sc->vtnet_media, 0, vtnet_ifmedia_upd, vtnet_ifmedia_sts); - ifmedia_add(&sc->vtnet_media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_set(&sc->vtnet_media, IFM_ETHER | IFM_AUTO); - vtnet_get_macaddr(sc); - ether_ifattach(ifp, sc->vtnet_hwaddr); - - /* Tell the upper layer(s) we support long frames. */ - ifp->if_hdrlen = sizeof(struct ether_vlan_header); if (virtio_with_feature(dev, VIRTIO_NET_F_STATUS)) ifp->if_capabilities |= IFCAP_LINKSTATE; + ifmedia_init(&sc->vtnet_media, 0, vtnet_ifmedia_upd, vtnet_ifmedia_sts); + ifmedia_add(&sc->vtnet_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->vtnet_media, IFM_ETHER | IFM_AUTO); + if (virtio_with_feature(dev, VIRTIO_NET_F_CSUM)) { int gso; @@ -1063,7 +1051,7 @@ vtnet_setup_interface(struct vtnet_softc *sc) ifp->if_capabilities |= IFCAP_LRO; } - if (ifp->if_capabilities & IFCAP_HWCSUM) { + if (ifp->if_capabilities & (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6)) { /* * VirtIO does not support VLAN tagging, but we can fake * it by inserting and removing the 802.1Q header during @@ -1078,11 +1066,11 @@ vtnet_setup_interface(struct vtnet_softc *sc) ifp->if_capabilities |= IFCAP_JUMBO_MTU; ifp->if_capabilities |= IFCAP_VLAN_MTU; - ifp->if_capenable = ifp->if_capabilities; - /* * Capabilities after here are not enabled by default. */ + ifp->if_capenable = ifp->if_capabilities; + if (sc->vtnet_flags & VTNET_FLAG_VLAN_FILTER) { ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; @@ -1092,7 +1080,10 @@ vtnet_setup_interface(struct vtnet_softc *sc) vtnet_unregister_vlan, sc, EVENTHANDLER_PRI_FIRST); } - vtnet_set_rx_process_limit(sc); + ether_ifattach(ifp, sc->vtnet_hwaddr); + + /* Tell the upper layer(s) we support long frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); DEBUGNET_SET(ifp, vtnet); @@ -3623,20 +3614,17 @@ vtnet_unregister_vlan(void *arg, struct ifnet *ifp, uint16_t tag) static void vtnet_update_speed_duplex(struct vtnet_softc *sc) { - device_t dev; struct ifnet *ifp; uint32_t speed; - dev = sc->vtnet_dev; ifp = sc->vtnet_ifp; - /* BMV: Ignore duplex. */ if ((sc->vtnet_features & VIRTIO_NET_F_SPEED_DUPLEX) == 0) - speed = -1; - else - speed = virtio_read_dev_config_4(dev, - offsetof(struct virtio_net_config, speed)); + return; + /* BMV: Ignore duplex. */ + speed = virtio_read_dev_config_4(sc->vtnet_dev, + offsetof(struct virtio_net_config, speed)); if (speed != -1) ifp->if_baudrate = IF_Mbps(speed); } @@ -3644,18 +3632,13 @@ vtnet_update_speed_duplex(struct vtnet_softc *sc) static int vtnet_is_link_up(struct vtnet_softc *sc) { - device_t dev; - struct ifnet *ifp; uint16_t status; - dev = sc->vtnet_dev; - ifp = sc->vtnet_ifp; + if ((sc->vtnet_features & VIRTIO_NET_F_STATUS) == 0) + return (1); - if ((ifp->if_capabilities & IFCAP_LINKSTATE) == 0) - status = VIRTIO_NET_S_LINK_UP; - else - status = virtio_read_dev_config_2(dev, - offsetof(struct virtio_net_config, status)); + status = virtio_read_dev_config_2(sc->vtnet_dev, + offsetof(struct virtio_net_config, status)); return ((status & VIRTIO_NET_S_LINK_UP) != 0); } From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:24 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A72E04E534B; Tue, 19 Jan 2021 05:08:24 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9z3MHhz4XW9; Tue, 19 Jan 2021 05:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C16C820CE5; Tue, 19 Jan 2021 05:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58IdY085890; Tue, 19 Jan 2021 05:08:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58Il5085889; Tue, 19 Jan 2021 05:08:18 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:18 GMT Message-Id: <202101190508.10J58Il5085889@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 2520cd382151 - main - if_vtnet: Only set IFCAP_JUMBO_MTU when jumbo MTU is supported MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2520cd382151a0dd698f23d7eff78f8253cdb657 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:25 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=2520cd382151a0dd698f23d7eff78f8253cdb657 commit 2520cd382151a0dd698f23d7eff78f8253cdb657 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 if_vtnet: Only set IFCAP_JUMBO_MTU when jumbo MTU is supported Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27912 --- sys/dev/virtio/network/if_vtnet.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 39009a1de3f0..ec1fc8de1a90 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -1027,12 +1027,11 @@ vtnet_setup_interface(struct vtnet_softc *sc) vtnet_get_macaddr(sc); ether_ifattach(ifp, sc->vtnet_hwaddr); - if (virtio_with_feature(dev, VIRTIO_NET_F_STATUS)) - ifp->if_capabilities |= IFCAP_LINKSTATE; - /* Tell the upper layer(s) we support long frames. */ ifp->if_hdrlen = sizeof(struct ether_vlan_header); - ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU; + + if (virtio_with_feature(dev, VIRTIO_NET_F_STATUS)) + ifp->if_capabilities |= IFCAP_LINKSTATE; if (virtio_with_feature(dev, VIRTIO_NET_F_CSUM)) { int gso; @@ -1075,6 +1074,10 @@ vtnet_setup_interface(struct vtnet_softc *sc) IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM; } + if (sc->vtnet_max_mtu >= ETHERMTU_JUMBO) + ifp->if_capabilities |= IFCAP_JUMBO_MTU; + ifp->if_capabilities |= IFCAP_VLAN_MTU; + ifp->if_capenable = ifp->if_capabilities; /* From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:33 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D08864E559B; Tue, 19 Jan 2021 05:08:33 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcB75Cqnz4XRF; Tue, 19 Jan 2021 05:08:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA55720CE8; Tue, 19 Jan 2021 05:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58RuS086056; Tue, 19 Jan 2021 05:08:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58R5C086055; Tue, 19 Jan 2021 05:08:27 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:27 GMT Message-Id: <202101190508.10J58R5C086055@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: bd8809df20be - main - if_vtnet: Limit allocations of unused virtqueues MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd8809df20beff55d28d556d891170290d44b28f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:34 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=bd8809df20beff55d28d556d891170290d44b28f commit bd8809df20beff55d28d556d891170290d44b28f Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Limit allocations of unused virtqueues For multiqueue, we may use fewer than the provided maximum number of queues. Try to limit allocations of the unused queues: no interrupts, no indirect descriptors, and no taskqueues. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27921 --- sys/dev/virtio/network/if_vtnet.c | 40 ++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 425c79da9428..a9dc3fad96a5 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -758,6 +758,7 @@ vtnet_setup_features(struct vtnet_softc *sc) else sc->vtnet_tx_nsegs = VTNET_TX_SEGS_MIN; + sc->vtnet_req_vq_pairs = 1; sc->vtnet_max_vq_pairs = 1; if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_VQ)) { @@ -785,8 +786,10 @@ vtnet_setup_features(struct vtnet_softc *sc) * number of CPUs and the configured maximum. */ req = vtnet_tunable_int(sc, "mq_max_pairs", vtnet_mq_max_pairs); - if (req < 1) + if (req < 0) req = 1; + if (req == 0) + req = mp_ncpus; if (req > sc->vtnet_max_vq_pairs) req = sc->vtnet_max_vq_pairs; if (req > mp_ncpus) @@ -1014,16 +1017,27 @@ vtnet_alloc_virtqueues(struct vtnet_softc *sc) if (info == NULL) return (ENOMEM); - for (i = 0, idx = 0; i < sc->vtnet_max_vq_pairs; i++, idx += 2) { + for (i = 0, idx = 0; i < sc->vtnet_req_vq_pairs; i++, idx += 2) { rxq = &sc->vtnet_rxqs[i]; VQ_ALLOC_INFO_INIT(&info[idx], sc->vtnet_rx_nsegs, vtnet_rx_vq_intr, rxq, &rxq->vtnrx_vq, - "%s-%d rx", device_get_nameunit(dev), rxq->vtnrx_id); + "%s-rx%d", device_get_nameunit(dev), rxq->vtnrx_id); txq = &sc->vtnet_txqs[i]; VQ_ALLOC_INFO_INIT(&info[idx+1], sc->vtnet_tx_nsegs, vtnet_tx_vq_intr, txq, &txq->vtntx_vq, - "%s-%d tx", device_get_nameunit(dev), txq->vtntx_id); + "%s-tx%d", device_get_nameunit(dev), txq->vtntx_id); + } + + /* These queues will not be used so allocate the minimum resources. */ + for (/**/; i < sc->vtnet_max_vq_pairs; i++, idx += 2) { + rxq = &sc->vtnet_rxqs[i]; + VQ_ALLOC_INFO_INIT(&info[idx], 0, NULL, rxq, &rxq->vtnrx_vq, + "%s-rx%d", device_get_nameunit(dev), rxq->vtnrx_id); + + txq = &sc->vtnet_txqs[i]; + VQ_ALLOC_INFO_INIT(&info[idx+1], 0, NULL, txq, &txq->vtntx_vq, + "%s-tx%d", device_get_nameunit(dev), txq->vtntx_id); } if (sc->vtnet_flags & VTNET_FLAG_CTRL_VQ) { @@ -3006,7 +3020,7 @@ vtnet_start_taskqueues(struct vtnet_softc *sc) * Most drivers just ignore the return value - it only fails * with ENOMEM so an error is not likely. */ - for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { + for (i = 0; i < sc->vtnet_req_vq_pairs; i++) { rxq = &sc->vtnet_rxqs[i]; error = taskqueue_start_threads(&rxq->vtnrx_tq, 1, PI_NET, "%s rxq %d", device_get_nameunit(dev), rxq->vtnrx_id); @@ -3076,7 +3090,7 @@ vtnet_drain_rxtx_queues(struct vtnet_softc *sc) struct vtnet_txq *txq; int i; - for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { + for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { rxq = &sc->vtnet_rxqs[i]; vtnet_rxq_free_mbufs(rxq); @@ -3289,8 +3303,8 @@ vtnet_set_active_vq_pairs(struct vtnet_softc *sc) npairs = sc->vtnet_req_vq_pairs; if (vtnet_ctrl_mq_cmd(sc, npairs) != 0) { - device_printf(dev, - "cannot set active queue pairs to %d\n", npairs); + device_printf(dev, "cannot set active queue pairs to %d, " + "falling back to 1 queue pair\n", npairs); npairs = 1; } @@ -4083,7 +4097,7 @@ vtnet_setup_queue_sysctl(struct vtnet_softc *sc) tree = device_get_sysctl_tree(dev); child = SYSCTL_CHILDREN(tree); - for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { + for (i = 0; i < sc->vtnet_req_vq_pairs; i++) { vtnet_setup_rxq_sysctl(ctx, child, &sc->vtnet_rxqs[i]); vtnet_setup_txq_sysctl(ctx, child, &sc->vtnet_txqs[i]); } @@ -4278,7 +4292,7 @@ vtnet_disable_rx_interrupts(struct vtnet_softc *sc) { int i; - for (i = 0; i < sc->vtnet_act_vq_pairs; i++) + for (i = 0; i < sc->vtnet_max_vq_pairs; i++) vtnet_rxq_disable_intr(&sc->vtnet_rxqs[i]); } @@ -4287,7 +4301,7 @@ vtnet_disable_tx_interrupts(struct vtnet_softc *sc) { int i; - for (i = 0; i < sc->vtnet_act_vq_pairs; i++) + for (i = 0; i < sc->vtnet_max_vq_pairs; i++) vtnet_txq_disable_intr(&sc->vtnet_txqs[i]); } @@ -4320,7 +4334,7 @@ vtnet_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) sc = if_getsoftc(ifp); VTNET_CORE_LOCK(sc); - *nrxr = sc->vtnet_max_vq_pairs; + *nrxr = sc->vtnet_req_vq_pairs; *ncl = DEBUGNET_MAX_IN_FLIGHT; *clsize = sc->vtnet_rx_clustersz; VTNET_CORE_UNLOCK(sc); @@ -4362,7 +4376,7 @@ vtnet_debugnet_poll(struct ifnet *ifp, int count) return (EBUSY); (void)vtnet_txq_eof(&sc->vtnet_txqs[0]); - for (i = 0; i < sc->vtnet_max_vq_pairs; i++) + for (i = 0; i < sc->vtnet_act_vq_pairs; i++) (void)vtnet_rxq_eof(&sc->vtnet_rxqs[i]); return (0); } From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0DD7D4E52CA; Tue, 19 Jan 2021 05:08:22 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKc9w5bmZz4XBt; Tue, 19 Jan 2021 05:08:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 892842066C; Tue, 19 Jan 2021 05:08:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58GGq085848; Tue, 19 Jan 2021 05:08:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58GkG085847; Tue, 19 Jan 2021 05:08:16 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:16 GMT Message-Id: <202101190508.10J58GkG085847@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 05041794d06f - main - if_vtnet: Defer updating generated MAC address until attached MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 05041794d06f973cf6b4fb3b14a90718656f7f5a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:22 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=05041794d06f973cf6b4fb3b14a90718656f7f5a commit 05041794d06f973cf6b4fb3b14a90718656f7f5a Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:24 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:24 +0000 if_vtnet: Defer updating generated MAC address until attached This improves spec compliance because the driver is not suppose to notify the device prior to setting the DRIVER_OK status, which could happen with the VIRTIO_NET_F_CTRL_MAC_ADDR. The VIRTIO_NET_F_MAC feature should always be negotiated so would be a rare situation. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27910 --- sys/dev/virtio/network/if_vtnet.c | 60 ++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 4a26e403071d..f55bd59ef749 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -214,8 +214,9 @@ static int vtnet_is_link_up(struct vtnet_softc *); static void vtnet_update_link_status(struct vtnet_softc *); static int vtnet_ifmedia_upd(struct ifnet *); static void vtnet_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static void vtnet_get_hwaddr(struct vtnet_softc *); -static void vtnet_set_hwaddr(struct vtnet_softc *); +static void vtnet_get_macaddr(struct vtnet_softc *); +static void vtnet_set_macaddr(struct vtnet_softc *); +static void vtnet_attached_set_macaddr(struct vtnet_softc *); static void vtnet_vlan_tag_remove(struct mbuf *); static void vtnet_set_rx_process_limit(struct vtnet_softc *); static void vtnet_set_tx_intr_threshold(struct vtnet_softc *); @@ -568,6 +569,13 @@ vtnet_shutdown(device_t dev) static int vtnet_attach_completed(device_t dev) { + struct vtnet_softc *sc; + + sc = device_get_softc(dev); + + VTNET_CORE_LOCK(sc); + vtnet_attached_set_macaddr(sc); + VTNET_CORE_UNLOCK(sc); return (0); } @@ -1016,7 +1024,7 @@ vtnet_setup_interface(struct vtnet_softc *sc) ifmedia_add(&sc->vtnet_media, IFM_ETHER | IFM_AUTO, 0, NULL); ifmedia_set(&sc->vtnet_media, IFM_ETHER | IFM_AUTO); - vtnet_get_hwaddr(sc); + vtnet_get_macaddr(sc); ether_ifattach(ifp, sc->vtnet_hwaddr); if (virtio_with_feature(dev, VIRTIO_NET_F_STATUS)) @@ -3108,7 +3116,7 @@ vtnet_reinit(struct vtnet_softc *sc) /* Use the current MAC address. */ bcopy(IF_LLADDR(ifp), sc->vtnet_hwaddr, ETHER_ADDR_LEN); - vtnet_set_hwaddr(sc); + vtnet_set_macaddr(sc); vtnet_set_active_vq_pairs(sc); @@ -3669,22 +3677,36 @@ vtnet_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) } static void -vtnet_set_hwaddr(struct vtnet_softc *sc) +vtnet_get_macaddr(struct vtnet_softc *sc) { - device_t dev; - dev = sc->vtnet_dev; + if (sc->vtnet_flags & VTNET_FLAG_MAC) { + virtio_read_device_config_array(sc->vtnet_dev, + offsetof(struct virtio_net_config, mac), + &sc->vtnet_hwaddr[0], sizeof(uint8_t), ETHER_ADDR_LEN); + } else { + /* Generate a random locally administered unicast address. */ + sc->vtnet_hwaddr[0] = 0xB2; + arc4rand(&sc->vtnet_hwaddr[1], ETHER_ADDR_LEN - 1, 0); + } +} + +static void +vtnet_set_macaddr(struct vtnet_softc *sc) +{ + int error; if (sc->vtnet_flags & VTNET_FLAG_CTRL_MAC) { - if (vtnet_ctrl_mac_cmd(sc, sc->vtnet_hwaddr) != 0) - device_printf(dev, "unable to set MAC address\n"); + error = vtnet_ctrl_mac_cmd(sc, sc->vtnet_hwaddr); + if (error) + if_printf(sc->vtnet_ifp, "unable to set MAC address\n"); return; } - /* In modern VirtIO the MAC config is read-only. */ + /* MAC in config is read-only in modern VirtIO. */ if (!vtnet_modern(sc) && sc->vtnet_flags & VTNET_FLAG_MAC) { for (int i = 0; i < ETHER_ADDR_LEN; i++) { - virtio_write_dev_config_1(dev, + virtio_write_dev_config_1(sc->vtnet_dev, offsetof(struct virtio_net_config, mac) + i, sc->vtnet_hwaddr[i]); } @@ -3692,20 +3714,12 @@ vtnet_set_hwaddr(struct vtnet_softc *sc) } static void -vtnet_get_hwaddr(struct vtnet_softc *sc) +vtnet_attached_set_macaddr(struct vtnet_softc *sc) { - if (sc->vtnet_flags & VTNET_FLAG_MAC) { - virtio_read_device_config_array(sc->vtnet_dev, - offsetof(struct virtio_net_config, mac), - &sc->vtnet_hwaddr[0], sizeof(uint8_t), ETHER_ADDR_LEN); - } else { - /* Generate a random locally administered unicast address. */ - sc->vtnet_hwaddr[0] = 0xB2; - arc4rand(&sc->vtnet_hwaddr[1], ETHER_ADDR_LEN - 1, 0); - /* BMV: FIXME Cannot do before DRIVER_OK! See 3.1.2 */ - vtnet_set_hwaddr(sc); - } + /* Assign MAC address if it was generated. */ + if ((sc->vtnet_flags & VTNET_FLAG_MAC) == 0) + vtnet_set_macaddr(sc); } static void From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:27 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7CA524E54A1; Tue, 19 Jan 2021 05:08:27 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcB255myz4XQt; Tue, 19 Jan 2021 05:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3109B20B3F; Tue, 19 Jan 2021 05:08:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58MHt085954; Tue, 19 Jan 2021 05:08:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58M19085953; Tue, 19 Jan 2021 05:08:22 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:22 GMT Message-Id: <202101190508.10J58M19085953@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: dc9029d863dc - main - if_vtnet: Move ioctl handlers into separate functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc9029d863dcc48efebb6a31a25553a7459132aa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:27 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=dc9029d863dcc48efebb6a31a25553a7459132aa commit dc9029d863dcc48efebb6a31a25553a7459132aa Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Move ioctl handlers into separate functions Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27914 https://reviews.freebsd.org/D27915 --- sys/dev/virtio/network/if_vtnet.c | 168 ++++++++++++++++++++++++-------------- 1 file changed, 106 insertions(+), 62 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index d0c98afe5b20..876dc1e152c4 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -112,6 +112,9 @@ static void vtnet_free_rx_filters(struct vtnet_softc *); static int vtnet_alloc_virtqueues(struct vtnet_softc *); static int vtnet_setup_interface(struct vtnet_softc *); static int vtnet_ioctl_mtu(struct vtnet_softc *, int); +static int vtnet_ioctl_ifflags(struct vtnet_softc *); +static int vtnet_ioctl_multi(struct vtnet_softc *); +static int vtnet_ioctl_ifcap(struct vtnet_softc *, struct ifreq *); static int vtnet_ioctl(struct ifnet *, u_long, caddr_t); static uint64_t vtnet_get_counter(struct ifnet *, ift_counter); @@ -1158,12 +1161,111 @@ vtnet_ioctl_mtu(struct vtnet_softc *sc, int mtu) return (0); } +static int +vtnet_ioctl_ifflags(struct vtnet_softc *sc) +{ + struct ifnet *ifp; + int drv_running; + + ifp = sc->vtnet_ifp; + drv_running = (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0; + + VTNET_CORE_LOCK_ASSERT(sc); + + if ((ifp->if_flags & IFF_UP) == 0) { + if (drv_running) + vtnet_stop(sc); + goto out; + } + + if (!drv_running) { + vtnet_init_locked(sc, 0); + goto out; + } + + if ((ifp->if_flags ^ sc->vtnet_if_flags) & + (IFF_PROMISC | IFF_ALLMULTI)) { + if ((sc->vtnet_flags & VTNET_FLAG_CTRL_RX) == 0) + return (ENOTSUP); + vtnet_rx_filter(sc); + } + +out: + sc->vtnet_if_flags = ifp->if_flags; + return (0); +} + +static int +vtnet_ioctl_multi(struct vtnet_softc *sc) +{ + struct ifnet *ifp; + + ifp = sc->vtnet_ifp; + + VTNET_CORE_LOCK_ASSERT(sc); + + if (sc->vtnet_flags & VTNET_FLAG_CTRL_RX && + ifp->if_drv_flags & IFF_DRV_RUNNING) + vtnet_rx_filter_mac(sc); + + return (0); +} + +static int +vtnet_ioctl_ifcap(struct vtnet_softc *sc, struct ifreq *ifr) +{ + struct ifnet *ifp; + int mask, reinit; + + ifp = sc->vtnet_ifp; + mask = (ifr->ifr_reqcap & ifp->if_capabilities) ^ ifp->if_capenable; + + VTNET_CORE_LOCK_ASSERT(sc); + + if (mask & IFCAP_TXCSUM) + ifp->if_capenable ^= IFCAP_TXCSUM; + if (mask & IFCAP_TXCSUM_IPV6) + ifp->if_capenable ^= IFCAP_TXCSUM_IPV6; + if (mask & IFCAP_TSO4) + ifp->if_capenable ^= IFCAP_TSO4; + if (mask & IFCAP_TSO6) + ifp->if_capenable ^= IFCAP_TSO6; + + if (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO | + IFCAP_VLAN_HWFILTER)) { + /* These Rx features require us to renegotiate. */ + reinit = 1; + + if (mask & IFCAP_RXCSUM) + ifp->if_capenable ^= IFCAP_RXCSUM; + if (mask & IFCAP_RXCSUM_IPV6) + ifp->if_capenable ^= IFCAP_RXCSUM_IPV6; + if (mask & IFCAP_LRO) + ifp->if_capenable ^= IFCAP_LRO; + if (mask & IFCAP_VLAN_HWFILTER) + ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; + } else + reinit = 0; + + if (mask & IFCAP_VLAN_HWTSO) + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; + if (mask & IFCAP_VLAN_HWTAGGING) + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + + if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + vtnet_init_locked(sc, 0); + } + + return (0); +} + static int vtnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct vtnet_softc *sc; struct ifreq *ifr; - int reinit, mask, error; + int error; sc = ifp->if_softc; ifr = (struct ifreq *) data; @@ -1178,35 +1280,14 @@ vtnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFFLAGS: VTNET_CORE_LOCK(sc); - if ((ifp->if_flags & IFF_UP) == 0) { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) - vtnet_stop(sc); - } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - if ((ifp->if_flags ^ sc->vtnet_if_flags) & - (IFF_PROMISC | IFF_ALLMULTI)) { - if (sc->vtnet_flags & VTNET_FLAG_CTRL_RX) - vtnet_rx_filter(sc); - else { - ifp->if_flags |= IFF_PROMISC; - if ((ifp->if_flags ^ sc->vtnet_if_flags) - & IFF_ALLMULTI) - error = ENOTSUP; - } - } - } else - vtnet_init_locked(sc, 0); - - if (error == 0) - sc->vtnet_if_flags = ifp->if_flags; + error = vtnet_ioctl_ifflags(sc); VTNET_CORE_UNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: VTNET_CORE_LOCK(sc); - if (sc->vtnet_flags & VTNET_FLAG_CTRL_RX && - ifp->if_drv_flags & IFF_DRV_RUNNING) - vtnet_rx_filter_mac(sc); + error = vtnet_ioctl_multi(sc); VTNET_CORE_UNLOCK(sc); break; @@ -1217,46 +1298,9 @@ vtnet_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFCAP: VTNET_CORE_LOCK(sc); - mask = ifr->ifr_reqcap ^ ifp->if_capenable; - - if (mask & IFCAP_TXCSUM) - ifp->if_capenable ^= IFCAP_TXCSUM; - if (mask & IFCAP_TXCSUM_IPV6) - ifp->if_capenable ^= IFCAP_TXCSUM_IPV6; - if (mask & IFCAP_TSO4) - ifp->if_capenable ^= IFCAP_TSO4; - if (mask & IFCAP_TSO6) - ifp->if_capenable ^= IFCAP_TSO6; - - if (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO | - IFCAP_VLAN_HWFILTER)) { - /* These Rx features require us to renegotiate. */ - reinit = 1; - - if (mask & IFCAP_RXCSUM) - ifp->if_capenable ^= IFCAP_RXCSUM; - if (mask & IFCAP_RXCSUM_IPV6) - ifp->if_capenable ^= IFCAP_RXCSUM_IPV6; - if (mask & IFCAP_LRO) - ifp->if_capenable ^= IFCAP_LRO; - if (mask & IFCAP_VLAN_HWFILTER) - ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; - } else - reinit = 0; - - if (mask & IFCAP_VLAN_HWTSO) - ifp->if_capenable ^= IFCAP_VLAN_HWTSO; - if (mask & IFCAP_VLAN_HWTAGGING) - ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; - - if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) { - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - vtnet_init_locked(sc, 0); - } - + error = vtnet_ioctl_ifcap(sc, ifr); VTNET_CORE_UNLOCK(sc); VLAN_CAPABILITIES(ifp); - break; default: From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:37 2021 Return-Path: Delivered-To: dev-commits-src-main@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 22F284E5601; Tue, 19 Jan 2021 05:08:37 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcBD4NtHz4XX9; Tue, 19 Jan 2021 05:08:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57D5E20BA5; Tue, 19 Jan 2021 05:08:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58Wlo086140; Tue, 19 Jan 2021 05:08:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58WHt086139; Tue, 19 Jan 2021 05:08:32 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:32 GMT Message-Id: <202101190508.10J58WHt086139@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 74cd316a09e8 - main - if_vtnet: Resort softc fields MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74cd316a09e8e5ae237278695329a97b9827559c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:37 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=74cd316a09e8e5ae237278695329a97b9827559c commit 74cd316a09e8e5ae237278695329a97b9827559c Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Resort softc fields Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27925 --- sys/dev/virtio/network/if_vtnetvar.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 7781e1c9b398..c9403c0dbb0e 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -140,6 +140,7 @@ struct vtnet_softc { struct vtnet_rxq *vtnet_rxqs; struct vtnet_txq *vtnet_txqs; pfil_head_t vtnet_pfil; + uint64_t vtnet_features; uint32_t vtnet_flags; #define VTNET_FLAG_MODERN 0x0001 @@ -158,18 +159,18 @@ struct vtnet_softc { #define VTNET_FLAG_FIXUP_NEEDS_CSUM 0x2000 #define VTNET_FLAG_SW_LRO 0x4000 - int vtnet_link_active; int vtnet_hdr_size; - int vtnet_rx_process_limit; - int vtnet_rx_nsegs; int vtnet_rx_nmbufs; int vtnet_rx_clustersz; - int vtnet_tx_nsegs; - int vtnet_if_flags; - int vtnet_max_mtu; + int vtnet_rx_nsegs; + int vtnet_rx_process_limit; + int vtnet_link_active; int vtnet_act_vq_pairs; int vtnet_req_vq_pairs; int vtnet_max_vq_pairs; + int vtnet_tx_nsegs; + int vtnet_if_flags; + int vtnet_max_mtu; int vtnet_lro_entry_count; int vtnet_lro_mbufq_depth; @@ -177,7 +178,6 @@ struct vtnet_softc { struct vtnet_mac_filter *vtnet_mac_filter; uint32_t *vtnet_vlan_filter; - uint64_t vtnet_features; uint64_t vtnet_negotiated_features; struct vtnet_statistics vtnet_stats; struct callout vtnet_tick_ch; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 CCC214E5374; Tue, 19 Jan 2021 05:08:38 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcBF1rfNz4XG1; Tue, 19 Jan 2021 05:08:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 77565208E8; Tue, 19 Jan 2021 05:08:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58Xa8086160; Tue, 19 Jan 2021 05:08:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58XRV086159; Tue, 19 Jan 2021 05:08:33 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:33 GMT Message-Id: <202101190508.10J58XRV086159@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 6b53aeed9162 - main - if_vtnet: Set lro_nsegs for host LRO packets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b53aeed9162c258ae8516cdc11ac2b66a9edd93 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:39 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=6b53aeed9162c258ae8516cdc11ac2b66a9edd93 commit 6b53aeed9162c258ae8516cdc11ac2b66a9edd93 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Set lro_nsegs for host LRO packets Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27933 --- sys/dev/virtio/network/if_vtnet.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index ad53f3d24e02..3da945baab63 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2010,6 +2010,16 @@ vtnet_rxq_input(struct vtnet_rxq *rxq, struct mbuf *m, rxq->vtnrx_stats.vrxs_csum_failed++; } + if (hdr->gso_size != 0) { + switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { + case VIRTIO_NET_HDR_GSO_TCPV4: + case VIRTIO_NET_HDR_GSO_TCPV6: + m->m_pkthdr.lro_nsegs = + howmany(m->m_pkthdr.len, hdr->gso_size); + break; + } + } + rxq->vtnrx_stats.vrxs_ipackets++; rxq->vtnrx_stats.vrxs_ibytes += m->m_pkthdr.len; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:36 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A40754E551E; Tue, 19 Jan 2021 05:08:36 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcBB2PCLz4XJY; Tue, 19 Jan 2021 05:08:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1749220B40; Tue, 19 Jan 2021 05:08:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58Uhw086098; Tue, 19 Jan 2021 05:08:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58UiY086095; Tue, 19 Jan 2021 05:08:30 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:30 GMT Message-Id: <202101190508.10J58UiY086095@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 4f18e23f8432 - main - if_vtnet: Schedule Rx task if pending items when enabling interrupt MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f18e23f84320fb126ce3ccc899aa3f99b7ae925 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:36 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=4f18e23f84320fb126ce3ccc899aa3f99b7ae925 commit 4f18e23f84320fb126ce3ccc899aa3f99b7ae925 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Schedule Rx task if pending items when enabling interrupt Prior to V1, the driver would enable interrupts and then notify the host that DRIVER_OK. Since for V1, DRIVER_OK needs to be set before notifying the virtqueues, there may be items in the queues waiting to be processed by the time interrupts are enabled. This fixes a bug where the Rx queue would appear stuck, only being usable after an interface down/up cycle. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27922 --- sys/dev/virtio/network/if_vtnet.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index e3a42413d5cd..dc232d769fa6 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -3120,11 +3120,13 @@ vtnet_stop_rendezvous(struct vtnet_softc *sc) struct vtnet_txq *txq; int i; + VTNET_CORE_LOCK_ASSERT(sc); + /* * Lock and unlock the per-queue mutex so we known the stop * state is visible. Doing only the active queues should be * sufficient, but it does not cost much extra to do all the - * queues. Note we hold the core mutex here too. + * queues. */ for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { rxq = &sc->vtnet_rxqs[i]; @@ -3168,8 +3170,8 @@ vtnet_stop(struct vtnet_softc *sc) virtio_stop(dev); vtnet_stop_rendezvous(sc); - /* Free any mbufs left in the virtqueues. */ vtnet_drain_rxtx_queues(sc); + sc->vtnet_act_vq_pairs = 1; } static int @@ -4278,10 +4280,14 @@ vtnet_txq_disable_intr(struct vtnet_txq *txq) static void vtnet_enable_rx_interrupts(struct vtnet_softc *sc) { + struct vtnet_rxq *rxq; int i; - for (i = 0; i < sc->vtnet_act_vq_pairs; i++) - vtnet_rxq_enable_intr(&sc->vtnet_rxqs[i]); + for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { + rxq = &sc->vtnet_rxqs[i]; + if (vtnet_rxq_enable_intr(rxq) != 0) + taskqueue_enqueue(rxq->vtnrx_tq, &rxq->vtnrx_intrtask); + } } static void From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:32 2021 Return-Path: Delivered-To: dev-commits-src-main@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 209DB4E54B4; Tue, 19 Jan 2021 05:08:32 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcB63hYfz4XCN; Tue, 19 Jan 2021 05:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADC1A208E5; Tue, 19 Jan 2021 05:08:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58QIF086034; Tue, 19 Jan 2021 05:08:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58QXe086033; Tue, 19 Jan 2021 05:08:26 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:26 GMT Message-Id: <202101190508.10J58QXe086033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: b470419ea52a - main - if_vtnet: Rework 4be723f63 max multiqueue pairs check MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b470419ea52ae5c93ac9892b2ed48aba0e7b4047 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:32 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=b470419ea52ae5c93ac9892b2ed48aba0e7b4047 commit b470419ea52ae5c93ac9892b2ed48aba0e7b4047 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Rework 4be723f63 max multiqueue pairs check Verify the max_virtqueue_pairs is within the range allowed by the spec. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27920 --- sys/dev/virtio/network/if_vtnet.c | 48 +++++++++++++++++++++++------------- sys/dev/virtio/network/if_vtnetvar.h | 2 +- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 6f1ef8506009..425c79da9428 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -657,6 +657,21 @@ vtnet_negotiate_features(struct vtnet_softc *sc) negotiated_features = virtio_negotiate_features(dev, features); + if (virtio_with_feature(dev, VIRTIO_NET_F_MQ)) { + uint16_t npairs; + + npairs = virtio_read_dev_config_2(dev, + offsetof(struct virtio_net_config, max_virtqueue_pairs)); + if (npairs < VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN || + npairs > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX) { + device_printf(dev, "Invalid max_virtqueue_pairs value: " + "%d. Multiqueue feature disabled.\n", npairs); + features &= ~VIRTIO_NET_F_MQ; + negotiated_features = + virtio_negotiate_features(dev, features); + } + } + if (virtio_with_feature(dev, VTNET_LRO_FEATURES) && virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF) == 0) { /* @@ -763,23 +778,22 @@ vtnet_setup_features(struct vtnet_softc *sc) } if (sc->vtnet_max_vq_pairs > 1) { - int max; + int req; /* - * Limit the maximum number of queue pairs to the lower of - * the number of CPUs and the configured maximum. The actual - * number of queues that get used may be less. + * Limit the maximum number of requested queue pairs to the + * number of CPUs and the configured maximum. */ - max = vtnet_tunable_int(sc, "mq_max_pairs", vtnet_mq_max_pairs); - if (max > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN) { - if (max > mp_ncpus) - max = mp_ncpus; - if (max > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX) - max = VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX; - if (max > 1) { - sc->vtnet_requested_vq_pairs = max; - sc->vtnet_flags |= VTNET_FLAG_MQ; - } + req = vtnet_tunable_int(sc, "mq_max_pairs", vtnet_mq_max_pairs); + if (req < 1) + req = 1; + if (req > sc->vtnet_max_vq_pairs) + req = sc->vtnet_max_vq_pairs; + if (req > mp_ncpus) + req = mp_ncpus; + if (req > 1) { + sc->vtnet_req_vq_pairs = req; + sc->vtnet_flags |= VTNET_FLAG_MQ; } } } @@ -3272,7 +3286,7 @@ vtnet_set_active_vq_pairs(struct vtnet_softc *sc) return; } - npairs = sc->vtnet_requested_vq_pairs; + npairs = sc->vtnet_req_vq_pairs; if (vtnet_ctrl_mq_cmd(sc, npairs) != 0) { device_printf(dev, @@ -4172,8 +4186,8 @@ vtnet_setup_sysctl(struct vtnet_softc *sc) SYSCTL_ADD_INT(ctx, child, OID_AUTO, "max_vq_pairs", CTLFLAG_RD, &sc->vtnet_max_vq_pairs, 0, "Number of maximum supported virtqueue pairs"); - SYSCTL_ADD_INT(ctx, child, OID_AUTO, "requested_vq_pairs", - CTLFLAG_RD, &sc->vtnet_requested_vq_pairs, 0, + SYSCTL_ADD_INT(ctx, child, OID_AUTO, "req_vq_pairs", + CTLFLAG_RD, &sc->vtnet_req_vq_pairs, 0, "Number of requested virtqueue pairs"); SYSCTL_ADD_INT(ctx, child, OID_AUTO, "act_vq_pairs", CTLFLAG_RD, &sc->vtnet_act_vq_pairs, 0, diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index ed4921454d7d..96cd68abba82 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -168,8 +168,8 @@ struct vtnet_softc { int vtnet_if_flags; int vtnet_max_mtu; int vtnet_act_vq_pairs; + int vtnet_req_vq_pairs; int vtnet_max_vq_pairs; - int vtnet_requested_vq_pairs; int vtnet_lro_entry_count; int vtnet_lro_mbufq_depth; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:34 2021 Return-Path: Delivered-To: dev-commits-src-main@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 58DDA4E5518; Tue, 19 Jan 2021 05:08:34 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcB931w3z4XJS; Tue, 19 Jan 2021 05:08:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F196A208E6; Tue, 19 Jan 2021 05:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58Sbg086078; Tue, 19 Jan 2021 05:08:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58SOK086077; Tue, 19 Jan 2021 05:08:28 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:28 GMT Message-Id: <202101190508.10J58SOK086077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: c3187190c71f - main - if_vtnet: Disable F_MTU feature if MTU is invalid MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3187190c71f6850a8d8a058d78a671a45e2871c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:36 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=c3187190c71f6850a8d8a058d78a671a45e2871c commit c3187190c71f6850a8d8a058d78a671a45e2871c Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Disable F_MTU feature if MTU is invalid Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27931 --- sys/dev/virtio/network/if_vtnet.c | 14 ++++++++++++++ sys/dev/virtio/network/if_vtnetvar.h | 1 + 2 files changed, 15 insertions(+) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index a9dc3fad96a5..e3a42413d5cd 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -657,6 +657,20 @@ vtnet_negotiate_features(struct vtnet_softc *sc) negotiated_features = virtio_negotiate_features(dev, features); + if (virtio_with_feature(dev, VIRTIO_NET_F_MTU)) { + uint16_t mtu; + + mtu = virtio_read_dev_config_2(dev, + offsetof(struct virtio_net_config, mtu)); + if (mtu < VTNET_MIN_MTU /* || mtu > VTNET_MAX_MTU */) { + device_printf(dev, "Invalid MTU value: %d. " + "MTU feature disabled.\n", mtu); + features &= ~VIRTIO_NET_F_MTU; + negotiated_features = + virtio_negotiate_features(dev, features); + } + } + if (virtio_with_feature(dev, VIRTIO_NET_F_MQ)) { uint16_t npairs; diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 96cd68abba82..7781e1c9b398 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -340,6 +340,7 @@ CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE); #define VTNET_LRO_FEATURES (VIRTIO_NET_F_GUEST_TSO4 | \ VIRTIO_NET_F_GUEST_TSO6 | VIRTIO_NET_F_GUEST_ECN) +#define VTNET_MIN_MTU 68 #define VTNET_MAX_MTU 65536 #define VTNET_MAX_RX_SIZE 65550 From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:36 2021 Return-Path: Delivered-To: dev-commits-src-main@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 819174E53E9; Tue, 19 Jan 2021 05:08:36 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcBB4Jmyz4XP0; Tue, 19 Jan 2021 05:08:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 313C5208E7; Tue, 19 Jan 2021 05:08:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58VwD086118; Tue, 19 Jan 2021 05:08:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58Vas086117; Tue, 19 Jan 2021 05:08:31 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:31 GMT Message-Id: <202101190508.10J58Vas086117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 33b5433fd74c - main - if_vtnet: Remove unnecessary TUNABLE_INTs because of CTLFLAG_RDTUN MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33b5433fd74c460daa3994949dfaa951bd439554 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:36 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=33b5433fd74c460daa3994949dfaa951bd439554 commit 33b5433fd74c460daa3994949dfaa951bd439554 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Remove unnecessary TUNABLE_INTs because of CTLFLAG_RDTUN Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27923 --- sys/dev/virtio/network/if_vtnet.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index dc232d769fa6..ad53f3d24e02 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -263,7 +263,6 @@ static SYSCTL_NODE(_hw, OID_AUTO, vtnet, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "VirtIO Net driver parameters"); static int vtnet_csum_disable = 0; -TUNABLE_INT("hw.vtnet.csum_disable", &vtnet_csum_disable); SYSCTL_INT(_hw_vtnet, OID_AUTO, csum_disable, CTLFLAG_RDTUN, &vtnet_csum_disable, 0, "Disables receive and send checksum offload"); @@ -273,34 +272,29 @@ SYSCTL_INT(_hw_vtnet, OID_AUTO, fixup_needs_csum, CTLFLAG_RDTUN, "Calculate valid checksum for NEEDS_CSUM packets"); static int vtnet_tso_disable = 0; -TUNABLE_INT("hw.vtnet.tso_disable", &vtnet_tso_disable); -SYSCTL_INT(_hw_vtnet, OID_AUTO, tso_disable, CTLFLAG_RDTUN, &vtnet_tso_disable, - 0, "Disables TCP Segmentation Offload"); +SYSCTL_INT(_hw_vtnet, OID_AUTO, tso_disable, CTLFLAG_RDTUN, + &vtnet_tso_disable, 0, "Disables TSO"); static int vtnet_lro_disable = 0; -TUNABLE_INT("hw.vtnet.lro_disable", &vtnet_lro_disable); -SYSCTL_INT(_hw_vtnet, OID_AUTO, lro_disable, CTLFLAG_RDTUN, &vtnet_lro_disable, - 0, "Disables TCP Large Receive Offload"); +SYSCTL_INT(_hw_vtnet, OID_AUTO, lro_disable, CTLFLAG_RDTUN, + &vtnet_lro_disable, 0, "Disables hardware LRO"); static int vtnet_mq_disable = 0; -TUNABLE_INT("hw.vtnet.mq_disable", &vtnet_mq_disable); -SYSCTL_INT(_hw_vtnet, OID_AUTO, mq_disable, CTLFLAG_RDTUN, &vtnet_mq_disable, - 0, "Disables multiqueue support"); +SYSCTL_INT(_hw_vtnet, OID_AUTO, mq_disable, CTLFLAG_RDTUN, + &vtnet_mq_disable, 0, "Disables multiqueue support"); static int vtnet_mq_max_pairs = VTNET_MAX_QUEUE_PAIRS; -TUNABLE_INT("hw.vtnet.mq_max_pairs", &vtnet_mq_max_pairs); SYSCTL_INT(_hw_vtnet, OID_AUTO, mq_max_pairs, CTLFLAG_RDTUN, - &vtnet_mq_max_pairs, 0, "Sets the maximum number of multiqueue pairs"); + &vtnet_mq_max_pairs, 0, "Maximum number of multiqueue pairs"); static int vtnet_tso_maxlen = IP_MAXPACKET; -TUNABLE_INT("hw.vtnet.tso_maxlen", &vtnet_tso_maxlen); SYSCTL_INT(_hw_vtnet, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN, &vtnet_tso_maxlen, 0, "TSO burst limit"); static int vtnet_rx_process_limit = 1024; -TUNABLE_INT("hw.vtnet.rx_process_limit", &vtnet_rx_process_limit); SYSCTL_INT(_hw_vtnet, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, - &vtnet_rx_process_limit, 0, "Limits RX segments processed in a single pass"); + &vtnet_rx_process_limit, 0, + "Number of RX segments processed in one pass"); static int vtnet_lro_entry_count = 128; SYSCTL_INT(_hw_vtnet, OID_AUTO, lro_entry_count, CTLFLAG_RDTUN, From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:39 2021 Return-Path: Delivered-To: dev-commits-src-main@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 858A74E5527; Tue, 19 Jan 2021 05:08:39 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcBH1KpDz4XYZ; Tue, 19 Jan 2021 05:08:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B63E020CE9; Tue, 19 Jan 2021 05:08:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58Ztu086202; Tue, 19 Jan 2021 05:08:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58Z7o086201; Tue, 19 Jan 2021 05:08:35 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:35 GMT Message-Id: <202101190508.10J58Z7o086201@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 2bfab3577452 - main - if_vtnet: Add counter for received host LRO MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2bfab357745256342fbf7cea952c534f6680b8bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:41 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=2bfab357745256342fbf7cea952c534f6680b8bb commit 2bfab357745256342fbf7cea952c534f6680b8bb Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:26 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:26 +0000 if_vtnet: Add counter for received host LRO Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27928 --- sys/dev/virtio/network/if_vtnet.c | 3 +++ sys/dev/virtio/network/if_vtnetvar.h | 1 + 2 files changed, 4 insertions(+) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 1ed149c3d1eb..ed3065b61283 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2016,6 +2016,7 @@ vtnet_rxq_input(struct vtnet_rxq *rxq, struct mbuf *m, case VIRTIO_NET_HDR_GSO_TCPV6: m->m_pkthdr.lro_nsegs = howmany(m->m_pkthdr.len, hdr->gso_size); + rxq->vtnrx_stats.vrxs_host_lro++; break; } } @@ -4074,6 +4075,8 @@ vtnet_setup_rxq_sysctl(struct sysctl_ctx_list *ctx, &stats->vrxs_csum, "Receive checksum offloaded"); SYSCTL_ADD_UQUAD(ctx, list, OID_AUTO, "csum_failed", CTLFLAG_RD, &stats->vrxs_csum_failed, "Receive checksum offload failed"); + SYSCTL_ADD_UQUAD(ctx, list, OID_AUTO, "host_lro", CTLFLAG_RD, + &stats->vrxs_host_lro, "Receive host segmentation offloaded"); SYSCTL_ADD_UQUAD(ctx, list, OID_AUTO, "rescheduled", CTLFLAG_RD, &stats->vrxs_rescheduled, "Receive interrupt handler rescheduled"); diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index f928b9bd9b38..d26f7240a67a 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -68,6 +68,7 @@ struct vtnet_rxq_stats { uint64_t vrxs_ierrors; /* if_ierrors */ uint64_t vrxs_csum; uint64_t vrxs_csum_failed; + uint64_t vrxs_host_lro; uint64_t vrxs_rescheduled; }; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:39 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C84114E54C6; Tue, 19 Jan 2021 05:08:39 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcBH1Mf8z4XRg; Tue, 19 Jan 2021 05:08:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9632F20B41; Tue, 19 Jan 2021 05:08:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58YkL086180; Tue, 19 Jan 2021 05:08:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58YIQ086179; Tue, 19 Jan 2021 05:08:34 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:34 GMT Message-Id: <202101190508.10J58YIQ086179@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 475a60aec7e3 - main - if_vtnet: Misc Tx path cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 475a60aec7e3126f7a8b93a9f0fdf23360804080 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:41 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=475a60aec7e3126f7a8b93a9f0fdf23360804080 commit 475a60aec7e3126f7a8b93a9f0fdf23360804080 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:26 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:26 +0000 if_vtnet: Misc Tx path cleanup - Add and fix a few error path counters - Improve sysctl descriptions - Use flags consistently to determine IPv4 vs IPv6 Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27926 --- sys/dev/virtio/network/if_vtnet.c | 65 +++++++++++++++++++++--------------- sys/dev/virtio/network/if_vtnetvar.h | 5 +-- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 3da945baab63..1ed149c3d1eb 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2375,7 +2375,7 @@ vtnet_txq_offload_ctx(struct vtnet_txq *txq, struct mbuf *m, int *etype, break; #endif default: - sc->vtnet_stats.tx_csum_bad_ethtype++; + sc->vtnet_stats.tx_csum_unknown_ethtype++; return (EINVAL); } @@ -2383,7 +2383,7 @@ vtnet_txq_offload_ctx(struct vtnet_txq *txq, struct mbuf *m, int *etype, } static int -vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int eth_type, +vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int flags, int offset, struct virtio_net_hdr *hdr) { static struct timeval lastecn; @@ -2401,14 +2401,15 @@ vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int eth_type, hdr->hdr_len = vtnet_gtoh16(sc, offset + (tcp->th_off << 2)); hdr->gso_size = vtnet_gtoh16(sc, m->m_pkthdr.tso_segsz); - hdr->gso_type = eth_type == ETHERTYPE_IP ? VIRTIO_NET_HDR_GSO_TCPV4 : - VIRTIO_NET_HDR_GSO_TCPV6; + hdr->gso_type = (flags & CSUM_IP_TSO) ? + VIRTIO_NET_HDR_GSO_TCPV4 : VIRTIO_NET_HDR_GSO_TCPV6; - if (tcp->th_flags & TH_CWR) { + if (__predict_false(tcp->th_flags & TH_CWR)) { /* - * Drop if VIRTIO_NET_F_HOST_ECN was not negotiated. In FreeBSD, - * ECN support is not on a per-interface basis, but globally via - * the net.inet.tcp.ecn.enable sysctl knob. The default is off. + * Drop if VIRTIO_NET_F_HOST_ECN was not negotiated. In + * FreeBSD, ECN support is not on a per-interface basis, + * but globally via the net.inet.tcp.ecn.enable sysctl + * knob. The default is off. */ if ((sc->vtnet_flags & VTNET_FLAG_TSO_ECN) == 0) { if (ppsratecheck(&lastecn, &curecn, 1)) @@ -2438,30 +2439,36 @@ vtnet_txq_offload(struct vtnet_txq *txq, struct mbuf *m, if (error) goto drop; - if ((etype == ETHERTYPE_IP && flags & VTNET_CSUM_OFFLOAD) || - (etype == ETHERTYPE_IPV6 && flags & VTNET_CSUM_OFFLOAD_IPV6)) { - /* - * We could compare the IP protocol vs the CSUM_ flag too, - * but that really should not be necessary. - */ + if (flags & (VTNET_CSUM_OFFLOAD | VTNET_CSUM_OFFLOAD_IPV6)) { + /* Sanity check the parsed mbuf matches the offload flags. */ + if (__predict_false((flags & VTNET_CSUM_OFFLOAD && + etype != ETHERTYPE_IP) || (flags & VTNET_CSUM_OFFLOAD_IPV6 + && etype != ETHERTYPE_IPV6))) { + sc->vtnet_stats.tx_csum_proto_mismatch++; + goto drop; + } + hdr->flags |= VIRTIO_NET_HDR_F_NEEDS_CSUM; hdr->csum_start = vtnet_gtoh16(sc, csum_start); hdr->csum_offset = vtnet_gtoh16(sc, m->m_pkthdr.csum_data); txq->vtntx_stats.vtxs_csum++; } - if (flags & CSUM_TSO) { + if (flags & (CSUM_IP_TSO | CSUM_IP6_TSO)) { + /* + * Sanity check the parsed mbuf IP protocol is TCP, and + * VirtIO TSO reqires the checksum offloading above. + */ if (__predict_false(proto != IPPROTO_TCP)) { - /* Likely failed to correctly parse the mbuf. */ sc->vtnet_stats.tx_tso_not_tcp++; goto drop; + } else if (__predict_false((hdr->flags & + VIRTIO_NET_HDR_F_NEEDS_CSUM) == 0)) { + sc->vtnet_stats.tx_tso_without_csum++; + goto drop; } - KASSERT(hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM, - ("%s: mbuf %p TSO without checksum offload %#x", - __func__, m, flags)); - - error = vtnet_txq_offload_tso(txq, m, etype, csum_start, hdr); + error = vtnet_txq_offload_tso(txq, m, flags, csum_start, hdr); if (error) goto drop; } @@ -4097,7 +4104,7 @@ vtnet_setup_txq_sysctl(struct sysctl_ctx_list *ctx, SYSCTL_ADD_UQUAD(ctx, list, OID_AUTO, "csum", CTLFLAG_RD, &stats->vtxs_csum, "Transmit checksum offloaded"); SYSCTL_ADD_UQUAD(ctx, list, OID_AUTO, "tso", CTLFLAG_RD, - &stats->vtxs_tso, "Transmit segmentation offloaded"); + &stats->vtxs_tso, "Transmit TCP segmentation offloaded"); SYSCTL_ADD_UQUAD(ctx, list, OID_AUTO, "rescheduled", CTLFLAG_RD, &stats->vtxs_rescheduled, "Transmit interrupt handler rescheduled"); @@ -4177,16 +4184,20 @@ vtnet_setup_stat_sysctl(struct sysctl_ctx_list *ctx, CTLFLAG_RD, &stats->rx_task_rescheduled, "Times the receive interrupt task rescheduled itself"); - SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "tx_csum_bad_ethtype", - CTLFLAG_RD, &stats->tx_csum_bad_ethtype, + SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "tx_csum_unknown_ethtype", + CTLFLAG_RD, &stats->tx_csum_unknown_ethtype, "Aborted transmit of checksum offloaded buffer with unknown " "Ethernet type"); - SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "tx_tso_bad_ethtype", - CTLFLAG_RD, &stats->tx_tso_bad_ethtype, - "Aborted transmit of TSO buffer with unknown Ethernet type"); + SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "tx_csum_proto_mismatch", + CTLFLAG_RD, &stats->tx_csum_proto_mismatch, + "Aborted transmit of checksum offloaded buffer because mismatched " + "protocols"); SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "tx_tso_not_tcp", CTLFLAG_RD, &stats->tx_tso_not_tcp, "Aborted transmit of TSO buffer with non TCP protocol"); + SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "tx_tso_without_csum", + CTLFLAG_RD, &stats->tx_tso_without_csum, + "Aborted transmit of TSO buffer without TCP checksum offload"); SYSCTL_ADD_UQUAD(ctx, child, OID_AUTO, "tx_defragged", CTLFLAG_RD, &stats->tx_defragged, "Transmit mbufs defragged"); diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index c9403c0dbb0e..f928b9bd9b38 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -43,9 +43,10 @@ struct vtnet_statistics { uint64_t rx_csum_bad_ipproto; uint64_t rx_csum_bad_offset; uint64_t rx_csum_bad_proto; - uint64_t tx_csum_bad_ethtype; - uint64_t tx_tso_bad_ethtype; + uint64_t tx_csum_unknown_ethtype; + uint64_t tx_csum_proto_mismatch; uint64_t tx_tso_not_tcp; + uint64_t tx_tso_without_csum; uint64_t tx_defragged; uint64_t tx_defrag_failed; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:43 2021 Return-Path: Delivered-To: dev-commits-src-main@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 94EDC4E55BD; Tue, 19 Jan 2021 05:08:43 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcBJ6frwz4XLk; Tue, 19 Jan 2021 05:08:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4E24206E8; Tue, 19 Jan 2021 05:08:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58agN086223; Tue, 19 Jan 2021 05:08:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58aZw086221; Tue, 19 Jan 2021 05:08:36 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:36 GMT Message-Id: <202101190508.10J58aZw086221@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: e6cc42f181ce - main - virtio: Handle possible failure of virtio_finalize_features() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6cc42f181ce346a294ae7aa1d1c321fdc90f241 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:44 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=e6cc42f181ce346a294ae7aa1d1c321fdc90f241 commit e6cc42f181ce346a294ae7aa1d1c321fdc90f241 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:26 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:26 +0000 virtio: Handle possible failure of virtio_finalize_features() Try to standardize how drivers negotiate feature and the function names Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27930 --- sys/dev/virtio/balloon/virtio_balloon.c | 33 +++++++++++++++------ sys/dev/virtio/block/virtio_blk.c | 28 ++++++++++++------ sys/dev/virtio/console/virtio_console.c | 25 ++++++++++------ sys/dev/virtio/network/if_vtnet.c | 25 ++++++++++------ sys/dev/virtio/pci/virtio_pci_modern.c | 2 -- sys/dev/virtio/random/virtio_random.c | 51 +++++++++++++++++++++++---------- sys/dev/virtio/scsi/virtio_scsi.c | 50 ++++++++++++++++++++++---------- 7 files changed, 149 insertions(+), 65 deletions(-) diff --git a/sys/dev/virtio/balloon/virtio_balloon.c b/sys/dev/virtio/balloon/virtio_balloon.c index 0973528887c5..848dd4e9a7f5 100644 --- a/sys/dev/virtio/balloon/virtio_balloon.c +++ b/sys/dev/virtio/balloon/virtio_balloon.c @@ -90,7 +90,8 @@ static int vtballoon_attach(device_t); static int vtballoon_detach(device_t); static int vtballoon_config_change(device_t); -static void vtballoon_negotiate_features(struct vtballoon_softc *); +static int vtballoon_negotiate_features(struct vtballoon_softc *); +static int vtballoon_setup_features(struct vtballoon_softc *); static int vtballoon_alloc_virtqueues(struct vtballoon_softc *); static void vtballoon_vq_intr(void *); @@ -110,7 +111,7 @@ static void vtballoon_free_page(struct vtballoon_softc *, vm_page_t); static int vtballoon_sleep(struct vtballoon_softc *); static void vtballoon_thread(void *); -static void vtballoon_add_sysctl(struct vtballoon_softc *); +static void vtballoon_setup_sysctl(struct vtballoon_softc *); #define vtballoon_modern(_sc) \ (((_sc)->vtballoon_features & VIRTIO_F_VERSION_1) != 0) @@ -183,14 +184,18 @@ vtballoon_attach(device_t dev) sc = device_get_softc(dev); sc->vtballoon_dev = dev; + virtio_set_feature_desc(dev, vtballoon_feature_desc); VTBALLOON_LOCK_INIT(sc, device_get_nameunit(dev)); TAILQ_INIT(&sc->vtballoon_pages); - vtballoon_add_sysctl(sc); + vtballoon_setup_sysctl(sc); - virtio_set_feature_desc(dev, vtballoon_feature_desc); - vtballoon_negotiate_features(sc); + error = vtballoon_setup_features(sc); + if (error) { + device_printf(dev, "cannot setup features\n"); + goto fail; + } sc->vtballoon_page_frames = malloc(VTBALLOON_PAGES_PER_REQUEST * sizeof(uint32_t), M_DEVBUF, M_NOWAIT | M_ZERO); @@ -276,7 +281,7 @@ vtballoon_config_change(device_t dev) return (1); } -static void +static int vtballoon_negotiate_features(struct vtballoon_softc *sc) { device_t dev; @@ -286,7 +291,19 @@ vtballoon_negotiate_features(struct vtballoon_softc *sc) features = VTBALLOON_FEATURES; sc->vtballoon_features = virtio_negotiate_features(dev, features); - virtio_finalize_features(dev); + return (virtio_finalize_features(dev)); +} + +static int +vtballoon_setup_features(struct vtballoon_softc *sc) +{ + int error; + + error = vtballoon_negotiate_features(sc); + if (error) + return (error); + + return (0); } static int @@ -559,7 +576,7 @@ vtballoon_thread(void *xsc) } static void -vtballoon_add_sysctl(struct vtballoon_softc *sc) +vtballoon_setup_sysctl(struct vtballoon_softc *sc) { device_t dev; struct sysctl_ctx_list *ctx; diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c index 08df77d6de5b..6056771e3735 100644 --- a/sys/dev/virtio/block/virtio_blk.c +++ b/sys/dev/virtio/block/virtio_blk.c @@ -135,8 +135,8 @@ static int vtblk_ioctl(struct disk *, u_long, void *, int, static int vtblk_dump(void *, void *, vm_offset_t, off_t, size_t); static void vtblk_strategy(struct bio *); -static void vtblk_negotiate_features(struct vtblk_softc *); -static void vtblk_setup_features(struct vtblk_softc *); +static int vtblk_negotiate_features(struct vtblk_softc *); +static int vtblk_setup_features(struct vtblk_softc *); static int vtblk_maximum_segments(struct vtblk_softc *, struct virtio_blk_config *); static int vtblk_alloc_virtqueue(struct vtblk_softc *); @@ -312,10 +312,10 @@ vtblk_attach(device_t dev) struct virtio_blk_config blkcfg; int error; - virtio_set_feature_desc(dev, vtblk_feature_desc); - sc = device_get_softc(dev); sc->vtblk_dev = dev; + virtio_set_feature_desc(dev, vtblk_feature_desc); + VTBLK_LOCK_INIT(sc, device_get_nameunit(dev)); bioq_init(&sc->vtblk_bioq); TAILQ_INIT(&sc->vtblk_dump_queue); @@ -323,7 +323,12 @@ vtblk_attach(device_t dev) TAILQ_INIT(&sc->vtblk_req_ready); vtblk_setup_sysctl(sc); - vtblk_setup_features(sc); + + error = vtblk_setup_features(sc); + if (error) { + device_printf(dev, "cannot setup features\n"); + goto fail; + } vtblk_read_config(sc, &blkcfg); @@ -572,7 +577,7 @@ vtblk_strategy(struct bio *bp) VTBLK_UNLOCK(sc); } -static void +static int vtblk_negotiate_features(struct vtblk_softc *sc) { device_t dev; @@ -583,17 +588,20 @@ vtblk_negotiate_features(struct vtblk_softc *sc) VTBLK_LEGACY_FEATURES; sc->vtblk_features = virtio_negotiate_features(dev, features); - virtio_finalize_features(dev); + return (virtio_finalize_features(dev)); } -static void +static int vtblk_setup_features(struct vtblk_softc *sc) { device_t dev; + int error; dev = sc->vtblk_dev; - vtblk_negotiate_features(sc); + error = vtblk_negotiate_features(sc); + if (error) + return (error); if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) sc->vtblk_flags |= VTBLK_FLAG_INDIRECT; @@ -603,6 +611,8 @@ vtblk_setup_features(struct vtblk_softc *sc) /* Legacy. */ if (virtio_with_feature(dev, VIRTIO_BLK_F_BARRIER)) sc->vtblk_flags |= VTBLK_FLAG_BARRIER; + + return (0); } static int diff --git a/sys/dev/virtio/console/virtio_console.c b/sys/dev/virtio/console/virtio_console.c index 0bd7c982e3f5..315eb59716b4 100644 --- a/sys/dev/virtio/console/virtio_console.c +++ b/sys/dev/virtio/console/virtio_console.c @@ -157,8 +157,8 @@ static int vtcon_attach(device_t); static int vtcon_detach(device_t); static int vtcon_config_change(device_t); -static void vtcon_setup_features(struct vtcon_softc *); -static void vtcon_negotiate_features(struct vtcon_softc *); +static int vtcon_setup_features(struct vtcon_softc *); +static int vtcon_negotiate_features(struct vtcon_softc *); static int vtcon_alloc_scports(struct vtcon_softc *); static int vtcon_alloc_virtqueues(struct vtcon_softc *); static void vtcon_read_config(struct vtcon_softc *, @@ -331,12 +331,16 @@ vtcon_attach(device_t dev) sc = device_get_softc(dev); sc->vtcon_dev = dev; + virtio_set_feature_desc(dev, vtcon_feature_desc); mtx_init(&sc->vtcon_mtx, "vtconmtx", NULL, MTX_DEF); mtx_init(&sc->vtcon_ctrl_tx_mtx, "vtconctrlmtx", NULL, MTX_DEF); - virtio_set_feature_desc(dev, vtcon_feature_desc); - vtcon_setup_features(sc); + error = vtcon_setup_features(sc); + if (error) { + device_printf(dev, "cannot setup features\n"); + goto fail; + } vtcon_read_config(sc, &concfg); vtcon_determine_max_ports(sc, &concfg); @@ -428,7 +432,7 @@ vtcon_config_change(device_t dev) return (0); } -static void +static int vtcon_negotiate_features(struct vtcon_softc *sc) { device_t dev; @@ -438,22 +442,27 @@ vtcon_negotiate_features(struct vtcon_softc *sc) features = VTCON_FEATURES; sc->vtcon_features = virtio_negotiate_features(dev, features); - virtio_finalize_features(dev); + return (virtio_finalize_features(dev)); } -static void +static int vtcon_setup_features(struct vtcon_softc *sc) { device_t dev; + int error; dev = sc->vtcon_dev; - vtcon_negotiate_features(sc); + error = vtcon_negotiate_features(sc); + if (error) + return (error); if (virtio_with_feature(dev, VIRTIO_CONSOLE_F_SIZE)) sc->vtcon_flags |= VTCON_FLAG_SIZE; if (virtio_with_feature(dev, VIRTIO_CONSOLE_F_MULTIPORT)) sc->vtcon_flags |= VTCON_FLAG_MULTIPORT; + + return (0); } #define VTCON_GET_CONFIG(_dev, _feature, _field, _cfg) \ diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index ed3065b61283..8d0770f5ac2d 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -102,8 +102,8 @@ static int vtnet_shutdown(device_t); static int vtnet_attach_completed(device_t); static int vtnet_config_change(device_t); -static void vtnet_negotiate_features(struct vtnet_softc *); -static void vtnet_setup_features(struct vtnet_softc *); +static int vtnet_negotiate_features(struct vtnet_softc *); +static int vtnet_setup_features(struct vtnet_softc *); static int vtnet_init_rxq(struct vtnet_softc *, int); static int vtnet_init_txq(struct vtnet_softc *, int); static int vtnet_alloc_rxtx_queues(struct vtnet_softc *); @@ -434,7 +434,6 @@ vtnet_attach(device_t dev) sc = device_get_softc(dev); sc->vtnet_dev = dev; - virtio_set_feature_desc(dev, vtnet_feature_desc); VTNET_CORE_LOCK_INIT(sc); @@ -448,7 +447,12 @@ vtnet_attach(device_t dev) } vtnet_setup_sysctl(sc); - vtnet_setup_features(sc); + + error = vtnet_setup_features(sc); + if (error) { + device_printf(dev, "cannot setup features\n"); + goto fail; + } error = vtnet_alloc_rx_filters(sc); if (error) { @@ -619,7 +623,7 @@ vtnet_config_change(device_t dev) return (0); } -static void +static int vtnet_negotiate_features(struct vtnet_softc *sc) { device_t dev; @@ -705,17 +709,20 @@ vtnet_negotiate_features(struct vtnet_softc *sc) sc->vtnet_features = negotiated_features; sc->vtnet_negotiated_features = negotiated_features; - virtio_finalize_features(dev); + return (virtio_finalize_features(dev)); } -static void +static int vtnet_setup_features(struct vtnet_softc *sc) { device_t dev; + int error; dev = sc->vtnet_dev; - vtnet_negotiate_features(sc); + error = vtnet_negotiate_features(sc); + if (error) + return (error); if (virtio_with_feature(dev, VIRTIO_F_VERSION_1)) sc->vtnet_flags |= VTNET_FLAG_MODERN; @@ -807,6 +814,8 @@ vtnet_setup_features(struct vtnet_softc *sc) sc->vtnet_flags |= VTNET_FLAG_MQ; } } + + return (0); } static int diff --git a/sys/dev/virtio/pci/virtio_pci_modern.c b/sys/dev/virtio/pci/virtio_pci_modern.c index 09ac0a1232e7..7029d2ff76ce 100644 --- a/sys/dev/virtio/pci/virtio_pci_modern.c +++ b/sys/dev/virtio/pci/virtio_pci_modern.c @@ -462,8 +462,6 @@ vtpci_modern_finalize_features(device_t dev) /* * Must re-read the status after setting it to verify the negotiated * features were accepted by the device. - * - * BMV: TODO Drivers need to handle possible failure of this method! */ vtpci_modern_set_status(sc, VIRTIO_CONFIG_S_FEATURES_OK); diff --git a/sys/dev/virtio/random/virtio_random.c b/sys/dev/virtio/random/virtio_random.c index 8c01b1cf6ae3..ee3a24bb5513 100644 --- a/sys/dev/virtio/random/virtio_random.c +++ b/sys/dev/virtio/random/virtio_random.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -50,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include struct vtrnd_softc { + device_t vtrnd_dev; uint64_t vtrnd_features; struct virtqueue *vtrnd_vq; }; @@ -60,8 +60,9 @@ static int vtrnd_probe(device_t); static int vtrnd_attach(device_t); static int vtrnd_detach(device_t); -static void vtrnd_negotiate_features(device_t); -static int vtrnd_alloc_virtqueue(device_t); +static int vtrnd_negotiate_features(struct vtrnd_softc *); +static int vtrnd_setup_features(struct vtrnd_softc *); +static int vtrnd_alloc_virtqueue(struct vtrnd_softc *); static int vtrnd_harvest(struct vtrnd_softc *, void *, size_t *); static unsigned vtrnd_read(void *, unsigned); @@ -142,11 +143,16 @@ vtrnd_attach(device_t dev) int error; sc = device_get_softc(dev); - + sc->vtrnd_dev = dev; virtio_set_feature_desc(dev, vtrnd_feature_desc); - vtrnd_negotiate_features(dev); - error = vtrnd_alloc_virtqueue(dev); + error = vtrnd_setup_features(sc); + if (error) { + device_printf(dev, "cannot setup features\n"); + goto fail; + } + + error = vtrnd_alloc_virtqueue(sc); if (error) { device_printf(dev, "cannot allocate virtqueue\n"); goto fail; @@ -182,23 +188,38 @@ vtrnd_detach(device_t dev) return (0); } -static void -vtrnd_negotiate_features(device_t dev) +static int +vtrnd_negotiate_features(struct vtrnd_softc *sc) { - struct vtrnd_softc *sc; + device_t dev; + uint64_t features; - sc = device_get_softc(dev); - sc->vtrnd_features = virtio_negotiate_features(dev, VTRND_FEATURES); - virtio_finalize_features(dev); + dev = sc->vtrnd_dev; + features = VTRND_FEATURES; + + sc->vtrnd_features = virtio_negotiate_features(dev, features); + return (virtio_finalize_features(dev)); } static int -vtrnd_alloc_virtqueue(device_t dev) +vtrnd_setup_features(struct vtrnd_softc *sc) { - struct vtrnd_softc *sc; + int error; + + error = vtrnd_negotiate_features(sc); + if (error) + return (error); + + return (0); +} + +static int +vtrnd_alloc_virtqueue(struct vtrnd_softc *sc) +{ + device_t dev; struct vq_alloc_info vq_info; - sc = device_get_softc(dev); + dev = sc->vtrnd_dev; VQ_ALLOC_INFO_INIT(&vq_info, 0, NULL, sc, &sc->vtrnd_vq, "%s request", device_get_nameunit(dev)); diff --git a/sys/dev/virtio/scsi/virtio_scsi.c b/sys/dev/virtio/scsi/virtio_scsi.c index f4c716af3725..737b6d0a7a42 100644 --- a/sys/dev/virtio/scsi/virtio_scsi.c +++ b/sys/dev/virtio/scsi/virtio_scsi.c @@ -76,7 +76,8 @@ static int vtscsi_detach(device_t); static int vtscsi_suspend(device_t); static int vtscsi_resume(device_t); -static void vtscsi_negotiate_features(struct vtscsi_softc *); +static int vtscsi_negotiate_features(struct vtscsi_softc *); +static int vtscsi_setup_features(struct vtscsi_softc *); static void vtscsi_read_config(struct vtscsi_softc *, struct virtio_scsi_config *); static int vtscsi_maximum_segments(struct vtscsi_softc *, int); @@ -184,7 +185,7 @@ static void vtscsi_disable_vqs_intr(struct vtscsi_softc *); static void vtscsi_enable_vqs_intr(struct vtscsi_softc *); static void vtscsi_get_tunables(struct vtscsi_softc *); -static void vtscsi_add_sysctl(struct vtscsi_softc *); +static void vtscsi_setup_sysctl(struct vtscsi_softc *); static void vtscsi_printf_req(struct vtscsi_request *, const char *, const char *, ...); @@ -285,22 +286,19 @@ vtscsi_attach(device_t dev) sc = device_get_softc(dev); sc->vtscsi_dev = dev; + virtio_set_feature_desc(dev, vtscsi_feature_desc); VTSCSI_LOCK_INIT(sc, device_get_nameunit(dev)); TAILQ_INIT(&sc->vtscsi_req_free); vtscsi_get_tunables(sc); - vtscsi_add_sysctl(sc); - - virtio_set_feature_desc(dev, vtscsi_feature_desc); - vtscsi_negotiate_features(sc); + vtscsi_setup_sysctl(sc); - if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) - sc->vtscsi_flags |= VTSCSI_FLAG_INDIRECT; - if (virtio_with_feature(dev, VIRTIO_SCSI_F_INOUT)) - sc->vtscsi_flags |= VTSCSI_FLAG_BIDIRECTIONAL; - if (virtio_with_feature(dev, VIRTIO_SCSI_F_HOTPLUG)) - sc->vtscsi_flags |= VTSCSI_FLAG_HOTPLUG; + error = vtscsi_setup_features(sc); + if (error) { + device_printf(dev, "cannot setup features\n"); + goto fail; + } vtscsi_read_config(sc, &scsicfg); @@ -413,7 +411,7 @@ vtscsi_resume(device_t dev) return (0); } -static void +static int vtscsi_negotiate_features(struct vtscsi_softc *sc) { device_t dev; @@ -423,7 +421,29 @@ vtscsi_negotiate_features(struct vtscsi_softc *sc) features = VTSCSI_FEATURES; sc->vtscsi_features = virtio_negotiate_features(dev, features); - virtio_finalize_features(dev); + return (virtio_finalize_features(dev)); +} + +static int +vtscsi_setup_features(struct vtscsi_softc *sc) +{ + device_t dev; + int error; + + dev = sc->vtscsi_dev; + + error = vtscsi_negotiate_features(sc); + if (error) + return (error); + + if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) + sc->vtscsi_flags |= VTSCSI_FLAG_INDIRECT; + if (virtio_with_feature(dev, VIRTIO_SCSI_F_INOUT)) + sc->vtscsi_flags |= VTSCSI_FLAG_BIDIRECTIONAL; + if (virtio_with_feature(dev, VIRTIO_SCSI_F_HOTPLUG)) + sc->vtscsi_flags |= VTSCSI_FLAG_HOTPLUG; + + return (0); } #define VTSCSI_GET_CONFIG(_dev, _field, _cfg) \ @@ -2287,7 +2307,7 @@ vtscsi_get_tunables(struct vtscsi_softc *sc) } static void -vtscsi_add_sysctl(struct vtscsi_softc *sc) +vtscsi_setup_sysctl(struct vtscsi_softc *sc) { device_t dev; struct vtscsi_statistics *stats; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:28 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4BA244E5358; Tue, 19 Jan 2021 05:08:28 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcB33Bb3z4XL0; Tue, 19 Jan 2021 05:08:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53D2520D8F; Tue, 19 Jan 2021 05:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58NWd085972; Tue, 19 Jan 2021 05:08:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58N7D085971; Tue, 19 Jan 2021 05:08:23 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:23 GMT Message-Id: <202101190508.10J58N7D085971@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: e36a6b1b1f39 - main - if_vtnet: Add support for CTRL_GUEST_OFFLOADS feature MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e36a6b1b1f390be3191d51c11bfcf1afbad55c41 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:28 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=e36a6b1b1f390be3191d51c11bfcf1afbad55c41 commit e36a6b1b1f390be3191d51c11bfcf1afbad55c41 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Add support for CTRL_GUEST_OFFLOADS feature This allows the Rx checksum and LRO to be modified without a full reinit of the device. Remove IFCAP_RXCSUM_IPV6 from the interface capabilities since in VirtIO Rx checksums are just enabled or disabled for all protocols. Properly update IFCAP_LRO if LRO is becomes disabled when Rx checksums are disabled. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27916 --- sys/dev/virtio/network/if_vtnet.c | 157 ++++++++++++++++++++++++++++------- sys/dev/virtio/network/if_vtnetvar.h | 1 + 2 files changed, 127 insertions(+), 31 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 876dc1e152c4..642c513ff0b3 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -193,6 +193,7 @@ static int vtnet_init_rx_queues(struct vtnet_softc *); static int vtnet_init_tx_queues(struct vtnet_softc *); static int vtnet_init_rxtx_queues(struct vtnet_softc *); static void vtnet_set_active_vq_pairs(struct vtnet_softc *); +static void vtnet_update_rx_offloads(struct vtnet_softc *); static int vtnet_reinit(struct vtnet_softc *); static void vtnet_init_locked(struct vtnet_softc *, int); static void vtnet_init(void *); @@ -201,6 +202,7 @@ static void vtnet_free_ctrl_vq(struct vtnet_softc *); static void vtnet_exec_ctrl_cmd(struct vtnet_softc *, void *, struct sglist *, int, int); static int vtnet_ctrl_mac_cmd(struct vtnet_softc *, uint8_t *); +static int vtnet_ctrl_guest_offloads(struct vtnet_softc *, uint64_t); static int vtnet_ctrl_mq_cmd(struct vtnet_softc *, uint16_t); static int vtnet_ctrl_rx_cmd(struct vtnet_softc *, uint8_t, int); static int vtnet_set_promisc(struct vtnet_softc *, int); @@ -1045,7 +1047,11 @@ vtnet_setup_interface(struct vtnet_softc *sc) } if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) { - ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; + ifp->if_capabilities |= IFCAP_RXCSUM; +#ifdef notyet + /* BMV: Rx checksums not distinguished between IPv4 and IPv6. */ + ifp->if_capabilities |= IFCAP_RXCSUM_IPV6; +#endif if (vtnet_tunable_int(sc, "fixup_needs_csum", vtnet_fixup_needs_csum) != 0) @@ -1215,10 +1221,11 @@ static int vtnet_ioctl_ifcap(struct vtnet_softc *sc, struct ifreq *ifr) { struct ifnet *ifp; - int mask, reinit; + int mask, reinit, update; ifp = sc->vtnet_ifp; mask = (ifr->ifr_reqcap & ifp->if_capabilities) ^ ifp->if_capenable; + reinit = update = 0; VTNET_CORE_LOCK_ASSERT(sc); @@ -1231,10 +1238,15 @@ vtnet_ioctl_ifcap(struct vtnet_softc *sc, struct ifreq *ifr) if (mask & IFCAP_TSO6) ifp->if_capenable ^= IFCAP_TSO6; - if (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO | - IFCAP_VLAN_HWFILTER)) { - /* These Rx features require us to renegotiate. */ - reinit = 1; + if (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO)) { + /* + * These Rx features require the negotiated features to + * be updated. Avoid a full reinit if possible. + */ + if (sc->vtnet_features & VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) + update = 1; + else + reinit = 1; if (mask & IFCAP_RXCSUM) ifp->if_capenable ^= IFCAP_RXCSUM; @@ -1242,19 +1254,41 @@ vtnet_ioctl_ifcap(struct vtnet_softc *sc, struct ifreq *ifr) ifp->if_capenable ^= IFCAP_RXCSUM_IPV6; if (mask & IFCAP_LRO) ifp->if_capenable ^= IFCAP_LRO; + + /* + * VirtIO does not distinguish between IPv4 and IPv6 checksums + * so treat them as a pair. Guest TSO (LRO) requires receive + * checksums. + */ + if (ifp->if_capenable & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { + ifp->if_capenable |= IFCAP_RXCSUM; +#ifdef notyet + ifp->if_capenable |= IFCAP_RXCSUM_IPV6; +#endif + } else + ifp->if_capenable &= + ~(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO); + } + + if (mask & IFCAP_VLAN_HWFILTER) { + /* These Rx features require renegotiation. */ + reinit = 1; + if (mask & IFCAP_VLAN_HWFILTER) ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; - } else - reinit = 0; + } if (mask & IFCAP_VLAN_HWTSO) ifp->if_capenable ^= IFCAP_VLAN_HWTSO; if (mask & IFCAP_VLAN_HWTAGGING) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; - if (reinit && (ifp->if_drv_flags & IFF_DRV_RUNNING)) { - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - vtnet_init_locked(sc, 0); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + if (reinit) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + vtnet_init_locked(sc, 0); + } else if (update) + vtnet_update_rx_offloads(sc); } return (0); @@ -3023,28 +3057,14 @@ vtnet_virtio_reinit(struct vtnet_softc *sc) * via if_capenable and if_hwassist. */ - if (ifp->if_capabilities & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { - /* - * VirtIO does not distinguish between the IPv4 and IPv6 - * checksums so require both. Guest TSO (LRO) requires - * Rx checksums. - */ - if ((ifp->if_capenable & - (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) == 0) { - features &= ~VIRTIO_NET_F_GUEST_CSUM; - features &= ~VTNET_LRO_FEATURES; - } - } + if ((ifp->if_capenable & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) == 0) + features &= ~(VIRTIO_NET_F_GUEST_CSUM | VTNET_LRO_FEATURES); - if (ifp->if_capabilities & IFCAP_LRO) { - if ((ifp->if_capenable & IFCAP_LRO) == 0) - features &= ~VTNET_LRO_FEATURES; - } + if ((ifp->if_capenable & IFCAP_LRO) == 0) + features &= ~VTNET_LRO_FEATURES; - if (ifp->if_capabilities & IFCAP_VLAN_HWFILTER) { - if ((ifp->if_capenable & IFCAP_VLAN_HWFILTER) == 0) - features &= ~VIRTIO_NET_F_CTRL_VLAN; - } + if ((ifp->if_capenable & IFCAP_VLAN_HWFILTER) == 0) + features &= ~VIRTIO_NET_F_CTRL_VLAN; error = virtio_reinit(dev, features); if (error) { @@ -3172,6 +3192,47 @@ vtnet_set_active_vq_pairs(struct vtnet_softc *sc) sc->vtnet_act_vq_pairs = npairs; } +static void +vtnet_update_rx_offloads(struct vtnet_softc *sc) +{ + struct ifnet *ifp; + uint64_t features; + int error; + + ifp = sc->vtnet_ifp; + features = sc->vtnet_features; + + VTNET_CORE_LOCK_ASSERT(sc); + + if (ifp->if_capabilities & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) { + if (ifp->if_capenable & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) + features |= VIRTIO_NET_F_GUEST_CSUM; + else + features &= ~VIRTIO_NET_F_GUEST_CSUM; + } + + if (ifp->if_capabilities & IFCAP_LRO) { + if (ifp->if_capenable & IFCAP_LRO) + features |= VTNET_LRO_FEATURES; + else + features &= ~VTNET_LRO_FEATURES; + } + + error = vtnet_ctrl_guest_offloads(sc, + features & (VIRTIO_NET_F_GUEST_CSUM | VIRTIO_NET_F_GUEST_TSO4 | + VIRTIO_NET_F_GUEST_TSO6 | VIRTIO_NET_F_GUEST_ECN | + VIRTIO_NET_F_GUEST_UFO)); + if (error) { + device_printf(sc->vtnet_dev, + "%s: cannot update Rx features\n", __func__); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + vtnet_init_locked(sc, 0); + } + } else + sc->vtnet_features = features; +} + static int vtnet_reinit(struct vtnet_softc *sc) { @@ -3337,6 +3398,40 @@ vtnet_ctrl_mac_cmd(struct vtnet_softc *sc, uint8_t *hwaddr) return (s.ack == VIRTIO_NET_OK ? 0 : EIO); } +static int +vtnet_ctrl_guest_offloads(struct vtnet_softc *sc, uint64_t offloads) +{ + struct sglist_seg segs[3]; + struct sglist sg; + struct { + struct virtio_net_ctrl_hdr hdr __aligned(2); + uint8_t pad1; + uint64_t offloads __aligned(8); + uint8_t pad2; + uint8_t ack; + } s; + int error; + + error = 0; + MPASS(sc->vtnet_features & VIRTIO_NET_F_CTRL_GUEST_OFFLOADS); + + s.hdr.class = VIRTIO_NET_CTRL_GUEST_OFFLOADS; + s.hdr.cmd = VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET; + s.offloads = vtnet_gtoh64(sc, offloads); + s.ack = VIRTIO_NET_ERR; + + sglist_init(&sg, nitems(segs), segs); + error |= sglist_append(&sg, &s.hdr, sizeof(struct virtio_net_ctrl_hdr)); + error |= sglist_append(&sg, &s.offloads, sizeof(uint64_t)); + error |= sglist_append(&sg, &s.ack, sizeof(uint8_t)); + MPASS(error == 0 && sg.sg_nseg == nitems(segs)); + + if (error == 0) + vtnet_exec_ctrl_cmd(sc, &s.ack, &sg, sg.sg_nseg - 1, 1); + + return (s.ack == VIRTIO_NET_OK ? 0 : EIO); +} + static int vtnet_ctrl_mq_cmd(struct vtnet_softc *sc, uint16_t npairs) { diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 0fd1238b2dcb..1f94325604fe 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -293,6 +293,7 @@ CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE); #define VTNET_COMMON_FEATURES \ (VIRTIO_NET_F_MAC | \ VIRTIO_NET_F_STATUS | \ + VIRTIO_NET_F_CTRL_GUEST_OFFLOADS | \ VIRTIO_NET_F_MTU | \ VIRTIO_NET_F_CTRL_VQ | \ VIRTIO_NET_F_CTRL_RX | \ From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:32 2021 Return-Path: Delivered-To: dev-commits-src-main@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 15C7A4E5363; Tue, 19 Jan 2021 05:08:32 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcB558nlz4XJ3; Tue, 19 Jan 2021 05:08:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A3FB20CE7; Tue, 19 Jan 2021 05:08:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58PNN086016; Tue, 19 Jan 2021 05:08:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58PvA086015; Tue, 19 Jan 2021 05:08:25 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:25 GMT Message-Id: <202101190508.10J58PvA086015@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 42343a631683 - main - if_vtnet: Add support for software LRO MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 42343a631683b6c49d0fd404b62c221e5d5ae8ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:32 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=42343a631683b6c49d0fd404b62c221e5d5ae8ea commit 42343a631683b6c49d0fd404b62c221e5d5ae8ea Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Add support for software LRO This useful when running on hosts that support checksum offloading but not the GUEST_TSO (LRO) feature. Or potentially, some GRO-like support when doing forwarding. Only enable SW LRO when the host LRO is not available since both tends to be harmful, and difficult to enable/disable selectively with only a single IFCAP_LRO flag. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27919 --- sys/dev/virtio/network/if_vtnet.c | 133 +++++++++++++++++++++++++++++------ sys/dev/virtio/network/if_vtnetvar.h | 13 +++- 2 files changed, 122 insertions(+), 24 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 2447f29a8820..6f1ef8506009 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -110,6 +111,7 @@ static void vtnet_free_rxtx_queues(struct vtnet_softc *); static int vtnet_alloc_rx_filters(struct vtnet_softc *); static void vtnet_free_rx_filters(struct vtnet_softc *); static int vtnet_alloc_virtqueues(struct vtnet_softc *); +static int vtnet_alloc_interface(struct vtnet_softc *); static int vtnet_setup_interface(struct vtnet_softc *); static int vtnet_ioctl_mtu(struct vtnet_softc *, int); static int vtnet_ioctl_ifflags(struct vtnet_softc *); @@ -231,6 +233,7 @@ static void vtnet_setup_rxq_sysctl(struct sysctl_ctx_list *, static void vtnet_setup_txq_sysctl(struct sysctl_ctx_list *, struct sysctl_oid_list *, struct vtnet_txq *); static void vtnet_setup_queue_sysctl(struct vtnet_softc *); +static void vtnet_load_tunables(struct vtnet_softc *); static void vtnet_setup_sysctl(struct vtnet_softc *); static int vtnet_rxq_enable_intr(struct vtnet_rxq *); @@ -299,6 +302,15 @@ TUNABLE_INT("hw.vtnet.rx_process_limit", &vtnet_rx_process_limit); SYSCTL_INT(_hw_vtnet, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, &vtnet_rx_process_limit, 0, "Limits RX segments processed in a single pass"); +static int vtnet_lro_entry_count = 128; +SYSCTL_INT(_hw_vtnet, OID_AUTO, lro_entry_count, CTLFLAG_RDTUN, + &vtnet_lro_entry_count, 0, "Software LRO entry count"); + +/* Enable sorted LRO, and the depth of the mbuf queue. */ +static int vtnet_lro_mbufq_depth = 0; +SYSCTL_UINT(_hw_vtnet, OID_AUTO, lro_mbufq_depth, CTLFLAG_RDTUN, + &vtnet_lro_mbufq_depth, 0, "Depth of software LRO mbuf queue"); + static uma_zone_t vtnet_tx_header_zone; static struct virtio_feature_desc vtnet_feature_desc[] = { @@ -433,6 +445,13 @@ vtnet_attach(device_t dev) VTNET_CORE_LOCK_INIT(sc); callout_init_mtx(&sc->vtnet_tick_ch, VTNET_CORE_MTX(sc), 0); + vtnet_load_tunables(sc); + + error = vtnet_alloc_interface(sc); + if (error) { + device_printf(dev, "cannot allocate interface\n"); + goto fail; + } vtnet_setup_sysctl(sc); vtnet_setup_features(sc); @@ -651,8 +670,8 @@ vtnet_negotiate_features(struct vtnet_softc *sc) */ if (!virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) { device_printf(dev, - "LRO disabled since both mergeable buffers and " - "indirect descriptors were not negotiated\n"); + "Host LRO disabled since both mergeable buffers " + "and indirect descriptors were not negotiated\n"); features &= ~VTNET_LRO_FEATURES; negotiated_features = virtio_negotiate_features(dev, features); @@ -709,6 +728,14 @@ vtnet_setup_features(struct vtnet_softc *sc) else sc->vtnet_rx_nsegs = VTNET_RX_SEGS_HDR_SEPARATE; + /* + * Favor "hardware" LRO if negotiated, but support software LRO as + * a fallback; there is usually little benefit (or worse) with both. + */ + if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) == 0 && + virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6) == 0) + sc->vtnet_flags |= VTNET_FLAG_SW_LRO; + if (virtio_with_feature(dev, VIRTIO_NET_F_GSO) || virtio_with_feature(dev, VIRTIO_NET_F_HOST_TSO4) || virtio_with_feature(dev, VIRTIO_NET_F_HOST_TSO6)) @@ -775,6 +802,14 @@ vtnet_init_rxq(struct vtnet_softc *sc, int id) if (rxq->vtnrx_sg == NULL) return (ENOMEM); +#if defined(INET) || defined(INET6) + if (vtnet_software_lro(sc)) { + if (tcp_lro_init_args(&rxq->vtnrx_lro, sc->vtnet_ifp, + sc->vtnet_lro_entry_count, sc->vtnet_lro_mbufq_depth) != 0) + return (ENOMEM); + } +#endif + NET_TASK_INIT(&rxq->vtnrx_intrtask, 0, vtnet_rxq_tq_intr, rxq); rxq->vtnrx_tq = taskqueue_create(rxq->vtnrx_name, M_NOWAIT, taskqueue_thread_enqueue, &rxq->vtnrx_tq); @@ -853,6 +888,10 @@ vtnet_destroy_rxq(struct vtnet_rxq *rxq) rxq->vtnrx_sc = NULL; rxq->vtnrx_id = -1; +#if defined(INET) || defined(INET6) + tcp_lro_free(&rxq->vtnrx_lro); +#endif + if (rxq->vtnrx_sg != NULL) { sglist_free(rxq->vtnrx_sg); rxq->vtnrx_sg = NULL; @@ -992,22 +1031,34 @@ vtnet_alloc_virtqueues(struct vtnet_softc *sc) } static int -vtnet_setup_interface(struct vtnet_softc *sc) +vtnet_alloc_interface(struct vtnet_softc *sc) { device_t dev; - struct pfil_head_args pa; struct ifnet *ifp; dev = sc->vtnet_dev; - ifp = sc->vtnet_ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) { - device_printf(dev, "cannot allocate ifnet structure\n"); - return (ENOSPC); - } + ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) + return (ENOMEM); - if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + sc->vtnet_ifp = ifp; ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + + return (0); +} + +static int +vtnet_setup_interface(struct vtnet_softc *sc) +{ + device_t dev; + struct pfil_head_args pa; + struct ifnet *ifp; + + dev = sc->vtnet_dev; + ifp = sc->vtnet_ifp; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | IFF_KNOWSEPOCH; ifp->if_baudrate = IF_Gbps(10); @@ -1072,10 +1123,8 @@ vtnet_setup_interface(struct vtnet_softc *sc) vtnet_fixup_needs_csum) != 0) sc->vtnet_flags |= VTNET_FLAG_FIXUP_NEEDS_CSUM; - if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || - virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6) || - virtio_with_feature(dev, VIRTIO_NET_F_GUEST_ECN)) - ifp->if_capabilities |= IFCAP_LRO; + /* Support either "hardware" or software LRO. */ + ifp->if_capabilities |= IFCAP_LRO; } if (ifp->if_capabilities & (IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6)) { @@ -1263,6 +1312,11 @@ vtnet_ioctl_ifcap(struct vtnet_softc *sc, struct ifreq *ifr) else reinit = 1; + /* BMV: Avoid needless renegotiation for just software LRO. */ + if ((mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6 | IFCAP_LRO)) == + IFCAP_LRO && vtnet_software_lro(sc)) + reinit = update = 0; + if (mask & IFCAP_RXCSUM) ifp->if_capenable ^= IFCAP_RXCSUM; if (mask & IFCAP_RXCSUM_IPV6) @@ -1869,6 +1923,23 @@ fail: return (1); } +#if defined(INET) || defined(INET6) +static int +vtnet_lro_rx(struct vtnet_rxq *rxq, struct mbuf *m) +{ + struct lro_ctrl *lro; + + lro = &rxq->vtnrx_lro; + + if (lro->lro_mbuf_max != 0) { + tcp_lro_queue_mbuf(lro, m); + return (0); + } + + return (tcp_lro_rx(lro, m, 0)); +} +#endif + static void vtnet_rxq_input(struct vtnet_rxq *rxq, struct mbuf *m, struct virtio_net_hdr *hdr) @@ -1906,9 +1977,14 @@ vtnet_rxq_input(struct vtnet_rxq *rxq, struct mbuf *m, rxq->vtnrx_stats.vrxs_ipackets++; rxq->vtnrx_stats.vrxs_ibytes += m->m_pkthdr.len; - VTNET_RXQ_UNLOCK(rxq); +#if defined(INET) || defined(INET6) + if (vtnet_software_lro(sc) && ifp->if_capenable & IFCAP_LRO) { + if (vtnet_lro_rx(rxq, m) == 0) + return; + } +#endif + (*ifp->if_input)(ifp, m); - VTNET_RXQ_LOCK(rxq); } static int @@ -2013,14 +2089,14 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) } vtnet_rxq_input(rxq, m, &lhdr); - - /* Must recheck after dropping the Rx lock. */ - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - break; } - if (deq > 0) + if (deq > 0) { +#if defined(INET) || defined(INET6) + tcp_lro_flush_all(&rxq->vtnrx_lro); +#endif virtqueue_notify(vq); + } return (count > 0 ? 0 : EAGAIN); } @@ -3226,7 +3302,7 @@ vtnet_update_rx_offloads(struct vtnet_softc *sc) features &= ~VIRTIO_NET_F_GUEST_CSUM; } - if (ifp->if_capabilities & IFCAP_LRO) { + if (ifp->if_capabilities & IFCAP_LRO && !vtnet_software_lro(sc)) { if (ifp->if_capenable & IFCAP_LRO) features |= VTNET_LRO_FEATURES; else @@ -4106,6 +4182,19 @@ vtnet_setup_sysctl(struct vtnet_softc *sc) vtnet_setup_stat_sysctl(ctx, child, sc); } +static void +vtnet_load_tunables(struct vtnet_softc *sc) +{ + + sc->vtnet_lro_entry_count = vtnet_tunable_int(sc, + "lro_entry_count", vtnet_lro_entry_count); + if (sc->vtnet_lro_entry_count < TCP_LRO_ENTRIES) + sc->vtnet_lro_entry_count = TCP_LRO_ENTRIES; + + sc->vtnet_lro_mbufq_depth = vtnet_tunable_int(sc, + "lro_mbufq_depth", vtnet_lro_mbufq_depth); +} + static int vtnet_rxq_enable_intr(struct vtnet_rxq *rxq) { diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h index 1f94325604fe..ed4921454d7d 100644 --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -79,6 +79,7 @@ struct vtnet_rxq { struct vtnet_rxq_stats vtnrx_stats; struct taskqueue *vtnrx_tq; struct task vtnrx_intrtask; + struct lro_ctrl vtnrx_lro; #ifdef DEV_NETMAP uint32_t vtnrx_nm_refill; struct virtio_net_hdr_mrg_rxbuf vtnrx_shrhdr; @@ -155,6 +156,7 @@ struct vtnet_softc { #define VTNET_FLAG_EVENT_IDX 0x0800 #define VTNET_FLAG_SUSPENDED 0x1000 #define VTNET_FLAG_FIXUP_NEEDS_CSUM 0x2000 +#define VTNET_FLAG_SW_LRO 0x4000 int vtnet_link_active; int vtnet_hdr_size; @@ -168,6 +170,8 @@ struct vtnet_softc { int vtnet_act_vq_pairs; int vtnet_max_vq_pairs; int vtnet_requested_vq_pairs; + int vtnet_lro_entry_count; + int vtnet_lro_mbufq_depth; struct virtqueue *vtnet_ctrl_vq; struct vtnet_mac_filter *vtnet_mac_filter; @@ -192,6 +196,12 @@ vtnet_modern(struct vtnet_softc *sc) return ((sc->vtnet_flags & VTNET_FLAG_MODERN) != 0); } +static bool +vtnet_software_lro(struct vtnet_softc *sc) +{ + return ((sc->vtnet_flags & VTNET_FLAG_SW_LRO) != 0); +} + /* * Maximum number of queue pairs we will autoconfigure to. */ @@ -325,8 +335,7 @@ CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE); /* * The VIRTIO_NET_F_GUEST_TSO[46] features permit the host to send us - * frames larger than 1514 bytes. We do not yet support software LRO - * via tcp_lro_rx(). + * frames larger than 1514 bytes. */ #define VTNET_LRO_FEATURES (VIRTIO_NET_F_GUEST_TSO4 | \ VIRTIO_NET_F_GUEST_TSO6 | VIRTIO_NET_F_GUEST_ECN) From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:08:29 2021 Return-Path: Delivered-To: dev-commits-src-main@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 880444E535B; Tue, 19 Jan 2021 05:08:29 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKcB452xcz4XR2; Tue, 19 Jan 2021 05:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6873E206E7; Tue, 19 Jan 2021 05:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J58OoB085994; Tue, 19 Jan 2021 05:08:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J58OaU085993; Tue, 19 Jan 2021 05:08:24 GMT (envelope-from git) Date: Tue, 19 Jan 2021 05:08:24 GMT Message-Id: <202101190508.10J58OaU085993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Venteicher Subject: git: 177761e4c467 - main - if_vtnet: Set the interface max TSO values MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bryanv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 177761e4c4673612dd64793a31a90142d9a04e62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:08:30 -0000 The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=177761e4c4673612dd64793a31a90142d9a04e62 commit 177761e4c4673612dd64793a31a90142d9a04e62 Author: Bryan Venteicher AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Set the interface max TSO values Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27917 --- sys/dev/virtio/network/if_vtnet.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 642c513ff0b3..2447f29a8820 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -289,6 +289,11 @@ TUNABLE_INT("hw.vtnet.mq_max_pairs", &vtnet_mq_max_pairs); SYSCTL_INT(_hw_vtnet, OID_AUTO, mq_max_pairs, CTLFLAG_RDTUN, &vtnet_mq_max_pairs, 0, "Sets the maximum number of multiqueue pairs"); +static int vtnet_tso_maxlen = IP_MAXPACKET; +TUNABLE_INT("hw.vtnet.tso_maxlen", &vtnet_tso_maxlen); +SYSCTL_INT(_hw_vtnet, OID_AUTO, tso_maxlen, CTLFLAG_RDTUN, + &vtnet_tso_maxlen, 0, "TSO burst limit"); + static int vtnet_rx_process_limit = 1024; TUNABLE_INT("hw.vtnet.rx_process_limit", &vtnet_rx_process_limit); SYSCTL_INT(_hw_vtnet, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, @@ -1042,8 +1047,18 @@ vtnet_setup_interface(struct vtnet_softc *sc) if (gso || virtio_with_feature(dev, VIRTIO_NET_F_HOST_ECN)) sc->vtnet_flags |= VTNET_FLAG_TSO_ECN; - if (ifp->if_capabilities & (IFCAP_TSO4 | IFCAP_TSO6)) + if (ifp->if_capabilities & (IFCAP_TSO4 | IFCAP_TSO6)) { + int tso_maxlen; + ifp->if_capabilities |= IFCAP_VLAN_HWTSO; + + tso_maxlen = vtnet_tunable_int(sc, "tso_maxlen", + vtnet_tso_maxlen); + ifp->if_hw_tsomax = tso_maxlen - + (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN); + ifp->if_hw_tsomaxsegcount = sc->vtnet_tx_nsegs - 1; + ifp->if_hw_tsomaxsegsize = PAGE_SIZE; + } } if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) { From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:12:10 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6AD6E4E5E15 for ; Tue, 19 Jan 2021 05:12:10 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DKcGK5CVGz4ZZ5 for ; Tue, 19 Jan 2021 05:12:08 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f47.google.com with SMTP id m2so164063wmm.1 for ; Mon, 18 Jan 2021 21:12:08 -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:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=l+LvbiTR0tWlE/nE7/Svkl+/OsIWPb0s6Ek4igm9bos=; b=ZMnPvQWVLdOBvkzR70ZSF+KrXsiu45OuhUMJS2PCUWRzBtHQPIEa2Zis2OmQNJTiz6 AJtu7qOgQIcga2dUjU1QHUmgj516UCFNiBEx/asGPk3a582oVWP8wQq91QpBpGPfnaWV YTw7wdVUnwV4ziB3jAMY2SFAEyjfvzVnmT/wYJ9Mu++LQgU7RwhtQbcEPKQzqcmJvXBO Z2JMcdUBZwUP31prF2rRlShXEEsKKajt+LAhM4Y6rWb2r4MAtq/OVZ2Till1yivUDPmt iDIoNQRTR4fvnlbbu77sS2Xp03hoNzh8/6VaQJjjWV9f2mtmPOU+tdqmsIYaLOY9CmO7 mQBA== X-Gm-Message-State: AOAM532KUK/ojTx4DwLeKX28Ct64KglD+lijKjp3AFjleOMcuvjlVC6p 4lXC5kYtkRMvpFFtuWuT0flHKMd4ZOjNKNWv X-Google-Smtp-Source: ABdhPJyxgefvVqgYbf2wRgAdHXV+MMn4Z+5b4Q+PWcopL6NQoB+djxhFrLnhtvf/3HP88NotsXqI0w== X-Received: by 2002:a05:600c:19cb:: with SMTP id u11mr2277806wmq.110.1611033125704; Mon, 18 Jan 2021 21:12:05 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id z15sm239181wrt.8.2021.01.18.21.12.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jan 2021 21:12:05 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: fbe0c4f4c7f4 - main - virtio: Add modern (v1) virtqueue support From: Jessica Clarke In-Reply-To: <202101190508.10J581lo085577@gitrepo.freebsd.org> Date: Tue, 19 Jan 2021 05:12:03 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <850BBBD1-3068-4D1B-B828-201E48EA460A@freebsd.org> References: <202101190508.10J581lo085577@gitrepo.freebsd.org> To: Bryan Venteicher X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DKcGK5CVGz4ZZ5 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:12:10 -0000 Hi Bryan, Neither of my review comments from 2.5 weeks ago were addressed. Jess On 19 Jan 2021, at 05:08, Bryan Venteicher wrote: >=20 > The branch main has been updated by bryanv: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dfbe0c4f4c7f4474def7b041c29c1e2fa= cf2af08b >=20 > commit fbe0c4f4c7f4474def7b041c29c1e2facf2af08b > Author: Bryan Venteicher > AuthorDate: 2021-01-19 04:55:23 +0000 > Commit: Bryan Venteicher > CommitDate: 2021-01-19 04:55:23 +0000 >=20 > virtio: Add modern (v1) virtqueue support >=20 > This only supports the legacy virtqueue format that is now called > "Split Virtqueues". Support for the new "Packed Virtqueues" = described > in v1.1 is left for a later date. >=20 > Reviewed by: grehan (mentor) > Differential Revision: https://reviews.freebsd.org/D27857 > --- > sys/dev/virtio/virtqueue.c | 141 = ++++++++++++++++++++++++--------------------- > sys/dev/virtio/virtqueue.h | 2 - > 2 files changed, 75 insertions(+), 68 deletions(-) >=20 > diff --git a/sys/dev/virtio/virtqueue.c b/sys/dev/virtio/virtqueue.c > index da6e7bf89fd5..14c2088b70a8 100644 > --- a/sys/dev/virtio/virtqueue.c > +++ b/sys/dev/virtio/virtqueue.c > @@ -57,19 +57,15 @@ __FBSDID("$FreeBSD$"); >=20 > struct virtqueue { > device_t vq_dev; > - char vq_name[VIRTQUEUE_MAX_NAME_SZ]; > uint16_t vq_queue_index; > uint16_t vq_nentries; > uint32_t vq_flags; > -#define VIRTQUEUE_FLAG_INDIRECT 0x0001 > -#define VIRTQUEUE_FLAG_EVENT_IDX 0x0002 > +#define VIRTQUEUE_FLAG_MODERN 0x0001 > +#define VIRTQUEUE_FLAG_INDIRECT 0x0002 > +#define VIRTQUEUE_FLAG_EVENT_IDX 0x0004 >=20 > - bus_size_t vq_notify_offset; > - int vq_alignment; > - int vq_ring_size; > - void *vq_ring_mem; > int vq_max_indirect_size; > - int vq_indirect_mem_size; > + bus_size_t vq_notify_offset; > virtqueue_intr_t *vq_intrhand; > void *vq_intrhand_arg; >=20 > @@ -88,6 +84,12 @@ struct virtqueue { > */ > uint16_t vq_used_cons_idx; >=20 > + void *vq_ring_mem; > + int vq_indirect_mem_size; > + int vq_alignment; > + int vq_ring_size; > + char vq_name[VIRTQUEUE_MAX_NAME_SZ]; > + > struct vq_desc_extra { > void *cookie; > struct vring_desc *indirect; > @@ -135,17 +137,13 @@ static int vq_ring_must_notify_host(struct = virtqueue *); > static void vq_ring_notify_host(struct virtqueue *); > static void vq_ring_free_chain(struct virtqueue *, uint16_t); >=20 > -uint64_t > -virtqueue_filter_features(uint64_t features) > -{ > - uint64_t mask; > - > - mask =3D (1 << VIRTIO_TRANSPORT_F_START) - 1; > - mask |=3D VIRTIO_RING_F_INDIRECT_DESC; > - mask |=3D VIRTIO_RING_F_EVENT_IDX; > - > - return (features & mask); > -} > +#define vq_modern(_vq) (((_vq)->vq_flags & = VIRTQUEUE_FLAG_MODERN) !=3D 0) > +#define vq_htog16(_vq, _val) virtio_htog16(vq_modern(_vq), = _val) > +#define vq_htog32(_vq, _val) virtio_htog32(vq_modern(_vq), = _val) > +#define vq_htog64(_vq, _val) virtio_htog64(vq_modern(_vq), = _val) > +#define vq_gtoh16(_vq, _val) virtio_gtoh16(vq_modern(_vq), = _val) > +#define vq_gtoh32(_vq, _val) virtio_gtoh32(vq_modern(_vq), = _val) > +#define vq_gtoh64(_vq, _val) virtio_gtoh64(vq_modern(_vq), = _val) >=20 > int > virtqueue_alloc(device_t dev, uint16_t queue, uint16_t size, > @@ -193,6 +191,8 @@ virtqueue_alloc(device_t dev, uint16_t queue, = uint16_t size, > vq->vq_intrhand =3D info->vqai_intr; > vq->vq_intrhand_arg =3D info->vqai_intr_arg; >=20 > + if (VIRTIO_BUS_WITH_FEATURE(dev, VIRTIO_F_VERSION_1) !=3D 0) > + vq->vq_flags |=3D VIRTQUEUE_FLAG_MODERN; > if (VIRTIO_BUS_WITH_FEATURE(dev, VIRTIO_RING_F_EVENT_IDX) !=3D = 0) > vq->vq_flags |=3D VIRTQUEUE_FLAG_EVENT_IDX; >=20 > @@ -297,8 +297,8 @@ virtqueue_init_indirect_list(struct virtqueue *vq, > bzero(indirect, vq->vq_indirect_mem_size); >=20 > for (i =3D 0; i < vq->vq_max_indirect_size - 1; i++) > - indirect[i].next =3D i + 1; > - indirect[i].next =3D VQ_RING_DESC_CHAIN_END; > + indirect[i].next =3D vq_gtoh16(vq, i + 1); > + indirect[i].next =3D vq_gtoh16(vq, VQ_RING_DESC_CHAIN_END); > } >=20 > int > @@ -396,6 +396,7 @@ virtqueue_used_paddr(struct virtqueue *vq) > uint16_t > virtqueue_index(struct virtqueue *vq) > { > + > return (vq->vq_queue_index); > } >=20 > @@ -444,7 +445,7 @@ virtqueue_nused(struct virtqueue *vq) > { > uint16_t used_idx, nused; >=20 > - used_idx =3D vq->vq_ring.used->idx; > + used_idx =3D vq_htog16(vq, vq->vq_ring.used->idx); >=20 > nused =3D (uint16_t)(used_idx - vq->vq_used_cons_idx); > VQASSERT(vq, nused <=3D vq->vq_nentries, "used more than = available"); > @@ -456,7 +457,7 @@ int > virtqueue_intr_filter(struct virtqueue *vq) > { >=20 > - if (vq->vq_used_cons_idx =3D=3D vq->vq_ring.used->idx) > + if (vq->vq_used_cons_idx =3D=3D vq_htog16(vq, = vq->vq_ring.used->idx)) > return (0); >=20 > virtqueue_disable_intr(vq); > @@ -483,7 +484,7 @@ virtqueue_postpone_intr(struct virtqueue *vq, = vq_postpone_t hint) > { > uint16_t ndesc, avail_idx; >=20 > - avail_idx =3D vq->vq_ring.avail->idx; > + avail_idx =3D vq_htog16(vq, vq->vq_ring.avail->idx); > ndesc =3D (uint16_t)(avail_idx - vq->vq_used_cons_idx); >=20 > switch (hint) { > @@ -508,10 +509,12 @@ virtqueue_disable_intr(struct virtqueue *vq) > { >=20 > if (vq->vq_flags & VIRTQUEUE_FLAG_EVENT_IDX) { > - vring_used_event(&vq->vq_ring) =3D vq->vq_used_cons_idx = - > - vq->vq_nentries - 1; > - } else > - vq->vq_ring.avail->flags |=3D = VRING_AVAIL_F_NO_INTERRUPT; > + vring_used_event(&vq->vq_ring) =3D vq_gtoh16(vq, > + vq->vq_used_cons_idx - vq->vq_nentries - 1); > + return; > + } > + > + vq->vq_ring.avail->flags |=3D vq_gtoh16(vq, = VRING_AVAIL_F_NO_INTERRUPT); > } >=20 > int > @@ -574,16 +577,16 @@ virtqueue_dequeue(struct virtqueue *vq, uint32_t = *len) > void *cookie; > uint16_t used_idx, desc_idx; >=20 > - if (vq->vq_used_cons_idx =3D=3D vq->vq_ring.used->idx) > + if (vq->vq_used_cons_idx =3D=3D vq_htog16(vq, = vq->vq_ring.used->idx)) > return (NULL); >=20 > used_idx =3D vq->vq_used_cons_idx++ & (vq->vq_nentries - 1); > uep =3D &vq->vq_ring.used->ring[used_idx]; >=20 > rmb(); > - desc_idx =3D (uint16_t) uep->id; > + desc_idx =3D (uint16_t) vq_htog32(vq, uep->id); > if (len !=3D NULL) > - *len =3D uep->len; > + *len =3D vq_htog32(vq, uep->len); >=20 > vq_ring_free_chain(vq, desc_idx); >=20 > @@ -641,13 +644,13 @@ virtqueue_dump(struct virtqueue *vq) > printf("VQ: %s - size=3D%d; free=3D%d; used=3D%d; queued=3D%d; " > "desc_head_idx=3D%d; avail.idx=3D%d; used_cons_idx=3D%d; " > "used.idx=3D%d; used_event_idx=3D%d; avail.flags=3D0x%x; = used.flags=3D0x%x\n", > - vq->vq_name, vq->vq_nentries, vq->vq_free_cnt, > - virtqueue_nused(vq), vq->vq_queued_cnt, = vq->vq_desc_head_idx, > - vq->vq_ring.avail->idx, vq->vq_used_cons_idx, > - vq->vq_ring.used->idx, > - vring_used_event(&vq->vq_ring), > - vq->vq_ring.avail->flags, > - vq->vq_ring.used->flags); > + vq->vq_name, vq->vq_nentries, vq->vq_free_cnt, = virtqueue_nused(vq), > + vq->vq_queued_cnt, vq->vq_desc_head_idx, > + vq_htog16(vq, vq->vq_ring.avail->idx), vq->vq_used_cons_idx, > + vq_htog16(vq, vq->vq_ring.used->idx), > + vq_htog16(vq, vring_used_event(&vq->vq_ring)), > + vq_htog16(vq, vq->vq_ring.avail->flags), > + vq_htog16(vq, vq->vq_ring.used->flags)); > } >=20 > static void > @@ -664,14 +667,14 @@ vq_ring_init(struct virtqueue *vq) > vring_init(vr, size, ring_mem, vq->vq_alignment); >=20 > for (i =3D 0; i < size - 1; i++) > - vr->desc[i].next =3D i + 1; > - vr->desc[i].next =3D VQ_RING_DESC_CHAIN_END; > + vr->desc[i].next =3D vq_gtoh16(vq, i + 1); > + vr->desc[i].next =3D vq_gtoh16(vq, VQ_RING_DESC_CHAIN_END); > } >=20 > static void > vq_ring_update_avail(struct virtqueue *vq, uint16_t desc_idx) > { > - uint16_t avail_idx; > + uint16_t avail_idx, avail_ring_idx; >=20 > /* > * Place the head of the descriptor chain into the next slot and = make > @@ -680,11 +683,12 @@ vq_ring_update_avail(struct virtqueue *vq, = uint16_t desc_idx) > * currently running on another CPU, we can keep it processing = the new > * descriptor. > */ > - avail_idx =3D vq->vq_ring.avail->idx & (vq->vq_nentries - 1); > - vq->vq_ring.avail->ring[avail_idx] =3D desc_idx; > + avail_idx =3D vq_htog16(vq, vq->vq_ring.avail->idx); > + avail_ring_idx =3D avail_idx & (vq->vq_nentries - 1); > + vq->vq_ring.avail->ring[avail_ring_idx] =3D vq_gtoh16(vq, = desc_idx); >=20 > wmb(); > - vq->vq_ring.avail->idx++; > + vq->vq_ring.avail->idx =3D vq_gtoh16(vq, avail_idx + 1); >=20 > /* Keep pending count until virtqueue_notify(). */ > vq->vq_queued_cnt++; > @@ -703,19 +707,19 @@ vq_ring_enqueue_segments(struct virtqueue *vq, = struct vring_desc *desc, >=20 > for (i =3D 0, idx =3D head_idx, seg =3D sg->sg_segs; > i < needed; > - i++, idx =3D dp->next, seg++) { > + i++, idx =3D vq_htog16(vq, dp->next), seg++) { > VQASSERT(vq, idx !=3D VQ_RING_DESC_CHAIN_END, > "premature end of free desc chain"); >=20 > dp =3D &desc[idx]; > - dp->addr =3D seg->ss_paddr; > - dp->len =3D seg->ss_len; > + dp->addr =3D vq_gtoh64(vq, seg->ss_paddr); > + dp->len =3D vq_gtoh32(vq, seg->ss_len); > dp->flags =3D 0; >=20 > if (i < needed - 1) > - dp->flags |=3D VRING_DESC_F_NEXT; > + dp->flags |=3D vq_gtoh16(vq, VRING_DESC_F_NEXT); > if (i >=3D readable) > - dp->flags |=3D VRING_DESC_F_WRITE; > + dp->flags |=3D vq_gtoh16(vq, = VRING_DESC_F_WRITE); > } >=20 > return (idx); > @@ -760,14 +764,14 @@ vq_ring_enqueue_indirect(struct virtqueue *vq, = void *cookie, > dxp->cookie =3D cookie; > dxp->ndescs =3D 1; >=20 > - dp->addr =3D dxp->indirect_paddr; > - dp->len =3D needed * sizeof(struct vring_desc); > - dp->flags =3D VRING_DESC_F_INDIRECT; > + dp->addr =3D vq_gtoh64(vq, dxp->indirect_paddr); > + dp->len =3D vq_gtoh32(vq, needed * sizeof(struct vring_desc)); > + dp->flags =3D vq_gtoh16(vq, VRING_DESC_F_INDIRECT); >=20 > vq_ring_enqueue_segments(vq, dxp->indirect, 0, > sg, readable, writable); >=20 > - vq->vq_desc_head_idx =3D dp->next; > + vq->vq_desc_head_idx =3D vq_htog16(vq, dp->next); > vq->vq_free_cnt--; > if (vq->vq_free_cnt =3D=3D 0) > VQ_RING_ASSERT_CHAIN_TERM(vq); > @@ -785,10 +789,13 @@ vq_ring_enable_interrupt(struct virtqueue *vq, = uint16_t ndesc) > * Enable interrupts, making sure we get the latest index of > * what's already been consumed. > */ > - if (vq->vq_flags & VIRTQUEUE_FLAG_EVENT_IDX) > - vring_used_event(&vq->vq_ring) =3D vq->vq_used_cons_idx = + ndesc; > - else > - vq->vq_ring.avail->flags &=3D = ~VRING_AVAIL_F_NO_INTERRUPT; > + if (vq->vq_flags & VIRTQUEUE_FLAG_EVENT_IDX) { > + vring_used_event(&vq->vq_ring) =3D > + vq_gtoh16(vq, vq->vq_used_cons_idx + ndesc); > + } else { > + vq->vq_ring.avail->flags &=3D > + vq_gtoh16(vq, ~VRING_AVAIL_F_NO_INTERRUPT); > + } >=20 > mb(); >=20 > @@ -806,17 +813,18 @@ vq_ring_enable_interrupt(struct virtqueue *vq, = uint16_t ndesc) > static int > vq_ring_must_notify_host(struct virtqueue *vq) > { > - uint16_t new_idx, prev_idx, event_idx; > + uint16_t new_idx, prev_idx, event_idx, flags; >=20 > if (vq->vq_flags & VIRTQUEUE_FLAG_EVENT_IDX) { > - new_idx =3D vq->vq_ring.avail->idx; > + new_idx =3D vq_htog16(vq, vq->vq_ring.avail->idx); > prev_idx =3D new_idx - vq->vq_queued_cnt; > - event_idx =3D vring_avail_event(&vq->vq_ring); > + event_idx =3D vq_htog16(vq, = vring_avail_event(&vq->vq_ring)); >=20 > return (vring_need_event(event_idx, new_idx, prev_idx) = !=3D 0); > } >=20 > - return ((vq->vq_ring.used->flags & VRING_USED_F_NO_NOTIFY) =3D=3D = 0); > + flags =3D vq->vq_ring.used->flags; > + return ((flags & vq_gtoh16(vq, VRING_USED_F_NO_NOTIFY)) =3D=3D = 0); > } >=20 > static void > @@ -843,10 +851,11 @@ vq_ring_free_chain(struct virtqueue *vq, = uint16_t desc_idx) > vq->vq_free_cnt +=3D dxp->ndescs; > dxp->ndescs--; >=20 > - if ((dp->flags & VRING_DESC_F_INDIRECT) =3D=3D 0) { > - while (dp->flags & VRING_DESC_F_NEXT) { > - VQ_RING_ASSERT_VALID_IDX(vq, dp->next); > - dp =3D &vq->vq_ring.desc[dp->next]; > + if ((dp->flags & vq_gtoh16(vq, VRING_DESC_F_INDIRECT)) =3D=3D 0) = { > + while (dp->flags & vq_gtoh16(vq, VRING_DESC_F_NEXT)) { > + uint16_t next_idx =3D vq_htog16(vq, dp->next); > + VQ_RING_ASSERT_VALID_IDX(vq, next_idx); > + dp =3D &vq->vq_ring.desc[next_idx]; > dxp->ndescs--; > } > } > @@ -859,6 +868,6 @@ vq_ring_free_chain(struct virtqueue *vq, uint16_t = desc_idx) > * newly freed chain. If the virtqueue was completely used, then > * head would be VQ_RING_DESC_CHAIN_END (ASSERTed above). > */ > - dp->next =3D vq->vq_desc_head_idx; > + dp->next =3D vq_gtoh16(vq, vq->vq_desc_head_idx); > vq->vq_desc_head_idx =3D desc_idx; > } > diff --git a/sys/dev/virtio/virtqueue.h b/sys/dev/virtio/virtqueue.h > index 6ac5899cf0c3..4bde4e32edc6 100644 > --- a/sys/dev/virtio/virtqueue.h > +++ b/sys/dev/virtio/virtqueue.h > @@ -67,8 +67,6 @@ struct vq_alloc_info { > (_i)->vqai_vq =3D (_vqp); = \ > } while (0) >=20 > -uint64_t virtqueue_filter_features(uint64_t features); > - > int virtqueue_alloc(device_t dev, uint16_t queue, uint16_t size, > bus_size_t notify_offset, int align, vm_paddr_t highaddr, > struct vq_alloc_info *info, struct virtqueue **vqp); Jess From owner-dev-commits-src-main@freebsd.org Tue Jan 19 05:14:35 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C29384E61DC for ; Tue, 19 Jan 2021 05:14:34 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DKcK55rvtz4cWn for ; Tue, 19 Jan 2021 05:14:33 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f41.google.com with SMTP id v15so14786251wrx.4 for ; Mon, 18 Jan 2021 21:14:33 -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:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ACClfuS4aKq1PldDcj009bG0VQ/7ta5h0LutqSHOGlw=; b=dNy7f5EDLPMx0cl0NWVH7DwHgGvWgk6g5C01bu8wXQHfRGongkoAyIeS0GPNdA6ASZ M+wuQxbXDWsHIb1G7bcRmVViQoQ2ODQSX95l56GDQk78wtzup113UrDeqCPOW+rMx+et Ia7WX3FWWiVK7a20WXVGeqb9IMnSq9pzjV3MddvgtJmKzGTHIx8dCjpZ0V9R2pmL8Uws e07liecPDBtehfyeBSdlj6II9pBaqrt8xI4OwqnbxUoatQ50F4yzvue1ygBY+NfBiKLS LsO41S0gPV2a+xGPkMVC4P76Fsr9NCiXLZ/gH1rLs/XhF56joJU0jOnLucJrfNQEBy4d dnww== X-Gm-Message-State: AOAM532iA23if1dx3USe6r8FYgwM4m4DTg7x0heYReXuGuc15ZBWzn26 30Key6BFnmaWoJo8Pf0WlYHIvQ== X-Google-Smtp-Source: ABdhPJydodmlY8pZ6ZflSmRh408TiHXne2Bd088TE2qM3f4dTMhHEQVybDVP2/3f44jZVfoDetWrtw== X-Received: by 2002:adf:ae01:: with SMTP id x1mr2400852wrc.381.1611033268098; Mon, 18 Jan 2021 21:14:28 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id f14sm34066380wre.69.2021.01.18.21.14.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jan 2021 21:14:27 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 9da9560c4dd3 - main - virtio: Add VirtIO PCI modern (V1) support From: Jessica Clarke In-Reply-To: <202101190508.10J580Tb085558@gitrepo.freebsd.org> Date: Tue, 19 Jan 2021 05:14:26 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <1CDD0314-F132-4E38-A614-53EBF8738209@freebsd.org> References: <202101190508.10J580Tb085558@gitrepo.freebsd.org> To: Bryan Venteicher X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DKcK55rvtz4cWn X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 05:14:35 -0000 Hi Bryan, I had a couple of unaddressed review comments still unresolved. Jess > On 19 Jan 2021, at 05:08, Bryan Venteicher wrote: >=20 > The branch main has been updated by bryanv: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D9da9560c4dd3556519cd391a04f0db15= 7dc3c295 >=20 > commit 9da9560c4dd3556519cd391a04f0db157dc3c295 > Author: Bryan Venteicher > AuthorDate: 2021-01-19 04:55:23 +0000 > Commit: Bryan Venteicher > CommitDate: 2021-01-19 04:55:23 +0000 >=20 > virtio: Add VirtIO PCI modern (V1) support >=20 > Use the existing legacy PCI driver as the basis for shared code > between the legacy and modern PCI drivers. The existing virtio_pci > kernel module will contain both the legacy and modern drivers. >=20 > Changes to the virtqueue and each device driver (network, block, = etc) > for V1 support come in later commits. >=20 > Update the MMIO driver to reflect the VirtIO bus method changes, = but > the modern compliance can be improved on later. >=20 > Note that the modern PCI driver requires bus_map_resource() to be > implemented, which is not the case on all archs. >=20 > The hw.virtio.pci.transitional tunable default value is zero so > transitional devices will continue to be driven via the legacy > driver. >=20 > Reviewed by: grehan (mentor) > Differential Revision: https://reviews.freebsd.org/D27856 > --- > sys/conf/files | 3 + > sys/dev/virtio/mmio/virtio_mmio.c | 23 +- > sys/dev/virtio/pci/virtio_pci.c | 1297 = +++++++++---------------- > sys/dev/virtio/pci/virtio_pci.h | 173 ++-- > sys/dev/virtio/pci/virtio_pci_if.m | 71 ++ > sys/dev/virtio/pci/virtio_pci_legacy.c | 733 ++++++++++++++ > sys/dev/virtio/pci/virtio_pci_legacy_var.h | 78 ++ > sys/dev/virtio/pci/virtio_pci_modern.c | 1448 = ++++++++++++++++++++++++++++ > sys/dev/virtio/pci/virtio_pci_modern_var.h | 135 +++ > sys/dev/virtio/pci/virtio_pci_var.h | 55 ++ > sys/dev/virtio/virtio.c | 76 +- > sys/dev/virtio/virtio.h | 8 + > sys/dev/virtio/virtio_bus_if.m | 11 + > sys/dev/virtio/virtio_endian.h | 106 ++ > sys/dev/virtio/virtqueue.c | 10 +- > sys/dev/virtio/virtqueue.h | 4 +- > sys/modules/virtio/pci/Makefile | 5 +- > 17 files changed, 3292 insertions(+), 944 deletions(-) >=20 > diff --git a/sys/conf/files b/sys/conf/files > index e641b79d9c46..79f3b7ca54e6 100644 > --- a/sys/conf/files > +++ b/sys/conf/files > @@ -3457,6 +3457,9 @@ dev/virtio/virtqueue.c optional = virtio > dev/virtio/virtio_bus_if.m optional virtio > dev/virtio/virtio_if.m optional virtio > dev/virtio/pci/virtio_pci.c optional virtio_pci > +dev/virtio/pci/virtio_pci_if.m optional = virtio_pci > +dev/virtio/pci/virtio_pci_legacy.c optional virtio_pci > +dev/virtio/pci/virtio_pci_modern.c optional virtio_pci > dev/virtio/mmio/virtio_mmio.c optional virtio_mmio > dev/virtio/mmio/virtio_mmio_acpi.c optional virtio_mmio acpi > dev/virtio/mmio/virtio_mmio_fdt.c optional virtio_mmio fdt > diff --git a/sys/dev/virtio/mmio/virtio_mmio.c = b/sys/dev/virtio/mmio/virtio_mmio.c > index bb5d84754f09..694d2a232fdd 100644 > --- a/sys/dev/virtio/mmio/virtio_mmio.c > +++ b/sys/dev/virtio/mmio/virtio_mmio.c > @@ -84,7 +84,7 @@ static void vtmmio_stop(device_t); > static void vtmmio_poll(device_t); > static int vtmmio_reinit(device_t, uint64_t); > static void vtmmio_reinit_complete(device_t); > -static void vtmmio_notify_virtqueue(device_t, uint16_t); > +static void vtmmio_notify_virtqueue(device_t, uint16_t, bus_size_t); > static uint8_t vtmmio_get_status(device_t); > static void vtmmio_set_status(device_t, uint8_t); > static void vtmmio_read_dev_config(device_t, bus_size_t, void *, = int); > @@ -352,6 +352,13 @@ vtmmio_read_ivar(device_t dev, device_t child, = int index, uintptr_t *result) > */ > *result =3D 0; > break; > + case VIRTIO_IVAR_MODERN: > + /* > + * There are several modern (aka MMIO v2) spec = compliance > + * issues with this driver, but keep the status quo. > + */ > + *result =3D sc->vtmmio_version > 1; > + break; > default: > return (ENOENT); > } > @@ -388,6 +395,10 @@ vtmmio_negotiate_features(device_t dev, uint64_t = child_features) >=20 > sc =3D device_get_softc(dev); >=20 > + if (sc->vtmmio_version > 1) { > + child_features |=3D VIRTIO_F_VERSION_1; > + } > + > vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 1); > host_features =3D vtmmio_read_config_4(sc, = VIRTIO_MMIO_HOST_FEATURES); > host_features <<=3D 32; > @@ -402,7 +413,7 @@ vtmmio_negotiate_features(device_t dev, uint64_t = child_features) > * host all support. > */ > features =3D host_features & child_features; > - features =3D virtqueue_filter_features(features); > + features =3D virtio_filter_transport_features(features); > sc->vtmmio_features =3D features; >=20 > vtmmio_describe_features(sc, "negotiated", features); > @@ -504,7 +515,8 @@ vtmmio_alloc_virtqueues(device_t dev, int flags, = int nvqs, > size =3D vtmmio_read_config_4(sc, = VIRTIO_MMIO_QUEUE_NUM_MAX); >=20 > error =3D virtqueue_alloc(dev, idx, size, > - VIRTIO_MMIO_VRING_ALIGN, ~(vm_paddr_t)0, info, &vq); > + VIRTIO_MMIO_QUEUE_NOTIFY, VIRTIO_MMIO_VRING_ALIGN, > + ~(vm_paddr_t)0, info, &vq); > if (error) { > device_printf(dev, > "cannot allocate virtqueue %d: %d\n", > @@ -586,13 +598,14 @@ vtmmio_reinit_complete(device_t dev) > } >=20 > static void > -vtmmio_notify_virtqueue(device_t dev, uint16_t queue) > +vtmmio_notify_virtqueue(device_t dev, uint16_t queue, bus_size_t = offset) > { > struct vtmmio_softc *sc; >=20 > sc =3D device_get_softc(dev); > + MPASS(offset =3D=3D VIRTIO_MMIO_QUEUE_NOTIFY); >=20 > - vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_NOTIFY, queue); > + vtmmio_write_config_4(sc, offset, queue); > } >=20 > static uint8_t > diff --git a/sys/dev/virtio/pci/virtio_pci.c = b/sys/dev/virtio/pci/virtio_pci.c > index 05a632f526a8..4d6fa929ef19 100644 > --- a/sys/dev/virtio/pci/virtio_pci.c > +++ b/sys/dev/virtio/pci/virtio_pci.c > @@ -1,7 +1,7 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > - * Copyright (c) 2011, Bryan Venteicher > + * Copyright (c) 2017, Bryan Venteicher > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -26,8 +26,6 @@ > * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ >=20 > -/* Driver for the VirtIO PCI interface. */ > - > #include > __FBSDID("$FreeBSD$"); >=20 > @@ -37,7 +35,6 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > -#include >=20 > #include > #include > @@ -50,369 +47,236 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include >=20 > -#include "virtio_bus_if.h" > +#include "virtio_pci_if.h" > #include "virtio_if.h" >=20 > -struct vtpci_interrupt { > - struct resource *vti_irq; > - int vti_rid; > - void *vti_handler; > -}; > - > -struct vtpci_virtqueue { > - struct virtqueue *vtv_vq; > - int vtv_no_intr; > -}; > - > -struct vtpci_softc { > - device_t vtpci_dev; > - struct resource *vtpci_res; > - struct resource *vtpci_msix_res; > - uint64_t vtpci_features; > - uint32_t vtpci_flags; > -#define VTPCI_FLAG_NO_MSI 0x0001 > -#define VTPCI_FLAG_NO_MSIX 0x0002 > -#define VTPCI_FLAG_LEGACY 0x1000 > -#define VTPCI_FLAG_MSI 0x2000 > -#define VTPCI_FLAG_MSIX 0x4000 > -#define VTPCI_FLAG_SHARED_MSIX 0x8000 > -#define VTPCI_FLAG_ITYPE_MASK 0xF000 > - > - /* This "bus" will only ever have one child. */ > - device_t vtpci_child_dev; > - struct virtio_feature_desc *vtpci_child_feat_desc; > - > - int vtpci_nvqs; > - struct vtpci_virtqueue *vtpci_vqs; > - > - /* > - * Ideally, each virtqueue that the driver provides a callback = for will > - * receive its own MSIX vector. If there are not sufficient = vectors > - * available, then attempt to have all the VQs share one vector. = For > - * MSIX, the configuration changed notifications must be on = their own > - * vector. > - * > - * If MSIX is not available, we will attempt to have the whole = device > - * share one MSI vector, and then, finally, one legacy = interrupt. > - */ > - struct vtpci_interrupt vtpci_device_interrupt; > - struct vtpci_interrupt *vtpci_msix_vq_interrupts; > - int vtpci_nmsix_resources; > -}; > - > -static int vtpci_probe(device_t); > -static int vtpci_attach(device_t); > -static int vtpci_detach(device_t); > -static int vtpci_suspend(device_t); > -static int vtpci_resume(device_t); > -static int vtpci_shutdown(device_t); > -static void vtpci_driver_added(device_t, driver_t *); > -static void vtpci_child_detached(device_t, device_t); > -static int vtpci_read_ivar(device_t, device_t, int, uintptr_t *); > -static int vtpci_write_ivar(device_t, device_t, int, uintptr_t); > - > -static uint64_t vtpci_negotiate_features(device_t, uint64_t); > -static int vtpci_with_feature(device_t, uint64_t); > -static int vtpci_alloc_virtqueues(device_t, int, int, > - struct vq_alloc_info *); > -static int vtpci_setup_intr(device_t, enum intr_type); > -static void vtpci_stop(device_t); > -static int vtpci_reinit(device_t, uint64_t); > -static void vtpci_reinit_complete(device_t); > -static void vtpci_notify_virtqueue(device_t, uint16_t); > -static uint8_t vtpci_get_status(device_t); > -static void vtpci_set_status(device_t, uint8_t); > -static void vtpci_read_dev_config(device_t, bus_size_t, void *, = int); > -static void vtpci_write_dev_config(device_t, bus_size_t, void *, = int); > - > -static void vtpci_describe_features(struct vtpci_softc *, const char = *, > +static void vtpci_describe_features(struct vtpci_common *, const = char *, > uint64_t); > -static void vtpci_probe_and_attach_child(struct vtpci_softc *); > - > -static int vtpci_alloc_msix(struct vtpci_softc *, int); > -static int vtpci_alloc_msi(struct vtpci_softc *); > -static int vtpci_alloc_intr_msix_pervq(struct vtpci_softc *); > -static int vtpci_alloc_intr_msix_shared(struct vtpci_softc *); > -static int vtpci_alloc_intr_msi(struct vtpci_softc *); > -static int vtpci_alloc_intr_legacy(struct vtpci_softc *); > -static int vtpci_alloc_interrupt(struct vtpci_softc *, int, int, > +static int vtpci_alloc_msix(struct vtpci_common *, int); > +static int vtpci_alloc_msi(struct vtpci_common *); > +static int vtpci_alloc_intr_msix_pervq(struct vtpci_common *); > +static int vtpci_alloc_intr_msix_shared(struct vtpci_common *); > +static int vtpci_alloc_intr_msi(struct vtpci_common *); > +static int vtpci_alloc_intr_intx(struct vtpci_common *); > +static int vtpci_alloc_interrupt(struct vtpci_common *, int, int, > + struct vtpci_interrupt *); > +static void vtpci_free_interrupt(struct vtpci_common *, > struct vtpci_interrupt *); > -static int vtpci_alloc_intr_resources(struct vtpci_softc *); >=20 > -static int vtpci_setup_legacy_interrupt(struct vtpci_softc *, > +static void vtpci_free_interrupts(struct vtpci_common *); > +static void vtpci_free_virtqueues(struct vtpci_common *); > +static void vtpci_cleanup_setup_intr_attempt(struct vtpci_common *); > +static int vtpci_alloc_intr_resources(struct vtpci_common *); > +static int vtpci_setup_intx_interrupt(struct vtpci_common *, > enum intr_type); > -static int vtpci_setup_pervq_msix_interrupts(struct vtpci_softc *, > +static int vtpci_setup_pervq_msix_interrupts(struct vtpci_common *, > enum intr_type); > -static int vtpci_setup_msix_interrupts(struct vtpci_softc *, > +static int vtpci_set_host_msix_vectors(struct vtpci_common *); > +static int vtpci_setup_msix_interrupts(struct vtpci_common *, > enum intr_type); > -static int vtpci_setup_interrupts(struct vtpci_softc *, enum = intr_type); > - > -static int vtpci_register_msix_vector(struct vtpci_softc *, int, > - struct vtpci_interrupt *); > -static int vtpci_set_host_msix_vectors(struct vtpci_softc *); > -static int vtpci_reinit_virtqueue(struct vtpci_softc *, int); > - > -static void vtpci_free_interrupt(struct vtpci_softc *, > - struct vtpci_interrupt *); > -static void vtpci_free_interrupts(struct vtpci_softc *); > -static void vtpci_free_virtqueues(struct vtpci_softc *); > -static void vtpci_release_child_resources(struct vtpci_softc *); > -static void vtpci_cleanup_setup_intr_attempt(struct vtpci_softc *); > -static void vtpci_reset(struct vtpci_softc *); > - > -static void vtpci_select_virtqueue(struct vtpci_softc *, int); > - > -static void vtpci_legacy_intr(void *); > +static int vtpci_setup_intrs(struct vtpci_common *, enum = intr_type); > +static int vtpci_reinit_virtqueue(struct vtpci_common *, int); > +static void vtpci_intx_intr(void *); > static int vtpci_vq_shared_intr_filter(void *); > static void vtpci_vq_shared_intr(void *); > static int vtpci_vq_intr_filter(void *); > static void vtpci_vq_intr(void *); > static void vtpci_config_intr(void *); >=20 > -#define vtpci_setup_msi_interrupt vtpci_setup_legacy_interrupt > - > -#define VIRTIO_PCI_CONFIG(_sc) \ > - VIRTIO_PCI_CONFIG_OFF((((_sc)->vtpci_flags & VTPCI_FLAG_MSIX)) !=3D= 0) > - > -/* > - * I/O port read/write wrappers. > - */ > -#define vtpci_read_config_1(sc, o) bus_read_1((sc)->vtpci_res, (o)) > -#define vtpci_write_config_1(sc, o, v) = bus_write_1((sc)->vtpci_res, (o), (v)) > +#define vtpci_setup_msi_interrupt vtpci_setup_intx_interrupt >=20 > /* > - * Virtio-pci specifies that PCI Configuration area is guest endian. = However, > - * since PCI devices are inherently little-endian, on BE systems the = bus layer > - * transparently converts it to BE. For virtio-legacy, this = conversion is > - * undesired, so an extra byte swap is required to fix it. > + * This module contains two drivers: > + * - virtio_pci_legacy for pre-V1 support > + * - virtio_pci_modern for V1 support > */ > -#define vtpci_read_config_2(sc, o) = le16toh(bus_read_2((sc)->vtpci_res, (o))) > -#define vtpci_read_config_4(sc, o) = le32toh(bus_read_4((sc)->vtpci_res, (o))) > -#define vtpci_write_config_2(sc, o, v) bus_write_2((sc)->vtpci_res, = (o), (htole16(v))) > -#define vtpci_write_config_4(sc, o, v) bus_write_4((sc)->vtpci_res, = (o), (htole32(v))) > - > -/* PCI Header LE. On BE systems the bus layer takes care of byte = swapping */ > -#define vtpci_read_header_2(sc, o) (bus_read_2((sc)->vtpci_res, = (o))) > -#define vtpci_read_header_4(sc, o) (bus_read_4((sc)->vtpci_res, = (o))) > -#define vtpci_write_header_2(sc, o, v) bus_write_2((sc)->vtpci_res, = (o), (v)) > -#define vtpci_write_header_4(sc, o, v) bus_write_4((sc)->vtpci_res, = (o), (v)) > - > -/* Tunables. */ > -static int vtpci_disable_msix =3D 0; > -TUNABLE_INT("hw.virtio.pci.disable_msix", &vtpci_disable_msix); > - > -static device_method_t vtpci_methods[] =3D { > - /* Device interface. */ > - DEVMETHOD(device_probe, vtpci_probe), > - DEVMETHOD(device_attach, vtpci_attach), > - DEVMETHOD(device_detach, vtpci_detach), > - DEVMETHOD(device_suspend, vtpci_suspend), > - DEVMETHOD(device_resume, vtpci_resume), > - DEVMETHOD(device_shutdown, vtpci_shutdown), > - > - /* Bus interface. */ > - DEVMETHOD(bus_driver_added, vtpci_driver_added), > - DEVMETHOD(bus_child_detached, vtpci_child_detached), > - DEVMETHOD(bus_child_pnpinfo_str, = virtio_child_pnpinfo_str), > - DEVMETHOD(bus_read_ivar, vtpci_read_ivar), > - DEVMETHOD(bus_write_ivar, vtpci_write_ivar), > - > - /* VirtIO bus interface. */ > - DEVMETHOD(virtio_bus_negotiate_features, = vtpci_negotiate_features), > - DEVMETHOD(virtio_bus_with_feature, vtpci_with_feature), > - DEVMETHOD(virtio_bus_alloc_virtqueues, = vtpci_alloc_virtqueues), > - DEVMETHOD(virtio_bus_setup_intr, vtpci_setup_intr), > - DEVMETHOD(virtio_bus_stop, vtpci_stop), > - DEVMETHOD(virtio_bus_reinit, vtpci_reinit), > - DEVMETHOD(virtio_bus_reinit_complete, = vtpci_reinit_complete), > - DEVMETHOD(virtio_bus_notify_vq, = vtpci_notify_virtqueue), > - DEVMETHOD(virtio_bus_read_device_config, = vtpci_read_dev_config), > - DEVMETHOD(virtio_bus_write_device_config, = vtpci_write_dev_config), > - > - DEVMETHOD_END > -}; > - > -static driver_t vtpci_driver =3D { > - "virtio_pci", > - vtpci_methods, > - sizeof(struct vtpci_softc) > -}; > - > -devclass_t vtpci_devclass; > - > -DRIVER_MODULE(virtio_pci, pci, vtpci_driver, vtpci_devclass, 0, 0); > MODULE_VERSION(virtio_pci, 1); > MODULE_DEPEND(virtio_pci, pci, 1, 1, 1); > MODULE_DEPEND(virtio_pci, virtio, 1, 1, 1); >=20 > -static int > -vtpci_probe(device_t dev) > -{ > - char desc[36]; > - const char *name; > +int vtpci_disable_msix =3D 0; > +TUNABLE_INT("hw.virtio.pci.disable_msix", &vtpci_disable_msix); >=20 > - if (pci_get_vendor(dev) !=3D VIRTIO_PCI_VENDORID) > - return (ENXIO); > +static uint8_t > +vtpci_read_isr(struct vtpci_common *cn) > +{ > + return (VIRTIO_PCI_READ_ISR(cn->vtpci_dev)); > +} >=20 > - if (pci_get_device(dev) < VIRTIO_PCI_DEVICEID_MIN || > - pci_get_device(dev) > VIRTIO_PCI_DEVICEID_MAX) > - return (ENXIO); > +static uint16_t > +vtpci_get_vq_size(struct vtpci_common *cn, int idx) > +{ > + return (VIRTIO_PCI_GET_VQ_SIZE(cn->vtpci_dev, idx)); > +} >=20 > - if (pci_get_revid(dev) !=3D VIRTIO_PCI_ABI_VERSION) > - return (ENXIO); > +static bus_size_t > +vtpci_get_vq_notify_off(struct vtpci_common *cn, int idx) > +{ > + return (VIRTIO_PCI_GET_VQ_NOTIFY_OFF(cn->vtpci_dev, idx)); > +} >=20 > - name =3D virtio_device_name(pci_get_subdevice(dev)); > - if (name =3D=3D NULL) > - name =3D "Unknown"; > +static void > +vtpci_set_vq(struct vtpci_common *cn, struct virtqueue *vq) > +{ > + VIRTIO_PCI_SET_VQ(cn->vtpci_dev, vq); > +} >=20 > - snprintf(desc, sizeof(desc), "VirtIO PCI %s adapter", name); > - device_set_desc_copy(dev, desc); > +static void > +vtpci_disable_vq(struct vtpci_common *cn, int idx) > +{ > + VIRTIO_PCI_DISABLE_VQ(cn->vtpci_dev, idx); > +} >=20 > - return (BUS_PROBE_DEFAULT); > +static int > +vtpci_register_cfg_msix(struct vtpci_common *cn, struct = vtpci_interrupt *intr) > +{ > + return (VIRTIO_PCI_REGISTER_CFG_MSIX(cn->vtpci_dev, intr)); > } >=20 > static int > -vtpci_attach(device_t dev) > +vtpci_register_vq_msix(struct vtpci_common *cn, int idx, > + struct vtpci_interrupt *intr) > { > - struct vtpci_softc *sc; > - device_t child; > - int rid; > + return (VIRTIO_PCI_REGISTER_VQ_MSIX(cn->vtpci_dev, idx, intr)); > +} >=20 > - sc =3D device_get_softc(dev); > - sc->vtpci_dev =3D dev; > +void > +vtpci_init(struct vtpci_common *cn, device_t dev, bool modern) > +{ >=20 > - pci_enable_busmaster(dev); > + cn->vtpci_dev =3D dev; >=20 > - rid =3D PCIR_BAR(0); > - sc->vtpci_res =3D bus_alloc_resource_any(dev, SYS_RES_IOPORT, = &rid, > - RF_ACTIVE); > - if (sc->vtpci_res =3D=3D NULL) { > - device_printf(dev, "cannot map I/O space\n"); > - return (ENXIO); > - } > + pci_enable_busmaster(dev); >=20 > + if (modern) > + cn->vtpci_flags |=3D VTPCI_FLAG_MODERN; > if (pci_find_cap(dev, PCIY_MSI, NULL) !=3D 0) > - sc->vtpci_flags |=3D VTPCI_FLAG_NO_MSI; > - > - if (pci_find_cap(dev, PCIY_MSIX, NULL) =3D=3D 0) { > - rid =3D PCIR_BAR(1); > - sc->vtpci_msix_res =3D bus_alloc_resource_any(dev, > - SYS_RES_MEMORY, &rid, RF_ACTIVE); > - } > - > - if (sc->vtpci_msix_res =3D=3D NULL) > - sc->vtpci_flags |=3D VTPCI_FLAG_NO_MSIX; > + cn->vtpci_flags |=3D VTPCI_FLAG_NO_MSI; > + if (pci_find_cap(dev, PCIY_MSIX, NULL) !=3D 0) > + cn->vtpci_flags |=3D VTPCI_FLAG_NO_MSIX; > +} >=20 > - vtpci_reset(sc); > +int > +vtpci_add_child(struct vtpci_common *cn) > +{ > + device_t dev, child; >=20 > - /* Tell the host we've noticed this device. */ > - vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_ACK); > + dev =3D cn->vtpci_dev; >=20 > - if ((child =3D device_add_child(dev, NULL, -1)) =3D=3D NULL) { > + child =3D device_add_child(dev, NULL, -1); > + if (child =3D=3D NULL) { > device_printf(dev, "cannot create child device\n"); > - vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_FAILED); > - vtpci_detach(dev); > return (ENOMEM); > } >=20 > - sc->vtpci_child_dev =3D child; > - vtpci_probe_and_attach_child(sc); > + cn->vtpci_child_dev =3D child; >=20 > return (0); > } >=20 > -static int > -vtpci_detach(device_t dev) > +int > +vtpci_delete_child(struct vtpci_common *cn) > { > - struct vtpci_softc *sc; > - device_t child; > + device_t dev, child; > int error; >=20 > - sc =3D device_get_softc(dev); > + dev =3D cn->vtpci_dev; >=20 > - if ((child =3D sc->vtpci_child_dev) !=3D NULL) { > + child =3D cn->vtpci_child_dev; > + if (child !=3D NULL) { > error =3D device_delete_child(dev, child); > if (error) > return (error); > - sc->vtpci_child_dev =3D NULL; > - } > - > - vtpci_reset(sc); > - > - if (sc->vtpci_msix_res !=3D NULL) { > - bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(1), > - sc->vtpci_msix_res); > - sc->vtpci_msix_res =3D NULL; > - } > - > - if (sc->vtpci_res !=3D NULL) { > - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), > - sc->vtpci_res); > - sc->vtpci_res =3D NULL; > + cn->vtpci_child_dev =3D NULL; > } >=20 > return (0); > } >=20 > -static int > -vtpci_suspend(device_t dev) > +void > +vtpci_child_detached(struct vtpci_common *cn) > { >=20 > - return (bus_generic_suspend(dev)); > -} > - > -static int > -vtpci_resume(device_t dev) > -{ > + vtpci_release_child_resources(cn); >=20 > - return (bus_generic_resume(dev)); > + cn->vtpci_child_feat_desc =3D NULL; > + cn->vtpci_features =3D 0; > } >=20 > -static int > -vtpci_shutdown(device_t dev) > +int > +vtpci_reinit(struct vtpci_common *cn) > { > + int idx, error; >=20 > - (void) bus_generic_shutdown(dev); > - /* Forcibly stop the host device. */ > - vtpci_stop(dev); > + for (idx =3D 0; idx < cn->vtpci_nvqs; idx++) { > + error =3D vtpci_reinit_virtqueue(cn, idx); > + if (error) > + return (error); > + } > + > + if (vtpci_is_msix_enabled(cn)) { > + error =3D vtpci_set_host_msix_vectors(cn); > + if (error) > + return (error); > + } >=20 > return (0); > } >=20 > static void > -vtpci_driver_added(device_t dev, driver_t *driver) > +vtpci_describe_features(struct vtpci_common *cn, const char *msg, > + uint64_t features) > { > - struct vtpci_softc *sc; > + device_t dev, child; > + > + dev =3D cn->vtpci_dev; > + child =3D cn->vtpci_child_dev; >=20 > - sc =3D device_get_softc(dev); > + if (device_is_attached(child) || bootverbose =3D=3D 0) > + return; >=20 > - vtpci_probe_and_attach_child(sc); > + virtio_describe(dev, msg, features, cn->vtpci_child_feat_desc); > } >=20 > -static void > -vtpci_child_detached(device_t dev, device_t child) > +uint64_t > +vtpci_negotiate_features(struct vtpci_common *cn, > + uint64_t child_features, uint64_t host_features) > { > - struct vtpci_softc *sc; > + uint64_t features; >=20 > - sc =3D device_get_softc(dev); > + vtpci_describe_features(cn, "host", host_features); >=20 > - vtpci_reset(sc); > - vtpci_release_child_resources(sc); > + /* > + * Limit negotiated features to what the driver, virtqueue, and > + * host all support. > + */ > + features =3D host_features & child_features; > + features =3D virtio_filter_transport_features(features); > + vtpci_describe_features(cn, "negotiated", features); > + > + cn->vtpci_features =3D features; > + > + return (features); > } >=20 > -static int > -vtpci_read_ivar(device_t dev, device_t child, int index, uintptr_t = *result) > +int > +vtpci_with_feature(struct vtpci_common *cn, uint64_t feature) > { > - struct vtpci_softc *sc; > + return ((cn->vtpci_features & feature) !=3D 0); > +} >=20 > - sc =3D device_get_softc(dev); > +int > +vtpci_read_ivar(struct vtpci_common *cn, int index, uintptr_t = *result) > +{ > + device_t dev; > + int error; >=20 > - if (sc->vtpci_child_dev !=3D child) > - return (ENOENT); > + dev =3D cn->vtpci_dev; > + error =3D 0; >=20 > switch (index) { > - case VIRTIO_IVAR_DEVTYPE: > case VIRTIO_IVAR_SUBDEVICE: > *result =3D pci_get_subdevice(dev); > break; > @@ -425,100 +289,74 @@ vtpci_read_ivar(device_t dev, device_t child, = int index, uintptr_t *result) > case VIRTIO_IVAR_SUBVENDOR: > *result =3D pci_get_subvendor(dev); > break; > + case VIRTIO_IVAR_MODERN: > + *result =3D vtpci_is_modern(cn); > + break; > default: > - return (ENOENT); > + error =3D ENOENT; > } >=20 > - return (0); > + return (error); > } >=20 > -static int > -vtpci_write_ivar(device_t dev, device_t child, int index, uintptr_t = value) > +int > +vtpci_write_ivar(struct vtpci_common *cn, int index, uintptr_t value) > { > - struct vtpci_softc *sc; > - > - sc =3D device_get_softc(dev); > + int error; >=20 > - if (sc->vtpci_child_dev !=3D child) > - return (ENOENT); > + error =3D 0; >=20 > switch (index) { > case VIRTIO_IVAR_FEATURE_DESC: > - sc->vtpci_child_feat_desc =3D (void *) value; > + cn->vtpci_child_feat_desc =3D (void *) value; > break; > default: > - return (ENOENT); > + error =3D ENOENT; > } >=20 > - return (0); > + return (error); > } >=20 > -static uint64_t > -vtpci_negotiate_features(device_t dev, uint64_t child_features) > +int > +vtpci_alloc_virtqueues(struct vtpci_common *cn, int flags, int nvqs, > + struct vq_alloc_info *vq_info) > { > - struct vtpci_softc *sc; > - uint64_t host_features, features; > - > - sc =3D device_get_softc(dev); > + device_t dev; > + int idx, align, error; >=20 > - host_features =3D vtpci_read_header_4(sc, = VIRTIO_PCI_HOST_FEATURES); > - vtpci_describe_features(sc, "host", host_features); > + dev =3D cn->vtpci_dev; >=20 > /* > - * Limit negotiated features to what the driver, virtqueue, and > - * host all support. > + * This is VIRTIO_PCI_VRING_ALIGN from legacy VirtIO. In modern = VirtIO, > + * the tables do not have to be allocated contiguously, but we = do so > + * anyways. > */ > - features =3D host_features & child_features; > - features =3D virtqueue_filter_features(features); > - sc->vtpci_features =3D features; > - > - vtpci_describe_features(sc, "negotiated", features); > - vtpci_write_header_4(sc, VIRTIO_PCI_GUEST_FEATURES, features); > - > - return (features); > -} > - > -static int > -vtpci_with_feature(device_t dev, uint64_t feature) > -{ > - struct vtpci_softc *sc; > + align =3D 4096; >=20 > - sc =3D device_get_softc(dev); > - > - return ((sc->vtpci_features & feature) !=3D 0); > -} > - > -static int > -vtpci_alloc_virtqueues(device_t dev, int flags, int nvqs, > - struct vq_alloc_info *vq_info) > -{ > - struct vtpci_softc *sc; > - struct virtqueue *vq; > - struct vtpci_virtqueue *vqx; > - struct vq_alloc_info *info; > - int idx, error; > - uint16_t size; > - > - sc =3D device_get_softc(dev); > - > - if (sc->vtpci_nvqs !=3D 0) > + if (cn->vtpci_nvqs !=3D 0) > return (EALREADY); > if (nvqs <=3D 0) > return (EINVAL); >=20 > - sc->vtpci_vqs =3D malloc(nvqs * sizeof(struct vtpci_virtqueue), > + cn->vtpci_vqs =3D malloc(nvqs * sizeof(struct vtpci_virtqueue), > M_DEVBUF, M_NOWAIT | M_ZERO); > - if (sc->vtpci_vqs =3D=3D NULL) > + if (cn->vtpci_vqs =3D=3D NULL) > return (ENOMEM); >=20 > for (idx =3D 0; idx < nvqs; idx++) { > - vqx =3D &sc->vtpci_vqs[idx]; > + struct vtpci_virtqueue *vqx; > + struct vq_alloc_info *info; > + struct virtqueue *vq; > + bus_size_t notify_offset; > + uint16_t size; > + > + vqx =3D &cn->vtpci_vqs[idx]; > info =3D &vq_info[idx]; >=20 > - vtpci_select_virtqueue(sc, idx); > - size =3D vtpci_read_header_2(sc, VIRTIO_PCI_QUEUE_NUM); > + size =3D vtpci_get_vq_size(cn, idx); > + notify_offset =3D vtpci_get_vq_notify_off(cn, idx); >=20 > - error =3D virtqueue_alloc(dev, idx, size, = VIRTIO_PCI_VRING_ALIGN, > + error =3D virtqueue_alloc(dev, idx, size, notify_offset, = align, > ~(vm_paddr_t)0, info, &vq); > if (error) { > device_printf(dev, > @@ -526,270 +364,27 @@ vtpci_alloc_virtqueues(device_t dev, int flags, = int nvqs, > break; > } >=20 > - vtpci_write_header_4(sc, VIRTIO_PCI_QUEUE_PFN, > - virtqueue_paddr(vq) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT); > + vtpci_set_vq(cn, vq); >=20 > vqx->vtv_vq =3D *info->vqai_vq =3D vq; > vqx->vtv_no_intr =3D info->vqai_intr =3D=3D NULL; >=20 > - sc->vtpci_nvqs++; > + cn->vtpci_nvqs++; > } >=20 > if (error) > - vtpci_free_virtqueues(sc); > + vtpci_free_virtqueues(cn); >=20 > return (error); > } >=20 > static int > -vtpci_setup_intr(device_t dev, enum intr_type type) > -{ > - struct vtpci_softc *sc; > - int attempt, error; > - > - sc =3D device_get_softc(dev); > - > - for (attempt =3D 0; attempt < 5; attempt++) { > - /* > - * Start with the most desirable interrupt configuration = and > - * fallback towards less desirable ones. > - */ > - switch (attempt) { > - case 0: > - error =3D vtpci_alloc_intr_msix_pervq(sc); > - break; > - case 1: > - error =3D vtpci_alloc_intr_msix_shared(sc); > - break; > - case 2: > - error =3D vtpci_alloc_intr_msi(sc); > - break; > - case 3: > - error =3D vtpci_alloc_intr_legacy(sc); > - break; > - default: > - device_printf(dev, > - "exhausted all interrupt allocation = attempts\n"); > - return (ENXIO); > - } > - > - if (error =3D=3D 0 && vtpci_setup_interrupts(sc, type) = =3D=3D 0) > - break; > - > - vtpci_cleanup_setup_intr_attempt(sc); > - } > - > - if (bootverbose) { > - if (sc->vtpci_flags & VTPCI_FLAG_LEGACY) > - device_printf(dev, "using legacy interrupt\n"); > - else if (sc->vtpci_flags & VTPCI_FLAG_MSI) > - device_printf(dev, "using MSI interrupt\n"); > - else if (sc->vtpci_flags & VTPCI_FLAG_SHARED_MSIX) > - device_printf(dev, "using shared MSIX = interrupts\n"); > - else > - device_printf(dev, "using per VQ MSIX = interrupts\n"); > - } > - > - return (0); > -} > - > -static void > -vtpci_stop(device_t dev) > -{ > - > - vtpci_reset(device_get_softc(dev)); > -} > - > -static int > -vtpci_reinit(device_t dev, uint64_t features) > -{ > - struct vtpci_softc *sc; > - int idx, error; > - > - sc =3D device_get_softc(dev); > - > - /* > - * Redrive the device initialization. This is a bit of an abuse = of > - * the specification, but VirtualBox, QEMU/KVM, and BHyVe seem = to > - * play nice. > - * > - * We do not allow the host device to change from what was = originally > - * negotiated beyond what the guest driver changed. MSIX state = should > - * not change, number of virtqueues and their size remain the = same, etc. > - * This will need to be rethought when we want to support = migration. > - */ > - > - if (vtpci_get_status(dev) !=3D VIRTIO_CONFIG_STATUS_RESET) > - vtpci_stop(dev); > - > - /* > - * Quickly drive the status through ACK and DRIVER. The device > - * does not become usable again until vtpci_reinit_complete(). > - */ > - vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_ACK); > - vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_DRIVER); > - > - vtpci_negotiate_features(dev, features); > - > - for (idx =3D 0; idx < sc->vtpci_nvqs; idx++) { > - error =3D vtpci_reinit_virtqueue(sc, idx); > - if (error) > - return (error); > - } > - > - if (sc->vtpci_flags & VTPCI_FLAG_MSIX) { > - error =3D vtpci_set_host_msix_vectors(sc); > - if (error) > - return (error); > - } > - > - return (0); > -} > - > -static void > -vtpci_reinit_complete(device_t dev) > -{ > - > - vtpci_set_status(dev, VIRTIO_CONFIG_STATUS_DRIVER_OK); > -} > - > -static void > -vtpci_notify_virtqueue(device_t dev, uint16_t queue) > -{ > - struct vtpci_softc *sc; > - > - sc =3D device_get_softc(dev); > - > - vtpci_write_header_2(sc, VIRTIO_PCI_QUEUE_NOTIFY, queue); > -} > - > -static uint8_t > -vtpci_get_status(device_t dev) > -{ > - struct vtpci_softc *sc; > - > - sc =3D device_get_softc(dev); > - > - return (vtpci_read_config_1(sc, VIRTIO_PCI_STATUS)); > -} > - > -static void > -vtpci_set_status(device_t dev, uint8_t status) > -{ > - struct vtpci_softc *sc; > - > - sc =3D device_get_softc(dev); > - > - if (status !=3D VIRTIO_CONFIG_STATUS_RESET) > - status |=3D vtpci_get_status(dev); > - > - vtpci_write_config_1(sc, VIRTIO_PCI_STATUS, status); > -} > - > -static void > -vtpci_read_dev_config(device_t dev, bus_size_t offset, > *** 4018 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Jan 19 06:25:33 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AF5774E87CA for ; Tue, 19 Jan 2021 06:25:33 +0000 (UTC) (envelope-from tsoome@me.com) Received: from st43p00im-ztdg10061801.me.com (st43p00im-ztdg10061801.me.com [17.58.63.170]) (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 4DKdv14PQLz4j2f for ; Tue, 19 Jan 2021 06:25:33 +0000 (UTC) (envelope-from tsoome@me.com) Received: from nazgul.lan (148-52-235-80.sta.estpak.ee [80.235.52.148]) by st43p00im-ztdg10061801.me.com (Postfix) with ESMTPSA id 6E3DD8C0463; Tue, 19 Jan 2021 06:25:31 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: ad1ebbe5cea8 - main - loader: create local copy of mode list provided by vbeinfoblock From: Toomas Soome In-Reply-To: <7FCB573F-0BC6-429E-919C-6A87513DBD63@panasas.com> Date: Tue, 19 Jan 2021 08:25:28 +0200 Cc: Toomas Soome , "" , "" , "" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202101160823.10G8NjEi016925@gitrepo.freebsd.org> <7FCB573F-0BC6-429E-919C-6A87513DBD63@panasas.com> To: Ravi Pokala X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-19_01:2021-01-18, 2021-01-19 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-2006250000 definitions=main-2101190039 X-Rspamd-Queue-Id: 4DKdv14PQLz4j2f X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 06:25:33 -0000 > On 19. Jan 2021, at 03:24, Ravi Pokala wrote: >=20 > Hi Toomas, >=20 > =EF=BB=BF-----Original Message----- > From: on behalf of Toomas Soome = > Date: 2021-01-16, Saturday at 00:23 > To: , , = > Subject: git: ad1ebbe5cea8 - main - loader: create local copy of mode = list provided by vbeinfoblock >=20 > The branch main has been updated by tsoome: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dad1ebbe5cea8ffac0037966990ddf0f8= 0faa55d5 >=20 > commit ad1ebbe5cea8ffac0037966990ddf0f80faa55d5 > Author: Toomas Soome > AuthorDate: 2021-01-16 10:18:32 +0000 > Commit: Toomas Soome > CommitDate: 2021-01-16 10:23:22 +0000 >=20 > loader: create local copy of mode list provided by vbeinfoblock >=20 > Apparently some systems do corrupt mode list memory area, so we = need > to use local copy instead. >=20 > ... >=20 > + vbe_mode_list_size =3D (uintptr_t)p - (uintptr_t)ml; > + vbe_mode_list =3D malloc(vbe_mode_list_size); > + if (vbe_mode_list =3D=3D NULL) { > + free(vbe); > + vbe =3D NULL; > + free(vbe_mode); > + vbe_mode =3D NULL; > + } > + bcopy(ml, vbe_mode_list, vbe_mode_list_size); > + > + /* reset VideoModePtr, so we will not have chance to use bad = data. */ > + vbe->VideoModePtr =3D 0; >=20 > If allocation of vbe_mode_list failed, you're freeing things that were = allocated before it, but then you're continuing on. The very next thing = you do is the bcopy(), which dereferences vbe_mode_list, which is NULL = because of the allocation failure. >=20 > That doesn't seem right. >=20 > Thanks, >=20 > Ravi (rpokala@) >=20 >=20 yes, thanks! I do have fix waiting for any additional comments (Yuri = Pankov was very kind to provide review feedback). So the update will be = posted soon. thanks, toomas From owner-dev-commits-src-main@freebsd.org Tue Jan 19 08:23:14 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8D8554EB766; Tue, 19 Jan 2021 08:23:14 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKhVp3Z2wz4pQq; Tue, 19 Jan 2021 08:23:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6D2DC23617; Tue, 19 Jan 2021 08:23:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J8NE8P045382; Tue, 19 Jan 2021 08:23:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J8NE2a045381; Tue, 19 Jan 2021 08:23:14 GMT (envelope-from git) Date: Tue, 19 Jan 2021 08:23:14 GMT Message-Id: <202101190823.10J8NE2a045381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Grehan Subject: git: eed1cc6cdfa7 - main - Support COM3 and COM4 serial ports. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: grehan X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eed1cc6cdfa743e52ac3ea0b788e95b069a5f2f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 08:23:14 -0000 The branch main has been updated by grehan: URL: https://cgit.FreeBSD.org/src/commit/?id=eed1cc6cdfa743e52ac3ea0b788e95b069a5f2f3 commit eed1cc6cdfa743e52ac3ea0b788e95b069a5f2f3 Author: Peter Grehan AuthorDate: 2021-01-19 17:30:22 +0000 Commit: Peter Grehan CommitDate: 2021-01-19 17:30:22 +0000 Support COM3 and COM4 serial ports. Submitted by: Jan Poctavek , otis Reviewed by: grehan (bhyve), imp, 0mp (manpages) Differential Revision: https://reviews.freebsd.org/D28207 --- usr.sbin/bhyve/bhyve.8 | 6 +++--- usr.sbin/bhyve/pci_lpc.c | 4 ++-- usr.sbin/bhyve/uart_emul.c | 6 ++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index a3ea7be0b579..5d8f37813e7f 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 23, 2020 +.Dd January 18, 2021 .Dt BHYVE 8 .Os .Sh NAME @@ -153,8 +153,8 @@ If this option is not specified, virtual CPUs will use 100% of a host CPU. Allow devices behind the LPC PCI-ISA bridge to be configured. The only supported devices are the TTY-class devices .Ar com1 -and -.Ar com2 , +through +.Ar com4 , the boot ROM device .Ar bootrom , and the debug/test device diff --git a/usr.sbin/bhyve/pci_lpc.c b/usr.sbin/bhyve/pci_lpc.c index 3f7df55b5ffd..aa5997848f24 100644 --- a/usr.sbin/bhyve/pci_lpc.c +++ b/usr.sbin/bhyve/pci_lpc.c @@ -70,7 +70,7 @@ static struct pci_devinst *lpc_bridge; static const char *romfile; -#define LPC_UART_NUM 2 +#define LPC_UART_NUM 4 static struct lpc_uart_softc { struct uart_softc *uart_softc; const char *opts; @@ -79,7 +79,7 @@ static struct lpc_uart_softc { int enabled; } lpc_uart_softc[LPC_UART_NUM]; -static const char *lpc_uart_names[LPC_UART_NUM] = { "COM1", "COM2" }; +static const char *lpc_uart_names[LPC_UART_NUM] = { "COM1", "COM2", "COM3", "COM4" }; static bool pctestdev_present; diff --git a/usr.sbin/bhyve/uart_emul.c b/usr.sbin/bhyve/uart_emul.c index a89974590a1f..1b55231b2bf5 100644 --- a/usr.sbin/bhyve/uart_emul.c +++ b/usr.sbin/bhyve/uart_emul.c @@ -62,6 +62,10 @@ __FBSDID("$FreeBSD$"); #define COM1_IRQ 4 #define COM2_BASE 0x2F8 #define COM2_IRQ 3 +#define COM3_BASE 0x3E8 +#define COM3_IRQ 4 +#define COM4_BASE 0x2E8 +#define COM4_IRQ 3 #define DEFAULT_RCLK 1843200 #define DEFAULT_BAUD 9600 @@ -89,6 +93,8 @@ static struct { } uart_lres[] = { { COM1_BASE, COM1_IRQ, false}, { COM2_BASE, COM2_IRQ, false}, + { COM3_BASE, COM3_IRQ, false}, + { COM4_BASE, COM4_IRQ, false}, }; #define UART_NLDEVS (sizeof(uart_lres) / sizeof(uart_lres[0])) From owner-dev-commits-src-main@freebsd.org Tue Jan 19 09:22:04 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A74484ED12C; Tue, 19 Jan 2021 09:22:04 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKjph4QSxz4sdt; Tue, 19 Jan 2021 09:22:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AD9E240A9; Tue, 19 Jan 2021 09:22:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J9M4vj022924; Tue, 19 Jan 2021 09:22:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J9M46e022923; Tue, 19 Jan 2021 09:22:04 GMT (envelope-from git) Date: Tue, 19 Jan 2021 09:22:04 GMT Message-Id: <202101190922.10J9M46e022923@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 6d386b4c8a97 - main - cache: save a branch in cache_fplookup_next MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6d386b4c8a970d3b080d77e2561d6073307362e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 09:22:04 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=6d386b4c8a970d3b080d77e2561d6073307362e4 commit 6d386b4c8a970d3b080d77e2561d6073307362e4 Author: Mateusz Guzik AuthorDate: 2021-01-19 09:08:24 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-19 09:08:24 +0000 cache: save a branch in cache_fplookup_next Previously the code would branch on top find out whether it should branch on SDT probe and bumping the numposhits counter, depending on cache_fplookup_cross_mount. Arguably it should be done regardless of what said function returns. --- sys/kern/vfs_cache.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 7eb9237bf257..420a54baf3f2 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4748,16 +4748,14 @@ cache_fplookup_next(struct cache_fpl *fpl) return (cache_fpl_partial(fpl)); } + counter_u64_add(numposhits, 1); + SDT_PROBE3(vfs, namecache, lookup, hit, dvp, ncp->nc_name, tvp); + + error = 0; if (cache_fplookup_is_mp(fpl)) { error = cache_fplookup_cross_mount(fpl); - if (__predict_false(error != 0)) { - return (error); - } } - - counter_u64_add(numposhits, 1); - SDT_PROBE3(vfs, namecache, lookup, hit, dvp, ncp->nc_name, tvp); - return (0); + return (error); } static bool From owner-dev-commits-src-main@freebsd.org Tue Jan 19 09:22:07 2021 Return-Path: Delivered-To: dev-commits-src-main@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 964FB4ED132; Tue, 19 Jan 2021 09:22:07 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKjpl1BGDz4sjv; Tue, 19 Jan 2021 09:22:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D46A924124; Tue, 19 Jan 2021 09:22:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J9M61c022965; Tue, 19 Jan 2021 09:22:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J9M6W8022964; Tue, 19 Jan 2021 09:22:06 GMT (envelope-from git) Date: Tue, 19 Jan 2021 09:22:06 GMT Message-Id: <202101190922.10J9M6W8022964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 57dab0292a8f - main - cache: fix some typos MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 57dab0292a8f96cd7c374d7c1d61cd7c0bd77bfd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 09:22:07 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=57dab0292a8f96cd7c374d7c1d61cd7c0bd77bfd commit 57dab0292a8f96cd7c374d7c1d61cd7c0bd77bfd Author: Mateusz Guzik AuthorDate: 2021-01-19 09:17:14 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-19 09:17:14 +0000 cache: fix some typos --- sys/kern/vfs_cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index fea32f90682c..0621bfb12d3e 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4008,7 +4008,7 @@ cache_fplookup_partial_setup(struct cache_fpl *fpl) * * Ultimately this does not affect correctness, any lookup errors * are userspace racing with itself. It is guaranteed that any - * path which ultimatley gets found could also have been found + * path which ultimately gets found could also have been found * by regular lookup going all the way in absence of concurrent * modifications. */ @@ -4159,7 +4159,7 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl) * reasoning. * * XXX At least UFS requires its lookup routine to be called for - * the last path component, which leads to some level of complicaton + * the last path component, which leads to some level of complication * and inefficiency: * - the target routine always locks the target vnode, but our caller * may not need it locked @@ -5045,7 +5045,7 @@ cache_fplookup_parse(struct cache_fpl *fpl) #ifdef INVARIANTS /* * Code below is only here to assure compatibility with regular lookup. - * It covers handling of trailing slashles and names like "/", both of + * It covers handling of trailing slashes and names like "/", both of * which of can be taken care of upfront which lockless lookup does * in cache_fplookup_preparse. Regular lookup performs these for each * path component. From owner-dev-commits-src-main@freebsd.org Tue Jan 19 09:22:05 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E57394ED1A0; Tue, 19 Jan 2021 09:22:05 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKjpj5mh4z4sVd; Tue, 19 Jan 2021 09:22:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B946D2419B; Tue, 19 Jan 2021 09:22:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10J9M5qa022946; Tue, 19 Jan 2021 09:22:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10J9M5rS022945; Tue, 19 Jan 2021 09:22:05 GMT (envelope-from git) Date: Tue, 19 Jan 2021 09:22:05 GMT Message-Id: <202101190922.10J9M5rS022945@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 84ab77ad27c8 - main - cache: drop-write only var from cache_fplookup_preparse MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84ab77ad27c8282afaf09ee072da41f7ef009383 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 09:22:06 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=84ab77ad27c8282afaf09ee072da41f7ef009383 commit 84ab77ad27c8282afaf09ee072da41f7ef009383 Author: Mateusz Guzik AuthorDate: 2021-01-19 09:13:30 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-19 09:13:30 +0000 cache: drop-write only var from cache_fplookup_preparse --- sys/kern/vfs_cache.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 420a54baf3f2..fea32f90682c 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4963,10 +4963,8 @@ cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) static int cache_fplookup_preparse(struct cache_fpl *fpl) { - struct nameidata *ndp; struct componentname *cnp; - ndp = fpl->ndp; cnp = fpl->cnp; if (__predict_false(cnp->cn_nameptr[0] == '\0')) { From owner-dev-commits-src-main@freebsd.org Tue Jan 19 10:29:46 2021 Return-Path: Delivered-To: dev-commits-src-main@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 646694EEC6D; Tue, 19 Jan 2021 10:29:46 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKlJp2T9tz3Dgd; Tue, 19 Jan 2021 10:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47DB824CBF; Tue, 19 Jan 2021 10:29:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JATk0w003346; Tue, 19 Jan 2021 10:29:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JATkb0003345; Tue, 19 Jan 2021 10:29:46 GMT (envelope-from git) Date: Tue, 19 Jan 2021 10:29:46 GMT Message-Id: <202101191029.10JATkb0003345@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 7d3310c4fcdd - main - linux: remove spurious newline. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d3310c4fcdd19622211602bf97b267595936756 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 10:29:46 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=7d3310c4fcdd19622211602bf97b267595936756 commit 7d3310c4fcdd19622211602bf97b267595936756 Author: Edward Tomasz Napierala AuthorDate: 2021-01-14 22:48:56 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-01-19 09:56:45 +0000 linux: remove spurious newline. Sponsored by: The FreeBSD Foundation --- sys/compat/linux/linux_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 98c7c3364faf..0c40a14d58f7 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -1652,7 +1652,7 @@ fcntl_common(struct thread *td, struct linux_fcntl_args *args) return (kern_fcntl(td, args->fd, F_ADD_SEALS, linux_to_bsd_bits(args->arg, seal_bitmap, 0))); default: - linux_msg(td, "unsupported fcntl cmd %d\n", args->cmd); + linux_msg(td, "unsupported fcntl cmd %d", args->cmd); return (EINVAL); } } From owner-dev-commits-src-main@freebsd.org Tue Jan 19 10:53:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 EE4AB4EFC57; Tue, 19 Jan 2021 10:53:38 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKlrL6Pcpz3G6Y; Tue, 19 Jan 2021 10:53:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEC6225341; Tue, 19 Jan 2021 10:53:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JArcZR041995; Tue, 19 Jan 2021 10:53:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JArcDa041994; Tue, 19 Jan 2021 10:53:38 GMT (envelope-from git) Date: Tue, 19 Jan 2021 10:53:38 GMT Message-Id: <202101191053.10JArcDa041994@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 47f7345baba0 - main - linux: fix PTRACE_POKEDATA and PTRACE_POKETEXT. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 47f7345baba01121e29c22b43f68345399a32912 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 10:53:39 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=47f7345baba01121e29c22b43f68345399a32912 commit 47f7345baba01121e29c22b43f68345399a32912 Author: Edward Tomasz Napierala AuthorDate: 2021-01-15 16:57:24 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-01-19 10:30:55 +0000 linux: fix PTRACE_POKEDATA and PTRACE_POKETEXT. Sponsored by: The FreeBSD Foundation --- sys/amd64/linux/linux_ptrace.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index a14155ed7e97..c1d05db5bc42 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -594,10 +594,15 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) error = linux_ptrace_peekuser(td, pid, addr, (void *)uap->data); break; case LINUX_PTRACE_POKETEXT: - error = kern_ptrace(td, PT_WRITE_I, pid, addr, uap->data); - break; case LINUX_PTRACE_POKEDATA: error = kern_ptrace(td, PT_WRITE_D, pid, addr, uap->data); + if (error != 0) + return (error); + /* + * Linux expects this syscall to write 64 bits, not 32. + */ + error = kern_ptrace(td, PT_WRITE_D, pid, + (void *)(uap->addr + 4), uap->data >> 32); break; case LINUX_PTRACE_POKEUSER: error = linux_ptrace_pokeuser(td, pid, addr, (void *)uap->data); From owner-dev-commits-src-main@freebsd.org Tue Jan 19 11:14:58 2021 Return-Path: Delivered-To: dev-commits-src-main@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 18E074F068C; Tue, 19 Jan 2021 11:14:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKmJx5MQHz3H5W; Tue, 19 Jan 2021 11:14:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 10JBEhLE047095 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 19 Jan 2021 13:14:46 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 10JBEhLE047095 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 10JBEhHU047094; Tue, 19 Jan 2021 13:14:43 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 19 Jan 2021 13:14:43 +0200 From: Konstantin Belousov To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 47f7345baba0 - main - linux: fix PTRACE_POKEDATA and PTRACE_POKETEXT. Message-ID: References: <202101191053.10JArcDa041994@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202101191053.10JArcDa041994@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DKmJx5MQHz3H5W X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 11:14:58 -0000 On Tue, Jan 19, 2021 at 10:53:38AM +0000, Edward Tomasz Napierala wrote: > The branch main has been updated by trasz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=47f7345baba01121e29c22b43f68345399a32912 > > commit 47f7345baba01121e29c22b43f68345399a32912 > Author: Edward Tomasz Napierala > AuthorDate: 2021-01-15 16:57:24 +0000 > Commit: Edward Tomasz Napierala > CommitDate: 2021-01-19 10:30:55 +0000 > > linux: fix PTRACE_POKEDATA and PTRACE_POKETEXT. > > Sponsored by: The FreeBSD Foundation > --- > sys/amd64/linux/linux_ptrace.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c > index a14155ed7e97..c1d05db5bc42 100644 > --- a/sys/amd64/linux/linux_ptrace.c > +++ b/sys/amd64/linux/linux_ptrace.c > @@ -594,10 +594,15 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) > error = linux_ptrace_peekuser(td, pid, addr, (void *)uap->data); > break; > case LINUX_PTRACE_POKETEXT: > - error = kern_ptrace(td, PT_WRITE_I, pid, addr, uap->data); > - break; This is wrong. You should access text AS if linux request was for text. > case LINUX_PTRACE_POKEDATA: > error = kern_ptrace(td, PT_WRITE_D, pid, addr, uap->data); > + if (error != 0) > + return (error); > + /* > + * Linux expects this syscall to write 64 bits, not 32. > + */ > + error = kern_ptrace(td, PT_WRITE_D, pid, > + (void *)(uap->addr + 4), uap->data >> 32); > break; You should use PT_IO there instead of doing two accesses (to the wrong AS). > case LINUX_PTRACE_POKEUSER: > error = linux_ptrace_pokeuser(td, pid, addr, (void *)uap->data); From owner-dev-commits-src-main@freebsd.org Tue Jan 19 11:23:53 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AF0784F0812; Tue, 19 Jan 2021 11:23:53 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKmWF4Yc4z3HVW; Tue, 19 Jan 2021 11:23:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FB2F25C85; Tue, 19 Jan 2021 11:23:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JBNrf3081897; Tue, 19 Jan 2021 11:23:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JBNr28081896; Tue, 19 Jan 2021 11:23:53 GMT (envelope-from git) Date: Tue, 19 Jan 2021 11:23:53 GMT Message-Id: <202101191123.10JBNr28081896@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: c987d6a67766 - main - linux: map EBUSY returned by ptrace into ESRCH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c987d6a67766629daea0e4c51ee6baf03d4c5dfa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 11:23:53 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=c987d6a67766629daea0e4c51ee6baf03d4c5dfa commit c987d6a67766629daea0e4c51ee6baf03d4c5dfa Author: Edward Tomasz Napierala AuthorDate: 2021-01-15 17:11:41 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-01-19 11:21:55 +0000 linux: map EBUSY returned by ptrace into ESRCH The ptrace(2) Linux man page claims the syscall returns ESRCH, if the tracee is not stopped; the native ptrace(2) returns EBUSY. Sponsored by: The FreeBSD Foundation --- sys/amd64/linux/linux_ptrace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c index c1d05db5bc42..89fda7979359 100644 --- a/sys/amd64/linux/linux_ptrace.c +++ b/sys/amd64/linux/linux_ptrace.c @@ -583,7 +583,7 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) case LINUX_PTRACE_PEEKDATA: error = linux_ptrace_peek(td, pid, addr, (void *)uap->data); if (error != 0) - return (error); + goto out; /* * Linux expects this syscall to read 64 bits, not 32. */ @@ -597,7 +597,7 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) case LINUX_PTRACE_POKEDATA: error = kern_ptrace(td, PT_WRITE_D, pid, addr, uap->data); if (error != 0) - return (error); + goto out; /* * Linux expects this syscall to write 64 bits, not 32. */ @@ -665,5 +665,9 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) break; } +out: + if (error == EBUSY) + error = ESRCH; + return (error); } From owner-dev-commits-src-main@freebsd.org Tue Jan 19 11:56:51 2021 Return-Path: Delivered-To: dev-commits-src-main@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 CA1904F0E2D; Tue, 19 Jan 2021 11:56:51 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKnFH5RCjz3KNS; Tue, 19 Jan 2021 11:56:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD688260A8; Tue, 19 Jan 2021 11:56:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JBupCt021545; Tue, 19 Jan 2021 11:56:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JBuptZ021544; Tue, 19 Jan 2021 11:56:51 GMT (envelope-from git) Date: Tue, 19 Jan 2021 11:56:51 GMT Message-Id: <202101191156.10JBuptZ021544@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefan Eßer Subject: git: 24f44a445c48 - main - Remove dependency on files in /usr/bin MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 24f44a445c4875a329d3947c50083f3e8b9b37db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 11:56:51 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=24f44a445c4875a329d3947c50083f3e8b9b37db commit 24f44a445c4875a329d3947c50083f3e8b9b37db Author: Stefan Eßer AuthorDate: 2021-01-19 11:46:52 +0000 Commit: Stefan Eßer CommitDate: 2021-01-19 11:56:23 +0000 Remove dependency on files in /usr/bin In order to reduce the pre-requisites of this file, implement the pattern matching and creation of a temporary test directory without use of grep respectively mktemp. The new version makes it possible to provide a writable /tmp in any case and independently of other local or remote file systems (except / and /dev) being mounted. The use of "dd if=/dev/random" has the same dependency on /dev/random being operational as the previous version that used "mktemp". If this is found to be an issue on platforms that do not have gathered sufficient entropy at the time when this scriot is run, I suggest to replace the "dd" command with "ps lauxww" to get a somewhat random test directory name. Approved by: rgrimes, glebius, cy MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D28209 --- libexec/rc/rc.d/tmp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libexec/rc/rc.d/tmp b/libexec/rc/rc.d/tmp index a61321e058ee..7d270335cb27 100755 --- a/libexec/rc/rc.d/tmp +++ b/libexec/rc/rc.d/tmp @@ -40,10 +40,16 @@ load_rc_config $name mount_tmpmfs() { - if ! /bin/df /tmp | grep -q "^/dev/md[0-9].* /tmp"; then - mount_md ${tmpsize} /tmp "${tmpmfs_flags}" - chmod 01777 /tmp - fi + while read line; do + case $line in + /dev/md[0-9]*\ /tmp) + return;; + esac + done <<*EOF +$(df /tmp) +*EOF + mount_md ${tmpsize} /tmp "${tmpmfs_flags}" + chmod 01777 /tmp } # If we do not have a writable /tmp, create a memory @@ -52,7 +58,8 @@ mount_tmpmfs() # case "${tmpmfs}" in [Aa][Uu][Tt][Oo]) - if _tmpdir=$(mktemp -d -q /tmp/.diskless.XXXXXX); then + _tmpdir=/tmp/.diskless.$(dd if=/dev/random bs=32 count=1 status=none | sha256) + if mkdir -m 0700 ${_tmpdir}; then rmdir ${_tmpdir} else if [ -h /tmp ]; then From owner-dev-commits-src-main@freebsd.org Tue Jan 19 12:09:28 2021 Return-Path: Delivered-To: dev-commits-src-main@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 18A154F2527; Tue, 19 Jan 2021 12:09:28 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKnWr09X3z3MGv; Tue, 19 Jan 2021 12:09:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E897A260BB; Tue, 19 Jan 2021 12:09:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JC9RuP034838; Tue, 19 Jan 2021 12:09:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JC9RmD034837; Tue, 19 Jan 2021 12:09:27 GMT (envelope-from git) Date: Tue, 19 Jan 2021 12:09:27 GMT Message-Id: <202101191209.10JC9RmD034837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michal Meloun Subject: git: f635cef2a420 - main - arm64 busdma: Fix loading of small bounced buffers. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mmel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f635cef2a4206fb4e077412c493f218a6a26a3da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 12:09:28 -0000 The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=f635cef2a4206fb4e077412c493f218a6a26a3da commit f635cef2a4206fb4e077412c493f218a6a26a3da Author: Michal Meloun AuthorDate: 2021-01-13 12:50:54 +0000 Commit: Michal Meloun CommitDate: 2021-01-19 12:09:17 +0000 arm64 busdma: Fix loading of small bounced buffers. - Don't oversize the buffer fragment. PAGE_SIZE - (curaddr & PAGE_MASK) may be greater than the total length of the buffer. - Don't use roundup2(len, alignment) to calculate the buffer fragment size. The length of current bounced fragment is not subject to alignment restriction, and next fragment should start at the page boundary. Tested by: bz, s199p.wa1k9r@gmail.com --- sys/arm64/arm64/busdma_bounce.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c index 70e626372df8..d2e63d7b72d8 100644 --- a/sys/arm64/arm64/busdma_bounce.c +++ b/sys/arm64/arm64/busdma_bounce.c @@ -845,9 +845,7 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map, KASSERT(dmat->common.alignment <= PAGE_SIZE, ("bounced buffer cannot have alignment bigger " "than PAGE_SIZE: %lu", dmat->common.alignment)); - sgsize = PAGE_SIZE - (curaddr & PAGE_MASK); - sgsize = roundup2(sgsize, dmat->common.alignment); - sgsize = MIN(sgsize, dmat->common.maxsegsz); + sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK)); curaddr = add_bounce_page(dmat, map, 0, curaddr, sgsize); } else if ((map->flags & DMAMAP_COHERENT) == 0) { @@ -879,7 +877,11 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dmamap_t map, /* * Did we fit? */ - return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ + if (buflen != 0) { + bus_dmamap_unload(dmat, map); + return (EFBIG); /* XXX better return value here? */ + } + return (0); } /* @@ -892,7 +894,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, int *segp) { struct sync_list *sl; - bus_size_t sgsize, max_sgsize; + bus_size_t sgsize; bus_addr_t curaddr, sl_pend; vm_offset_t kvaddr, vaddr, sl_vend; int error; @@ -931,7 +933,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, /* * Get the physical address for this segment. */ - if (pmap == kernel_pmap) { + if (__predict_true(pmap == kernel_pmap)) { curaddr = pmap_kextract(vaddr); kvaddr = vaddr; } else { @@ -942,13 +944,9 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, /* * Compute the segment size, and adjust counts. */ - max_sgsize = MIN(buflen, dmat->common.maxsegsz); - if ((map->flags & DMAMAP_FROM_DMAMEM) != 0) { - sgsize = max_sgsize; - } else { - sgsize = PAGE_SIZE - (curaddr & PAGE_MASK); - sgsize = MIN(sgsize, max_sgsize); - } + sgsize = MIN(buflen, dmat->common.maxsegsz); + if ((map->flags & DMAMAP_FROM_DMAMEM) == 0) + sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK)); if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr, sgsize)) { @@ -956,9 +954,6 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, KASSERT(dmat->common.alignment <= PAGE_SIZE, ("bounced buffer cannot have alignment bigger " "than PAGE_SIZE: %lu", dmat->common.alignment)); - sgsize = PAGE_SIZE - (curaddr & PAGE_MASK); - sgsize = roundup2(sgsize, dmat->common.alignment); - sgsize = MIN(sgsize, max_sgsize); curaddr = add_bounce_page(dmat, map, kvaddr, curaddr, sgsize); } else if ((map->flags & DMAMAP_COHERENT) == 0) { @@ -999,7 +994,11 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, /* * Did we fit? */ - return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ + if (buflen != 0) { + bus_dmamap_unload(dmat, map); + return (EFBIG); /* XXX better return value here? */ + } + return (0); } static void From owner-dev-commits-src-main@freebsd.org Tue Jan 19 12:21:42 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D5C064F2AC6; Tue, 19 Jan 2021 12:21:42 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKnny5mBjz3Mkg; Tue, 19 Jan 2021 12:21:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8DD52654A; Tue, 19 Jan 2021 12:21:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JCLgIZ058528; Tue, 19 Jan 2021 12:21:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JCLgWm058527; Tue, 19 Jan 2021 12:21:42 GMT (envelope-from git) Date: Tue, 19 Jan 2021 12:21:42 GMT Message-Id: <202101191221.10JCLgWm058527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 38baca17e01e - main - lockmgr: fix upgrade MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38baca17e01e138dc9c7211c0f6cb4ba74b14449 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 12:21:42 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=38baca17e01e138dc9c7211c0f6cb4ba74b14449 commit 38baca17e01e138dc9c7211c0f6cb4ba74b14449 Author: Mateusz Guzik AuthorDate: 2021-01-07 06:45:49 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-19 12:21:38 +0000 lockmgr: fix upgrade TRYUPGRADE requests kept failing when they should not have due to wrong macro used to count readers. Fixes: f6b091fbbd77cbb0 ("lockmgr: rewrite upgrade to stop always dropping the lock") Noted by: asomers Differential Revision: https://reviews.freebsd.org/D27947 --- sys/kern/kern_lock.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 98c6cafde702..091abcda2a1e 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -984,17 +984,19 @@ lockmgr_upgrade(struct lock *lk, u_int flags, struct lock_object *ilk, op = flags & LK_TYPE_MASK; v = lockmgr_read_value(lk); for (;;) { - if (LK_SHARERS_LOCK(v) > 1) { + if (LK_SHARERS(v) > 1) { if (op == LK_TRYUPGRADE) { LOCK_LOG2(lk, "%s: %p failed the nowait upgrade", __func__, lk); error = EBUSY; goto out; } - if (lockmgr_sunlock_try(lk, &v)) { + if (atomic_fcmpset_rel_ptr(&lk->lk_lock, &v, + v - LK_ONE_SHARER)) { lockmgr_note_shared_release(lk, file, line); goto out_xlock; } + continue; } MPASS((v & ~LK_ALL_WAITERS) == LK_SHARERS_LOCK(1)); From owner-dev-commits-src-main@freebsd.org Tue Jan 19 12:25:42 2021 Return-Path: Delivered-To: dev-commits-src-main@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 F27BC4F2B78; Tue, 19 Jan 2021 12:25:42 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DKntZ66Cvz3NQ2; Tue, 19 Jan 2021 12:25:42 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wm1-x32a.google.com with SMTP id c127so1083028wmf.5; Tue, 19 Jan 2021 04:25:41 -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:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=wCiE1FhxsLcoCIuOE5iJvJ7jEOgIBhCX70XJywj7VQA=; b=YOG6YMVFyKsY1lPkOX9AVyAIWoWHHVpyWXKa1/iy6i5wmEFiEQ+H4Ew67zFEjR4kWh q1pHFqo1VEggD74bopXUzk6M0IMWqHaD3Df2MUeyBD/XViWje44REGTHR2R39L+lnsDo XLY+PZsqQWI2URcsR4bXd8BXX5LArk0CpClUQ4cfizBNpjHTMVRAehl4/i2bJi6kN4Vy rIS5uWrsdXMT9i/a4VnsLVABunBVt2NbVewjZmIlVdsgl0dXZVXHi6r/aUAlVen1VesG ztt2tjX+p/r6ZYdJwUwgYAlR0qB5Z9d1Qm2T3CCdsKIiYG6ggjG0HUjTg4Cg2frDVP8R f3Lg== 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 :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=wCiE1FhxsLcoCIuOE5iJvJ7jEOgIBhCX70XJywj7VQA=; b=iQ4MiStZkf3EBSPzH/NFAklD3EvvALOvRTXjZofqC8M2qspd4xUwIW70ayR4qe8Ds3 DNa9sXobDVqeHu1uVHfFghrhB+Gq8ElpOfAcc/Onyva5oJ+SdOg+Gen2MjBPzlrHI+BU r1xVFJ+8BC8y3EwZti0ZuD5gxiAF3aXX95UiK7KTx4ieA4YXeZKmHHSvw8zdLMhatfaR bQMIPwGRKVyAJAZj+1w2yAXeKjFo5duZbB9QML528iNSyVsZMbrJhuEj8Hdc+rNmw0cc dceUMiOpbw7m5YlapZL1Ip/QrusR6+MC7rTuvpzqUwYRi9JinDnrwM+VUhXMbeeerR7d dZbQ== X-Gm-Message-State: AOAM531W8aol31gxCKZHTSRPch21h+tRWlzI4ciXBtxPcj81sif2ZgaI I4Q9b3Cbi0v5XhQT3CfFIKMF+Qx2wsc= X-Google-Smtp-Source: ABdhPJx7N62hFjmn8KtDcbY8p1oDpWho5gAqVd8sfokXk5OXLsY/8QBi9PjLetsSiApI64MwQuMQIQ== X-Received: by 2002:a1c:bc8b:: with SMTP id m133mr3015079wmf.58.1611059139177; Tue, 19 Jan 2021 04:25:39 -0800 (PST) Received: from brick (cpc159423-cmbg20-2-0-cust338.5-4.cable.virginm.net. [86.7.147.83]) by smtp.gmail.com with ESMTPSA id r2sm37120365wrn.83.2021.01.19.04.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 04:25:38 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Tue, 19 Jan 2021 12:25:36 +0000 From: Edward Tomasz Napierala To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 47f7345baba0 - main - linux: fix PTRACE_POKEDATA and PTRACE_POKETEXT. Message-ID: Mail-Followup-To: Konstantin Belousov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202101191053.10JArcDa041994@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4DKntZ66Cvz3NQ2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 12:25:43 -0000 On 0119T1314, Konstantin Belousov wrote: > On Tue, Jan 19, 2021 at 10:53:38AM +0000, Edward Tomasz Napierala wrote: > > The branch main has been updated by trasz: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=47f7345baba01121e29c22b43f68345399a32912 > > > > commit 47f7345baba01121e29c22b43f68345399a32912 > > Author: Edward Tomasz Napierala > > AuthorDate: 2021-01-15 16:57:24 +0000 > > Commit: Edward Tomasz Napierala > > CommitDate: 2021-01-19 10:30:55 +0000 > > > > linux: fix PTRACE_POKEDATA and PTRACE_POKETEXT. > > > > Sponsored by: The FreeBSD Foundation > > --- > > sys/amd64/linux/linux_ptrace.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c > > index a14155ed7e97..c1d05db5bc42 100644 > > --- a/sys/amd64/linux/linux_ptrace.c > > +++ b/sys/amd64/linux/linux_ptrace.c > > @@ -594,10 +594,15 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) > > error = linux_ptrace_peekuser(td, pid, addr, (void *)uap->data); > > break; > > case LINUX_PTRACE_POKETEXT: > > - error = kern_ptrace(td, PT_WRITE_I, pid, addr, uap->data); > > - break; > This is wrong. You should access text AS if linux request was for text. Do we actually want to maintain that distinction? Looking at sys/kern/sys_process.c, they are synonyms. > > case LINUX_PTRACE_POKEDATA: > > error = kern_ptrace(td, PT_WRITE_D, pid, addr, uap->data); > > + if (error != 0) > > + return (error); > > + /* > > + * Linux expects this syscall to write 64 bits, not 32. > > + */ > > + error = kern_ptrace(td, PT_WRITE_D, pid, > > + (void *)(uap->addr + 4), uap->data >> 32); > > break; > You should use PT_IO there instead of doing two accesses (to the wrong AS). Hm, you're right. The only problem I can see is that PT_IO fetches struct ptrace_io_desc from userspace, which makes wrapping somewhat hard. How about introducing PT_READ64 and PT_WRITE64 request types and using them instead? Thanks! From owner-dev-commits-src-main@freebsd.org Tue Jan 19 13:09:01 2021 Return-Path: Delivered-To: dev-commits-src-main@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 ECBA04F3DC0; Tue, 19 Jan 2021 13:09:01 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKprY0ymXz3RGC; Tue, 19 Jan 2021 13:09:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 10JD8qC2074478 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 19 Jan 2021 15:08:56 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 10JD8qC2074478 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 10JD8qGC074477; Tue, 19 Jan 2021 15:08:52 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 19 Jan 2021 15:08:52 +0200 From: Konstantin Belousov To: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 47f7345baba0 - main - linux: fix PTRACE_POKEDATA and PTRACE_POKETEXT. Message-ID: References: <202101191053.10JArcDa041994@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DKprY0ymXz3RGC X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-1.00 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; TO_DN_NONE(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_SHORT(1.00)[0.995]; SPAMHAUS_ZRD(0.00)[2001:470:d5e7:1::1:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:470:d5e7:1::1:from]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 13:09:02 -0000 On Tue, Jan 19, 2021 at 12:25:36PM +0000, Edward Tomasz Napierala wrote: > On 0119T1314, Konstantin Belousov wrote: > > On Tue, Jan 19, 2021 at 10:53:38AM +0000, Edward Tomasz Napierala wrote: > > > The branch main has been updated by trasz: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=47f7345baba01121e29c22b43f68345399a32912 > > > > > > commit 47f7345baba01121e29c22b43f68345399a32912 > > > Author: Edward Tomasz Napierala > > > AuthorDate: 2021-01-15 16:57:24 +0000 > > > Commit: Edward Tomasz Napierala > > > CommitDate: 2021-01-19 10:30:55 +0000 > > > > > > linux: fix PTRACE_POKEDATA and PTRACE_POKETEXT. > > > > > > Sponsored by: The FreeBSD Foundation > > > --- > > > sys/amd64/linux/linux_ptrace.c | 9 +++++++-- > > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > > > diff --git a/sys/amd64/linux/linux_ptrace.c b/sys/amd64/linux/linux_ptrace.c > > > index a14155ed7e97..c1d05db5bc42 100644 > > > --- a/sys/amd64/linux/linux_ptrace.c > > > +++ b/sys/amd64/linux/linux_ptrace.c > > > @@ -594,10 +594,15 @@ linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) > > > error = linux_ptrace_peekuser(td, pid, addr, (void *)uap->data); > > > break; > > > case LINUX_PTRACE_POKETEXT: > > > - error = kern_ptrace(td, PT_WRITE_I, pid, addr, uap->data); > > > - break; > > This is wrong. You should access text AS if linux request was for text. > > Do we actually want to maintain that distinction? Looking > at sys/kern/sys_process.c, they are synonyms. It started on PDP-11 were text and data address spaces could be separate. Right now I think this distinction might be useful for applying different policy in addition to the plain mapping permissions, at least. I would prefer to not break the feature until we decide to, instead of doing it silently and on case by case. > > > > case LINUX_PTRACE_POKEDATA: > > > error = kern_ptrace(td, PT_WRITE_D, pid, addr, uap->data); > > > + if (error != 0) > > > + return (error); > > > + /* > > > + * Linux expects this syscall to write 64 bits, not 32. > > > + */ > > > + error = kern_ptrace(td, PT_WRITE_D, pid, > > > + (void *)(uap->addr + 4), uap->data >> 32); > > > break; > > You should use PT_IO there instead of doing two accesses (to the wrong AS). > > Hm, you're right. The only problem I can see is that PT_IO fetches > struct ptrace_io_desc from userspace, which makes wrapping somewhat > hard. How about introducing PT_READ64 and PT_WRITE64 request types > and using them instead? Are you sure? I see that the structure is copied in and out in sys_ptrace(9). Doing it in kern_ptrace(9) would require one more SV_ILP32 check, but it seems to be done right. From owner-dev-commits-src-main@freebsd.org Tue Jan 19 13:11:20 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E72E64F4146; Tue, 19 Jan 2021 13:11:20 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKpvD66wzz3RLb; Tue, 19 Jan 2021 13:11:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C52DE26E74; Tue, 19 Jan 2021 13:11:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JDBK0d021585; Tue, 19 Jan 2021 13:11:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JDBKqY021584; Tue, 19 Jan 2021 13:11:20 GMT (envelope-from git) Date: Tue, 19 Jan 2021 13:11:20 GMT Message-Id: <202101191311.10JDBKqY021584@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: 2c98edd6d6c7 - main - htu21: driver for HTU21D I2C temperature and humidity sensor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c98edd6d6c71ecda4f7e78361286b98abe9fcc6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 13:11:21 -0000 The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=2c98edd6d6c71ecda4f7e78361286b98abe9fcc6 commit 2c98edd6d6c71ecda4f7e78361286b98abe9fcc6 Author: Andriy Gapon AuthorDate: 2021-01-19 12:57:24 +0000 Commit: Andriy Gapon CommitDate: 2021-01-19 13:08:51 +0000 htu21: driver for HTU21D I2C temperature and humidity sensor MFC after: 2 weeks Relnotes: perhaps --- share/man/man4/Makefile | 1 + share/man/man4/htu21.4 | 134 +++++++++++ sys/conf/files | 3 +- sys/dev/iicbus/htu21.c | 521 +++++++++++++++++++++++++++++++++++++++++ sys/modules/i2c/Makefile | 1 + sys/modules/i2c/htu21/Makefile | 17 ++ 6 files changed, 676 insertions(+), 1 deletion(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index abdc1b0f4c4b..fa2af9d32aea 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -197,6 +197,7 @@ MAN= aac.4 \ ${_hptnr.4} \ ${_hptrr.4} \ hsctrl.4 \ + htu21.4 \ ${_hv_kvp.4} \ ${_hv_netvsc.4} \ ${_hv_storvsc.4} \ diff --git a/share/man/man4/htu21.4 b/share/man/man4/htu21.4 new file mode 100644 index 000000000000..990852027e09 --- /dev/null +++ b/share/man/man4/htu21.4 @@ -0,0 +1,134 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2021 Andriy Gapon +.\" +.\" 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 19, 2021 +.Dt HTU21 4 +.Os +.Sh NAME +.Nm htu21 +.Nd driver for HTU21D and compatible temperature and humidity sensors +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device htu21" +.Cd "device iicbus" +.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 +htu21_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides temperature and relative humidity readings over I2C bus +for the supported sensors: +.Bl -bullet -compact +.It +HTU21D +.It +SHT21 +.It +Si7021 +.El +.Pp +The +.Nm +driver reports data via +.Xr sysctl 8 +entries in the device's node in the +.Xr sysctl 8 +tree: +.Bl -tag -width temperature +.It temperature +The temperature, in hundredths of Kelvin. +.It humidity +The relative humidity, in hundredths of a percent. +.It crc_errors +The number of CRC errors in reading the measurements from the device. +.It power +The good power indication. +This can be useful with battery powered sensors. +.It heater +The built-in heater control. +The heater can be used for testing and for recovery from saturation +after high humidity. +.It hold_bus +Whether the sensor should hold SCL low while performing the measurement. +Normally, the sensor releases the bus and NACKs all accessed until the +measurement is completed. +The hold mode may be useful in mult-master environments. +.El +.Pp +On an +.Xr FDT 4 +based system the following properties must be set: +.Bl -tag -width "compatible" +.It Va compatible +Must be set to "meas,htu21". +.It Va reg +The I2C address of +.Nm . +Although, it is hard-wired to 0x40 (7-bit) on all supported sensors. +.El +.Pp +The DTS part for a +.Nm +device usually looks like: +.Bd -literal +/ { + + ... + htu21d { + compatible = "meas,htu21"; + reg = <0x40>; + }; +}; +.Ed +.Sh SEE ALSO +.Xr fdt 4 , +.Xr iicbus 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver and this manual page was written by +.An Andriy Gapon Aq Mt avg@FreeBSD.org . +.Sh BUGS +There is no way to control the measurment resolution. +.Pp +Some sensor variants do not provide a serial number or use an incompatible +format. +The +.Nm +driver does not distinguish those variants and may complain about incorrect +serial number checksum. diff --git a/sys/conf/files b/sys/conf/files index 79f3b7ca54e6..fe017a2537b7 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1851,7 +1851,7 @@ dev/iicbus/ds1307.c optional ds1307 dev/iicbus/ds13rtc.c optional ds13rtc | ds133x | ds1374 dev/iicbus/ds1672.c optional ds1672 dev/iicbus/ds3231.c optional ds3231 -dev/iicbus/syr827.c optional syr827 ext_resources fdt +dev/iicbus/htu21.c optional htu21 dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic dev/iicbus/iic.c optional iic @@ -1880,6 +1880,7 @@ dev/iicbus/rtc8583.c optional rtc8583 dev/iicbus/rtc/rx8803.c optional rx8803 iicbus fdt dev/iicbus/s35390a.c optional s35390a dev/iicbus/sy8106a.c optional sy8106a ext_resources fdt +dev/iicbus/syr827.c optional syr827 ext_resources fdt dev/iicbus/gpio/tca6416.c optional tca6416 fdt dev/iir/iir.c optional iir dev/iir/iir_ctrl.c optional iir diff --git a/sys/dev/iicbus/htu21.c b/sys/dev/iicbus/htu21.c new file mode 100644 index 000000000000..5c59ebe8f54a --- /dev/null +++ b/sys/dev/iicbus/htu21.c @@ -0,0 +1,521 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Andriy Gapon + * + * 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 +#include + +#include + +#include +#include + +#ifdef FDT +#include +#include +#endif + +/* + * Driver for HTU21D and compatible temperature and humidity sensors. + * Reference documents: + * - Measurement Specialties HTU21D datasheet, + * - Sensirion SHT21 datasheet, + * - Silicon Labs Si7021 datasheet, + * - HTU2X Serial Number Reading application note, + * - Sensirion Electronic Identification Code (How to read-out the serial number + * of SHT2x) application note. + */ +#define HTU21_ADDR 0x40 + +#define HTU21_GET_TEMP 0xe3 +#define HTU21_GET_HUM 0xe5 +#define HTU21_GET_TEMP_NH 0xf3 +#define HTU21_GET_HUM_NH 0xf5 +#define HTU21_WRITE_CFG 0xe6 +#define HTU21_READ_CFG 0xe7 +#define HTU21_RESET 0xfe + +#define HTU2x_SERIAL0_0 0xfa +#define HTU2x_SERIAL0_1 0x0f +#define HTU2x_SERIAL1_0 0xfc +#define HTU2x_SERIAL1_1 0xc9 + +struct htu21_softc { + device_t sc_dev; + uint32_t sc_addr; + uint8_t sc_serial[8]; + int sc_errcount; + bool sc_hold; +}; + +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + { "meas,htu21", true }, + { NULL, false } +}; +#endif + +static uint8_t +calc_crc(uint16_t data) +{ + static const uint16_t polynomial = 0x3100; + int i; + + for (i = 0; i < 16; i++) { + int msb_neq = data & 0x8000; + + data <<= 1; + if (msb_neq) + data ^= polynomial; + } + return (data >> 8); +} + +static int +check_crc_16(const uint8_t *data, uint8_t expected) +{ + uint8_t crc; + + crc = calc_crc(((uint16_t)data[0] << 8) | data[1]); + return (crc == expected); +} + +static int +check_crc_8(const uint8_t data, uint8_t expected) +{ + uint8_t crc; + + crc = calc_crc(data); + return (crc == expected); +} + +static int +htu21_get_measurement(device_t dev, uint8_t cmd, uint8_t *data, int count) +{ + + struct iic_msg msgs[2]; + struct htu21_softc *sc; + int error; + + sc = device_get_softc(dev); + msgs[0].slave = sc->sc_addr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = 1; + msgs[0].buf = &cmd; + + msgs[1].slave = sc->sc_addr; + msgs[1].flags = IIC_M_RD; + msgs[1].len = count; + msgs[1].buf = data; + + error = iicbus_transfer_excl(dev, msgs, nitems(msgs), IIC_INTRWAIT); + return (error); +} + +static int +htu21_get_measurement_nohold(device_t dev, uint8_t cmd, + uint8_t *data, int count) +{ + struct iic_msg msgs[2]; + struct htu21_softc *sc; + int error; + int i; + + sc = device_get_softc(dev); + + msgs[0].slave = sc->sc_addr; + msgs[0].flags = IIC_M_WR; + msgs[0].len = 1; + msgs[0].buf = &cmd; + + msgs[1].slave = sc->sc_addr; + msgs[1].flags = IIC_M_RD; + msgs[1].len = count; + msgs[1].buf = data; + + error = iicbus_transfer_excl(dev, &msgs[0], 1, IIC_INTRWAIT); + if (error != 0) + return (error); + + for (i = 0; i < hz; i++) { + error = iicbus_transfer_excl(dev, &msgs[1], 1, IIC_INTRWAIT); + if (error == 0) + return (0); + if (error != IIC_ENOACK) + break; + pause("htu21", 1); + } + return (error); +} + +static int +htu21_temp_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct htu21_softc *sc; + device_t dev; + uint8_t raw_data[3]; + int error, temp; + + dev = arg1; + sc = device_get_softc(dev); + + if (sc->sc_hold) + error = htu21_get_measurement(dev, HTU21_GET_TEMP, + raw_data, nitems(raw_data)); + else + error = htu21_get_measurement_nohold(dev, HTU21_GET_TEMP_NH, + raw_data, nitems(raw_data)); + + if (error != 0) { + return (EIO); + } else if (!check_crc_16(raw_data, raw_data[2])) { + temp = -1; + sc->sc_errcount++; + } else { + temp = (((uint16_t)raw_data[0]) << 8) | (raw_data[1] & 0xfc); + temp = ((temp * 17572) >> 16 ) + 27315 - 4685; + } + + error = sysctl_handle_int(oidp, &temp, 0, req); + return (error); +} + +static int +htu21_rh_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct htu21_softc *sc; + device_t dev; + uint8_t raw_data[3]; + int error, rh; + + dev = arg1; + sc = device_get_softc(dev); + + if (sc->sc_hold) + error = htu21_get_measurement(dev, HTU21_GET_HUM, + raw_data, nitems(raw_data)); + else + error = htu21_get_measurement_nohold(dev, HTU21_GET_HUM_NH, + raw_data, nitems(raw_data)); + + if (error != 0) { + return (EIO); + } else if (!check_crc_16(raw_data, raw_data[2])) { + rh = -1; + sc->sc_errcount++; + } else { + rh = (((uint16_t)raw_data[0]) << 8) | (raw_data[1] & 0xfc); + rh = ((rh * 12500) >> 16 ) - 600; + } + + error = sysctl_handle_int(oidp, &rh, 0, req); + return (error); +} + +static int +htu21_get_cfg(device_t dev, uint8_t *cfg) +{ + + struct iic_msg msgs[2]; + struct htu21_softc *sc; + uint8_t cmd; + int error; + + sc = device_get_softc(dev); + cmd = HTU21_READ_CFG; + msgs[0].slave = sc->sc_addr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = 1; + msgs[0].buf = &cmd; + + msgs[1].slave = sc->sc_addr; + msgs[1].flags = IIC_M_RD; + msgs[1].len = 1; + msgs[1].buf = cfg; + + error = iicbus_transfer_excl(dev, msgs, nitems(msgs), IIC_INTRWAIT); + return (error); +} + +static int +htu21_set_cfg(device_t dev, uint8_t cfg) +{ + + struct iic_msg msg; + struct htu21_softc *sc; + uint8_t buf[2]; + int error; + + sc = device_get_softc(dev); + buf[0] = HTU21_WRITE_CFG; + buf[1] = cfg; + msg.slave = sc->sc_addr; + msg.flags = IIC_M_WR; + msg.len = 2; + msg.buf = buf; + + error = iicbus_transfer_excl(dev, &msg, 1, IIC_INTRWAIT); + return (error); +} + +static int +htu21_heater_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct htu21_softc *sc; + device_t dev; + uint8_t cfg; + int error, heater; + + dev = arg1; + sc = device_get_softc(dev); + + error = htu21_get_cfg(dev, &cfg); + if (error != 0) + return (EIO); + + heater = (cfg & 0x04) != 0; + error = sysctl_handle_int(oidp, &heater, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + + cfg &= ~0x04; + cfg |= (heater > 0) << 2; + error = htu21_set_cfg(dev, cfg); + return (error != 0 ? EIO : 0); +} + +static int +htu21_power_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct htu21_softc *sc; + device_t dev; + uint8_t cfg; + int error, power; + + dev = arg1; + sc = device_get_softc(dev); + + error = htu21_get_cfg(dev, &cfg); + if (error != 0) + return (EIO); + + power = (cfg & 0x40) == 0; + error = sysctl_handle_int(oidp, &power, 0, req); + return (error); +} + +/* + * May be incompatible with some chips like SHT21 and Si7021. + */ +static int +htu21_get_serial(device_t dev) +{ + + struct iic_msg msgs[2]; + struct htu21_softc *sc; + uint8_t data[8]; + uint8_t cmd[2]; + int error, cksum_err; + int i; + + sc = device_get_softc(dev); + cmd[0] = HTU2x_SERIAL0_0; + cmd[1] = HTU2x_SERIAL0_1; + msgs[0].slave = sc->sc_addr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = nitems(cmd); + msgs[0].buf = cmd; + + msgs[1].slave = sc->sc_addr; + msgs[1].flags = IIC_M_RD; + msgs[1].len = nitems(data); + msgs[1].buf = data; + + error = iicbus_transfer_excl(dev, msgs, nitems(msgs), IIC_INTRWAIT); + if (error != 0) + return (EIO); + + cksum_err = 0; + for (i = 0; i < nitems(data); i += 2) { + if (!check_crc_8(data[i], data[i + 1])) + cksum_err = EINVAL; + sc->sc_serial[2 + i / 2] = data[i]; + } + + cmd[0] = HTU2x_SERIAL1_0; + cmd[1] = HTU2x_SERIAL1_1; + msgs[0].slave = sc->sc_addr; + msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; + msgs[0].len = nitems(cmd); + msgs[0].buf = cmd; + + msgs[1].slave = sc->sc_addr; + msgs[1].flags = IIC_M_RD; + msgs[1].len = 6; + msgs[1].buf = data; + + error = iicbus_transfer_excl(dev, msgs, nitems(msgs), IIC_INTRWAIT); + if (error != 0) + return (EIO); + + if (!check_crc_16(&data[0], data[2])) + cksum_err = EINVAL; + sc->sc_serial[6] = data[0]; + sc->sc_serial[7] = data[1]; + + if (!check_crc_16(&data[3], data[5])) + cksum_err = EINVAL; + sc->sc_serial[0] = data[3]; + sc->sc_serial[1] = data[4]; + + return (cksum_err); +} + +static void +htu21_start(void *arg) +{ + device_t dev; + struct htu21_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree_node; + struct sysctl_oid_list *tree; + int error; + + sc = arg; + dev = sc->sc_dev; + + for (int i = 0; i < 5; i++) { + error = htu21_get_serial(dev); + if (error == 0) + break; + } + if (error != EIO) { + device_printf(dev, "serial number: %8D (checksum %scorrect)\n", + sc->sc_serial, ":", error == 0 ? "" : "in"); + } else { + device_printf(dev, "failed to get serial number, err = %d\n", + error); + } + + ctx = device_get_sysctl_ctx(dev); + tree_node = device_get_sysctl_tree(dev); + tree = SYSCTL_CHILDREN(tree_node); + + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "temperature", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, 0, + htu21_temp_sysctl, "IK2", "Current temperature"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "humidity", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, 0, + htu21_rh_sysctl, "I", "Relative humidity in 0.01%% units"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "heater", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, dev, 0, + htu21_heater_sysctl, "IU", "Enable built-in heater"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "power", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, 0, + htu21_power_sysctl, "IU", "If sensor's power is good"); + SYSCTL_ADD_BOOL(ctx, tree, OID_AUTO, "hold_bus", + CTLFLAG_RW, &sc->sc_hold, 0, + "Whether device should hold I2C bus while measuring"); + SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "crc_errors", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &sc->sc_errcount, 0, + "Number of checksum errors"); +} + +static int +htu21_probe(device_t dev) +{ + uint8_t addr; + +#ifdef FDT + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); +#endif + addr = iicbus_get_addr(dev); + if (addr != (HTU21_ADDR << 1)) { + device_printf(dev, "non-standard slave address 0x%02x\n", + addr >> 1); + } + + device_set_desc(dev, "HTU21 temperature and humidity sensor"); + return (BUS_PROBE_GENERIC); +} + +static int +htu21_attach(device_t dev) +{ + struct htu21_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + + /* + * We have to wait until interrupts are enabled. Usually I2C read + * and write only works when the interrupts are available. + */ + config_intrhook_oneshot(htu21_start, sc); + return (0); +} + +static int +htu21_detach(device_t dev) +{ + return (0); +} + +static device_method_t htu21_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, htu21_probe), + DEVMETHOD(device_attach, htu21_attach), + DEVMETHOD(device_detach, htu21_detach), + + DEVMETHOD_END +}; + +static driver_t htu21_driver = { + "htu21", + htu21_methods, + sizeof(struct htu21_softc) +}; + +static devclass_t htu21_devclass; + +DRIVER_MODULE(htu21, iicbus, htu21_driver, htu21_devclass, 0, 0); +MODULE_DEPEND(htu21, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +MODULE_VERSION(htu21, 1); +#ifdef FDT +IICBUS_FDT_PNP_INFO(compat_data); +#endif diff --git a/sys/modules/i2c/Makefile b/sys/modules/i2c/Makefile index 26b492c93c25..edd92943c6c1 100644 --- a/sys/modules/i2c/Makefile +++ b/sys/modules/i2c/Makefile @@ -8,6 +8,7 @@ SUBDIR = \ ds13rtc \ ds1672 \ ds3231 \ + htu21 \ icee \ if_ic \ iic \ diff --git a/sys/modules/i2c/htu21/Makefile b/sys/modules/i2c/htu21/Makefile new file mode 100644 index 000000000000..8586b0c15153 --- /dev/null +++ b/sys/modules/i2c/htu21/Makefile @@ -0,0 +1,17 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/iicbus +KMOD= htu21 +SRCS= htu21.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + iicbus_if.h \ + opt_platform.h + +.if !empty(OPT_FDT) +SRCS+= ofw_bus_if.h +.endif + +.include From owner-dev-commits-src-main@freebsd.org Tue Jan 19 13:56:19 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6E0B24F4D2D; Tue, 19 Jan 2021 13:56:19 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKqv72WPbz3kQ9; Tue, 19 Jan 2021 13:56:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44DB527841; Tue, 19 Jan 2021 13:56:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JDuJVx078662; Tue, 19 Jan 2021 13:56:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JDuJRF078661; Tue, 19 Jan 2021 13:56:19 GMT (envelope-from git) Date: Tue, 19 Jan 2021 13:56:19 GMT Message-Id: <202101191356.10JDuJRF078661@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 5290493a200c - main - RELNOTES: correct sense and name for allow_wx sysctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5290493a200cc71ad3b3ec5b1bc2dd37c7cbcb9c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 13:56:19 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5290493a200cc71ad3b3ec5b1bc2dd37c7cbcb9c commit 5290493a200cc71ad3b3ec5b1bc2dd37c7cbcb9c Author: Ed Maste AuthorDate: 2021-01-19 13:53:07 +0000 Commit: Ed Maste CommitDate: 2021-01-19 13:53:07 +0000 RELNOTES: correct sense and name for allow_wx sysctl The sysctl is kern.elf64.allow_wx and defaults to 1, allow W+X mappings. Reported by: alc --- RELNOTES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELNOTES b/RELNOTES index 585cf68dc2a2..136a6123ee72 100644 --- a/RELNOTES +++ b/RELNOTES @@ -18,7 +18,7 @@ Changes to this file should not be MFCed. Add support for enforcing W^X mapping policy for user processes. The policy is not enforced by default but can be enabled by setting the kern.elf32.allow_wx and - kern.elf64_allow_wx sysctls to 1. Individual binaries can be + kern.elf64.allow_wx sysctls to 0. Individual binaries can be exempted from the policy by elfctl(1) via the wxneeded feature. From owner-dev-commits-src-main@freebsd.org Tue Jan 19 15:10:54 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A3CDC4F68F4; Tue, 19 Jan 2021 15:10:54 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKsYB49dBz3pLC; Tue, 19 Jan 2021 15:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 625979C8; Tue, 19 Jan 2021 15:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JFAsw6077998; Tue, 19 Jan 2021 15:10:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JFAs5U077996; Tue, 19 Jan 2021 15:10:54 GMT (envelope-from git) Date: Tue, 19 Jan 2021 15:10:54 GMT Message-Id: <202101191510.10JFAs5U077996@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: fa6662b3689e - main - ixl: Permit 802.1ad frames to pass though the chip MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa6662b3689eeb71cb63c2b230ca08e7342cabf0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 15:10:54 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=fa6662b3689eeb71cb63c2b230ca08e7342cabf0 commit fa6662b3689eeb71cb63c2b230ca08e7342cabf0 Author: Lutz Donnerhacke AuthorDate: 2021-01-19 14:56:16 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-01-19 15:01:09 +0000 ixl: Permit 802.1ad frames to pass though the chip This patch is a quick hack to change the internal Ethertype used within the chip. All frames with this type are dropped silently. This patch allows you to overwrite the factory default 0x88a8, which is used by IEEE 802.1ad VLAN stacking. Reviewed by: kp, philip, brueffer Approved by: kp (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24179 --- share/man/man4/ixl.4 | 11 ++++++++++- sys/dev/ixl/ixl_pf_main.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ixl.4 b/share/man/man4/ixl.4 index cd924625c4f2..320971a74f52 100644 --- a/share/man/man4/ixl.4 +++ b/share/man/man4/ixl.4 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 27, 2020 +.Dd January 19, 2021 .Dt IXL 4 .Os .Sh NAME @@ -227,6 +227,15 @@ contains the speeds that are allowed to be set. Displays the current speed. .It Va dev.ixl.#.fw_version Displays the current firmware and NVM versions of the adapter. +.It Va dev.ixl.#.debug.switch_vlans +Set the Ethertype used by the hardware itself to handle internal +services. +Frames with this Ethertype will be dropped without notice. +Defaults to +.Dv 0x88a8 , +which is a well known number for IEEE 802.1ad VLAN stacking. +If you need 802.1ad support, set this number to any another Ethertype i.e. +.Dv 0xffff . .El .Sh INTERRUPT STORMS It is important to note that 40G operation can generate high diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 4b450e340f5f..eddd4dfaab0d 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -69,6 +69,7 @@ static int ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_sw_filter_list(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hw_res_alloc(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS); +static int ixl_sysctl_switch_vlans(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hkey(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hena(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_hlut(SYSCTL_HANDLER_ARGS); @@ -2329,6 +2330,11 @@ ixl_add_device_sysctls(struct ixl_pf *pf) CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, pf, 0, ixl_sysctl_switch_config, "A", "HW Switch Configuration"); + SYSCTL_ADD_PROC(ctx, debug_list, + OID_AUTO, "switch_vlans", + CTLTYPE_INT | CTLFLAG_WR | CTLFLAG_NEEDGIANT, + pf, 0, ixl_sysctl_switch_vlans, "I", "HW Switch VLAN Configuration"); + SYSCTL_ADD_PROC(ctx, debug_list, OID_AUTO, "rss_key", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, @@ -3481,6 +3487,40 @@ ixl_sysctl_switch_config(SYSCTL_HANDLER_ARGS) return (error); } +static int +ixl_sysctl_switch_vlans(SYSCTL_HANDLER_ARGS) +{ + struct ixl_pf *pf = (struct ixl_pf *)arg1; + struct i40e_hw *hw = &pf->hw; + device_t dev = pf->dev; + int requested_vlan = -1; + enum i40e_status_code status = 0; + int error = 0; + + error = sysctl_handle_int(oidp, &requested_vlan, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + if ((hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) == 0) { + device_printf(dev, "Flags disallow setting of vlans\n"); + return (ENODEV); + } + + hw->switch_tag = requested_vlan; + device_printf(dev, + "Setting switch config to switch_tag=%04x, first_tag=%04x, second_tag=%04x\n", + hw->switch_tag, hw->first_tag, hw->second_tag); + status = i40e_aq_set_switch_config(hw, 0, 0, 0, NULL); + if (status) { + device_printf(dev, + "%s: aq_set_switch_config() error %s, aq error %s\n", + __func__, i40e_stat_str(hw, status), + i40e_aq_str(hw, hw->aq.asq_last_status)); + return (status); + } + return (0); +} + static int ixl_sysctl_hkey(SYSCTL_HANDLER_ARGS) { From owner-dev-commits-src-main@freebsd.org Tue Jan 19 16:43:08 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E7C114D87E4 for ; Tue, 19 Jan 2021 16:43:08 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DKvbc664bz3v3c for ; Tue, 19 Jan 2021 16:43:08 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f50.google.com with SMTP id o10so1892075wmc.1 for ; Tue, 19 Jan 2021 08:43:08 -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:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=zhlMH9WR8J01fXeB/Qp5YzevfF6sQmustZ4f06RZOcU=; b=HP1Mf+68xXuYtAx+tR+N25sN2sZmO5tPAI5yJbnRbD91AIYYXHINyhuS06MEhgtr3s 2dSYhBD0ak5ONmin/x6JknYPXodFwekaAvGMmVnAV6s0wsAOTkWej7dlu9N+2HWhYMMY QH6awHm7q12TAaGyc5JdaUj1CEyYHpEnek7Vl/2+uTxGYFVqN7/SlthJCj6iqDnj/Oz0 lsWIt6pFTpK3+37+8HBUMMaJ22820LM5n4I9PzvzELVUh0lVCRLGItUNVwUAHSQdcqAy hzLYDoshCbfFzlhk2dIkdFUr4kLArPgZmhhZnpirJ8nrn92hjQC4HZ26hhGVRI6M/hNk 9DJA== X-Gm-Message-State: AOAM531N4kDA6zGfbMsfwtvu8+D8O/Me3U/BX+int6obwSSZwqjAqkIF dNnObcNa8pXAejxY24WxXMYFxg== X-Google-Smtp-Source: ABdhPJx9Vavuyqg+8MO69lStCGWCcu8Q46ZSErbyPAWpY0lroBk4CYTAd3h9KDvdHx5hvAPuHyFCBQ== X-Received: by 2002:a05:600c:618:: with SMTP id o24mr480523wmm.82.1611074586850; Tue, 19 Jan 2021 08:43:06 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id h15sm36269764wru.4.2021.01.19.08.43.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jan 2021 08:43:06 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 248f0cabca75 - main - make maximum interrupt number tunable on ARM, ARM64, MIPS, and RISC-V From: Jessica Clarke In-Reply-To: <202101190036.10J0aj3O033256@gitrepo.freebsd.org> Date: Tue, 19 Jan 2021 16:43:05 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: 7bit Message-Id: <8FE79D0F-602A-4C98-893A-806E72ED991B@freebsd.org> References: <202101190036.10J0aj3O033256@gitrepo.freebsd.org> To: Oleksandr Tymoshenko X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DKvbc664bz3v3c X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 16:43:09 -0000 On 19 Jan 2021, at 00:36, Oleksandr Tymoshenko wrote: > @@ -142,21 +143,15 @@ static bool irq_assign_cpu = false; > #endif > #endif > > -/* > - * - 2 counters for each I/O interrupt. > - * - MAXCPU counters for each IPI counters for SMP. > - */ > -#ifdef SMP > -#define INTRCNT_COUNT (NIRQ * 2 + INTR_IPI_COUNT * MAXCPU) > -#else > -#define INTRCNT_COUNT (NIRQ * 2) > -#endif > +int intr_nirq = NIRQ; > +SYSCTL_UINT(_machdep, OID_AUTO, nirq, CTLFLAG_RDTUN, &intr_nirq, 0, > + "Number of IRQs"); Unsigned integer, given the SYSCTL_UINT? What's stopping us from dynamically resizing rather than forcing the user to use a tunable (which also means that, in practice, the limit will remain unchanged, because you want GENERIC kernels to work out of the box)? Jess From owner-dev-commits-src-main@freebsd.org Tue Jan 19 18:29:55 2021 Return-Path: Delivered-To: dev-commits-src-main@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 456324DABAE; Tue, 19 Jan 2021 18:29:55 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKxyq1Gzhz4Vhd; Tue, 19 Jan 2021 18:29:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (c-98-35-218-221.hsd1.ca.comcast.net [98.35.218.221]) (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 8E4882D47D; Tue, 19 Jan 2021 18:29:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 5290493a200c - main - RELNOTES: correct sense and name for allow_wx sysctl To: Ed Maste , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101191356.10JDuJRF078661@gitrepo.freebsd.org> From: John Baldwin 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: <477ffb44-66b7-cfc3-d593-124221d74df6@FreeBSD.org> Date: Tue, 19 Jan 2021 10:28:11 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <202101191356.10JDuJRF078661@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 18:29:55 -0000 On 1/19/21 5:56 AM, Ed Maste wrote: > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5290493a200cc71ad3b3ec5b1bc2dd37c7cbcb9c > > commit 5290493a200cc71ad3b3ec5b1bc2dd37c7cbcb9c > Author: Ed Maste > AuthorDate: 2021-01-19 13:53:07 +0000 > Commit: Ed Maste > CommitDate: 2021-01-19 13:53:07 +0000 > > RELNOTES: correct sense and name for allow_wx sysctl > > The sysctl is kern.elf64.allow_wx and defaults to 1, allow W+X mappings. > > Reported by: alc Thanks. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Tue Jan 19 18:38:51 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2D5274DACE0; Tue, 19 Jan 2021 18:38:51 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKy970Wmwz4VwN; Tue, 19 Jan 2021 18:38:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04C07304A; Tue, 19 Jan 2021 18:38:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JIcoFQ044602; Tue, 19 Jan 2021 18:38:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JIcorS044601; Tue, 19 Jan 2021 18:38:50 GMT (envelope-from git) Date: Tue, 19 Jan 2021 18:38:50 GMT Message-Id: <202101191838.10JIcorS044601@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: 041b28524a3c - main - release: Add workaround to use SVN for ports MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 041b28524a3c69ff6e893067df156c3faabcac9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 18:38:51 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=041b28524a3c69ff6e893067df156c3faabcac9a commit 041b28524a3c69ff6e893067df156c3faabcac9a Author: Glen Barber AuthorDate: 2021-01-19 18:38:33 +0000 Commit: Glen Barber CommitDate: 2021-01-19 18:38:33 +0000 release: Add workaround to use SVN for ports The ports tree is scheduled to be converted from Subversion to Git after the currently-scheduled 13.0-RELEASE, so the source of truth will be Subversion for the ports tree. Implement a hack specifically for this case. Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/release.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/release/release.sh b/release/release.sh index 0975bdfed6b3..15c94ca9328e 100755 --- a/release/release.sh +++ b/release/release.sh @@ -65,6 +65,17 @@ env_setup() { [ ! -z "${VCSCMD}" ] && break 2 done + # Find the Subversion binary to use. This is a workaround to use + # the source of truth for the ports tree, as the conversion to Git + # is targeted to occur slightly after the currently-scheduled 13.0 + # release. + for _dir in /usr/bin /usr/local/bin; do + for _svn in svn svnlite; do + [ -x "${_dir}/${_svn}" ] && SVNCMD="${_dir}/${_svn}" + [ ! -z "${SVNCMD}" ] && break 2 + done + done + if [ -z "${VCSCMD}" -a -z "${NOGIT}" ]; then echo "*** The devel/git port/package is required." exit 1 @@ -76,7 +87,7 @@ env_setup() { GITROOT="https://git.FreeBSD.org/" SRCBRANCH="main" DOCBRANCH="main" - PORTBRANCH="main" + PORTBRANCH="head" GITSRC="src.git" GITPORTS="ports.git" GITDOC="doc.git" @@ -136,7 +147,7 @@ env_check() { SRC="${GITROOT}${GITSRC}" DOC="${GITROOT}${GITDOC}" #PORT="${GITROOT}${GITPORTS}" - PORT="https://cgit-beta.freebsd.org/ports.git" + PORT="svn://svn.freebsd.org/ports/${PORTBRANCH}" if [ -n "${EMBEDDEDBUILD}" ]; then WITH_DVD= @@ -238,7 +249,10 @@ chroot_setup() { if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then git -C ${CHROOTDIR}/usr/ports pull -q else - ${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports + #${VCSCMD} ${PORT} -b ${PORTBRANCH} ${CHROOTDIR}/usr/ports + # XXX: Workaround for the overlap in the Git + # conversion timeframe. + ${SVNCMD} co ${PORT}/${PORTBRANCH} ${CHROOTDIR}/usr/ports fi fi From owner-dev-commits-src-main@freebsd.org Tue Jan 19 18:41:23 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BF03B4DB295; Tue, 19 Jan 2021 18:41:23 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKyD34p2hz4WPV; Tue, 19 Jan 2021 18:41:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:29d8:2a8f:b77a:ed65]) (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 E8D3C2D9B0; Tue, 19 Jan 2021 18:41:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 248f0cabca75 - main - make maximum interrupt number tunable on ARM, ARM64, MIPS, and RISC-V To: Jessica Clarke , Oleksandr Tymoshenko Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202101190036.10J0aj3O033256@gitrepo.freebsd.org> <8FE79D0F-602A-4C98-893A-806E72ED991B@freebsd.org> From: John Baldwin 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: Tue, 19 Jan 2021 10:41:21 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <8FE79D0F-602A-4C98-893A-806E72ED991B@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 18:41:23 -0000 On 1/19/21 8:43 AM, Jessica Clarke wrote: > On 19 Jan 2021, at 00:36, Oleksandr Tymoshenko wrote: >> @@ -142,21 +143,15 @@ static bool irq_assign_cpu = false; >> #endif >> #endif >> >> -/* >> - * - 2 counters for each I/O interrupt. >> - * - MAXCPU counters for each IPI counters for SMP. >> - */ >> -#ifdef SMP >> -#define INTRCNT_COUNT (NIRQ * 2 + INTR_IPI_COUNT * MAXCPU) >> -#else >> -#define INTRCNT_COUNT (NIRQ * 2) >> -#endif >> +int intr_nirq = NIRQ; >> +SYSCTL_UINT(_machdep, OID_AUTO, nirq, CTLFLAG_RDTUN, &intr_nirq, 0, >> + "Number of IRQs"); > > Unsigned integer, given the SYSCTL_UINT? > > What's stopping us from dynamically resizing rather than forcing the > user to use a tunable (which also means that, in practice, the limit > will remain unchanged, because you want GENERIC kernels to work out of > the box)? For x86 (and probably the same here), the biggest headache is that there is a dynamically allocated array indexed by IRQ value at interrupt invocation time. Currently it uses no locks since the value of the pointer is set during boot time and then never changes. Making it dynamic would require allowing that pointer to change and dealing with what that entails in a very hot path. Generally speaking, the majority of interrupts used in a given system are allocated during boot and not by hotplug devices added post-boot, so there is also not a lot of utility in having this run-time tunable vs a boot-time tunable. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Tue Jan 19 18:53:52 2021 Return-Path: Delivered-To: dev-commits-src-main@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 3D7A34DB721; Tue, 19 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKyVS1JfGz4XKS; Tue, 19 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FEBA3850; Tue, 19 Jan 2021 18:53:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JIrqPM069465; Tue, 19 Jan 2021 18:53:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JIrqRV069464; Tue, 19 Jan 2021 18:53:52 GMT (envelope-from git) Date: Tue, 19 Jan 2021 18:53:52 GMT Message-Id: <202101191853.10JIrqRV069464@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: 33f38c8a98e3 - main - release.sh: bump Copyright year after previous commit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33f38c8a98e36566fa773386ea93632ee4e0f604 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 18:53:52 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=33f38c8a98e36566fa773386ea93632ee4e0f604 commit 33f38c8a98e36566fa773386ea93632ee4e0f604 Author: Glen Barber AuthorDate: 2021-01-19 18:53:29 +0000 Commit: Glen Barber CommitDate: 2021-01-19 18:53:29 +0000 release.sh: bump Copyright year after previous commit Sponsored by: Rubicon Communications, LLC (netgate.com) --- release/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/release.sh b/release/release.sh index 15c94ca9328e..60034f123490 100755 --- a/release/release.sh +++ b/release/release.sh @@ -1,6 +1,6 @@ #!/bin/sh #- -# Copyright (c) 2020 Rubicon Communications, LLC (netgate.com) +# Copyright (c) 2020-2021 Rubicon Communications, LLC (netgate.com) # Copyright (c) 2013-2019 The FreeBSD Foundation # Copyright (c) 2013 Glen Barber # Copyright (c) 2011 Nathan Whitehorn From owner-dev-commits-src-main@freebsd.org Tue Jan 19 19:06:46 2021 Return-Path: Delivered-To: dev-commits-src-main@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 957A34DBF2B; Tue, 19 Jan 2021 19:06:46 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKynL3qp8z4Y0T; Tue, 19 Jan 2021 19:06:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76B183B5D; Tue, 19 Jan 2021 19:06:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JJ6kYT082919; Tue, 19 Jan 2021 19:06:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JJ6kxB082918; Tue, 19 Jan 2021 19:06:46 GMT (envelope-from git) Date: Tue, 19 Jan 2021 19:06:46 GMT Message-Id: <202101191906.10JJ6kxB082918@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c7f3aa34cf0e - main - arm64: Trim duplicate code from cpu_fork_kthread_handler(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7f3aa34cf0eca4de268e8fca19af60db210558a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 19:06:46 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c7f3aa34cf0eca4de268e8fca19af60db210558a commit c7f3aa34cf0eca4de268e8fca19af60db210558a Author: John Baldwin AuthorDate: 2021-01-08 22:56:22 +0000 Commit: John Baldwin CommitDate: 2021-01-19 19:05:41 +0000 arm64: Trim duplicate code from cpu_fork_kthread_handler(). cpu_fork_kthread_handler() is always called after either cpu_fork() or cpu_copy_thread(). The arm64 version was duplicating some of the work already done by both of those functions. Sponsored by: Netflix --- sys/arm64/arm64/vm_machdep.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 6a84dc023562..37fcf0224521 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -265,10 +265,6 @@ cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg) td->td_pcb->pcb_x[8] = (uintptr_t)func; td->td_pcb->pcb_x[9] = (uintptr_t)arg; - td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; - td->td_pcb->pcb_sp = (uintptr_t)td->td_frame; - td->td_pcb->pcb_fpusaved = &td->td_pcb->pcb_fpustate; - td->td_pcb->pcb_vfpcpu = UINT_MAX; } void From owner-dev-commits-src-main@freebsd.org Tue Jan 19 19:06:47 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B3FF14DBB7D; Tue, 19 Jan 2021 19:06:47 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKynM4mjXz4YGF; Tue, 19 Jan 2021 19:06:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 970793CA6; Tue, 19 Jan 2021 19:06:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JJ6la6082939; Tue, 19 Jan 2021 19:06:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JJ6liW082938; Tue, 19 Jan 2021 19:06:47 GMT (envelope-from git) Date: Tue, 19 Jan 2021 19:06:47 GMT Message-Id: <202101191906.10JJ6liW082938@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c6e27f5697c2 - main - arm64: Clear FPU flags in the pcb in cpu_copy_thread(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6e27f5697c28e188739ea1b4994dc8869dfb6c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 19:06:47 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c6e27f5697c28e188739ea1b4994dc8869dfb6c2 commit c6e27f5697c28e188739ea1b4994dc8869dfb6c2 Author: John Baldwin AuthorDate: 2021-01-08 22:56:54 +0000 Commit: John Baldwin CommitDate: 2021-01-19 19:05:48 +0000 arm64: Clear FPU flags in the pcb in cpu_copy_thread(). New threads start off with clean FPU state instead of inheriting state from the parent thread. PR: 247945 Sponsored by: Netflix --- sys/arm64/arm64/vm_machdep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 37fcf0224521..90d628a7d6ee 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -175,6 +175,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) td->td_pcb->pcb_x[9] = (uintptr_t)td; td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline; td->td_pcb->pcb_sp = (uintptr_t)td->td_frame; + td->td_pcb->pcb_fpflags &= ~(PCB_FP_STARTED | PCB_FP_KERN | PCB_FP_NOSAVE); td->td_pcb->pcb_fpusaved = &td->td_pcb->pcb_fpustate; td->td_pcb->pcb_vfpcpu = UINT_MAX; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 19:10:20 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D25694DC206; Tue, 19 Jan 2021 19:10:20 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKysS5MyNz4YVt; Tue, 19 Jan 2021 19:10:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:29d8:2a8f:b77a:ed65]) (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 35F812E304; Tue, 19 Jan 2021 19:10:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: c7f3aa34cf0e - main - arm64: Trim duplicate code from cpu_fork_kthread_handler(). From: John Baldwin To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101191906.10JJ6kxB082918@gitrepo.freebsd.org> 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: <89e088a6-c257-9f14-b056-c962dd1d3a6b@FreeBSD.org> Date: Tue, 19 Jan 2021 11:10:18 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <202101191906.10JJ6kxB082918@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 19:10:20 -0000 On 1/19/21 11:06 AM, John Baldwin wrote: > The branch main has been updated by jhb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=c7f3aa34cf0eca4de268e8fca19af60db210558a > > commit c7f3aa34cf0eca4de268e8fca19af60db210558a > Author: John Baldwin > AuthorDate: 2021-01-08 22:56:22 +0000 > Commit: John Baldwin > CommitDate: 2021-01-19 19:05:41 +0000 > > arm64: Trim duplicate code from cpu_fork_kthread_handler(). > > cpu_fork_kthread_handler() is always called after either cpu_fork() or > cpu_copy_thread(). The arm64 version was duplicating some of the work > already done by both of those functions. > > Sponsored by: Netflix Gah, pushed the wrong branch. This and the next commit were both reviewed by markj@. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Tue Jan 19 19:36:31 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0AD464DCABE; Tue, 19 Jan 2021 19:36:31 +0000 (UTC) (envelope-from gbe@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKzRf6zTmz4ZxM; Tue, 19 Jan 2021 19:36:30 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d72fc8ec1da13d5dd89944cc.dip0.t-ipconnect.de [IPv6:2003:d5:d72f:c8ec:1da1:3d5d:d899:44cc]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 8207F2E550; Tue, 19 Jan 2021 19:36:30 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Tue, 19 Jan 2021 20:36:27 +0100 From: Gordon Bergling To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: c7f3aa34cf0e - main - arm64: Trim duplicate code from cpu_fork_kthread_handler(). Message-ID: References: <202101191906.10JJ6kxB082918@gitrepo.freebsd.org> <89e088a6-c257-9f14-b056-c962dd1d3a6b@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <89e088a6-c257-9f14-b056-c962dd1d3a6b@FreeBSD.org> X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 8:34PM up 6 days, 9:04, 4 users, load averages: 0.06, 0.21, 0.23 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 19:36:31 -0000 On Tue, Jan 19, 2021 at 11:10:18AM -0800, John Baldwin wrote: > On 1/19/21 11:06 AM, John Baldwin wrote: > > The branch main has been updated by jhb: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=c7f3aa34cf0eca4de268e8fca19af60db210558a > > > > commit c7f3aa34cf0eca4de268e8fca19af60db210558a > > Author: John Baldwin > > AuthorDate: 2021-01-08 22:56:22 +0000 > > Commit: John Baldwin > > CommitDate: 2021-01-19 19:05:41 +0000 > > > > arm64: Trim duplicate code from cpu_fork_kthread_handler(). > > > > cpu_fork_kthread_handler() is always called after either cpu_fork() or > > cpu_copy_thread(). The arm64 version was duplicating some of the work > > already done by both of those functions. > > > > Sponsored by: Netflix > > Gah, pushed the wrong branch. This and the next commit were both > reviewed by markj@. Thanks for the quick bugfix anyway. --Gordon From owner-dev-commits-src-main@freebsd.org Tue Jan 19 19:42:23 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9A56D4DCEB9; Tue, 19 Jan 2021 19:42:23 +0000 (UTC) (envelope-from meloun.michal@gmail.com) Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DKzZR3gLdz4bgG; Tue, 19 Jan 2021 19:42:23 +0000 (UTC) (envelope-from meloun.michal@gmail.com) Received: by mail-ed1-x52b.google.com with SMTP id h16so22964640edt.7; Tue, 19 Jan 2021 11:42:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cxNK7KMhXM9GWGlY7tTCai/+TnJ050uA7jxqdyQ0J2o=; b=PNhFbiFR35Ii4CSEyylCNEp9bXo35zmrRx+R7ASgi71rlguQluc9ePIklgcVfjX7Rt 2LJJNOSDHIXzFkmfxpPFbykJ6WOeX4wslV1Xml25B4sx/ErUre9uXUpjjm/jUtfk5aZI PrCfOMSGiiTM+/ZIHl85SU+wBDZsjavmZ0srGwRefvmjJPegxxGdGYLur7PThlKecFBQ jY3gJO91Pso7WOB0wG8h6dtO+WhHJQ3Yw0hCzAptuDHjHkHZdPt8XoxuDnl/qHXeEerQ GKNxKHTyc6wCr7bm2jxLQ+XR36d0oo/1790WBh9B3vtvPwvobuQZgq1lNcw/otRg4wsz U9NA== 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:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=cxNK7KMhXM9GWGlY7tTCai/+TnJ050uA7jxqdyQ0J2o=; b=Ey5vaeGQ2Dt+EIERkac9LtaI0kWlCjGphI5ZD6ScPMi/Zd8PKxMwRixdKE631Vyg3O Zi+/PD1yJ2IQq1YXQ/P6lTy+RQMWUvpUOGNCM5Pnr8c6ld9zJzXBDSKFiBMvGMSao3Hu AvqV0xsE4PNajstuavwhFLVwSn+3ow12dFrOFt9hW+h6kJYoHRys4/FP2Z1rK0rhC2+x fLEXFJ0HbIU+Ggo14wXGjdZ2ic/s3iodie7HcVE/QRwbdKY/zhBG0hM+bYF2zvUzH9g4 hVm/S0Z/M6+v+e1PH2NfnqJWLJXG2SGrqswOvdBYKIJiq42kB1sQI5nvKXr+g0ErRTu6 PBPg== X-Gm-Message-State: AOAM5320zbDZszKIHziSQMFZeGvsNMgXfmGGsZHlfjC6Xb7oU8pyRCy4 beQedDrv+h3Hl0I+V2u9l2HMYEu+HyakWA== X-Google-Smtp-Source: ABdhPJxg4J7lWIAEeuw2LZ6ItlcteoVBithZ/2UJX/kM8PVd+6IXIXcdZhhv7Ni0VdgESV0E5Z3Drg== X-Received: by 2002:a50:e719:: with SMTP id a25mr4678922edn.12.1611085341710; Tue, 19 Jan 2021 11:42:21 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id p3sm12607354edh.50.2021.01.19.11.42.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Jan 2021 11:42:13 -0800 (PST) Sender: Michal Meloun Reply-To: meloun.michal@gmail.com Subject: Re: git: 248f0cabca75 - main - make maximum interrupt number tunable on ARM, ARM64, MIPS, and RISC-V To: John Baldwin , Jessica Clarke , Oleksandr Tymoshenko Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202101190036.10J0aj3O033256@gitrepo.freebsd.org> <8FE79D0F-602A-4C98-893A-806E72ED991B@freebsd.org> From: Michal Meloun Message-ID: <80a3722c-16d1-0e8e-b6e1-4bdcfb554aa4@gmail.com> Date: Tue, 19 Jan 2021 20:42:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DKzZR3gLdz4bgG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 19:42:23 -0000 On 19.01.2021 19:41, John Baldwin wrote: > On 1/19/21 8:43 AM, Jessica Clarke wrote: >> On 19 Jan 2021, at 00:36, Oleksandr Tymoshenko wrote: >>> @@ -142,21 +143,15 @@ static bool irq_assign_cpu = false; >>> #endif >>> #endif >>> >>> -/* >>> - * - 2 counters for each I/O interrupt. >>> - * - MAXCPU counters for each IPI counters for SMP. >>> - */ >>> -#ifdef SMP >>> -#define INTRCNT_COUNT (NIRQ * 2 + INTR_IPI_COUNT * MAXCPU) >>> -#else >>> -#define INTRCNT_COUNT (NIRQ * 2) >>> -#endif >>> +int intr_nirq = NIRQ; >>> +SYSCTL_UINT(_machdep, OID_AUTO, nirq, CTLFLAG_RDTUN, &intr_nirq, 0, >>> + "Number of IRQs"); >> >> Unsigned integer, given the SYSCTL_UINT? >> >> What's stopping us from dynamically resizing rather than forcing the >> user to use a tunable (which also means that, in practice, the limit >> will remain unchanged, because you want GENERIC kernels to work out of >> the box)? > > For x86 (and probably the same here), the biggest headache is that there > is a dynamically allocated array indexed by IRQ value at interrupt > invocation time. Currently it uses no locks since the value of the > pointer is set during boot time and then never changes. Making it > dynamic would require allowing that pointer to change and dealing with > what that entails in a very hot path. Generally speaking, the majority > of interrupts used in a given system are allocated during boot and not > by hotplug devices added post-boot, so there is also not a lot of utility > in having this run-time tunable vs a boot-time tunable. > To be exact, the main headaches are intrcnt and intrnames arrays and their relationship to the sysctl interface. These fields are used without locking, they do not have the ability to mark interrupt at given index as unused. This is the real reason why we can't unload a driver that acts as an interrupt controller (e.g. USB parallel port with the possibility of interrupts on each pin). Everything else in subr_intr.c should be prepared for dynamic allocation/delete of interrupt sources. Michal From owner-dev-commits-src-main@freebsd.org Tue Jan 19 19:57:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C419F4DD16B; Tue, 19 Jan 2021 19:57:38 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKzw24mWQz4cJP; Tue, 19 Jan 2021 19:57:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C10748FC; Tue, 19 Jan 2021 19:57:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JJvcpN048301; Tue, 19 Jan 2021 19:57:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JJvcEF048300; Tue, 19 Jan 2021 19:57:38 GMT (envelope-from git) Date: Tue, 19 Jan 2021 19:57:38 GMT Message-Id: <202101191957.10JJvcEF048300@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 8e9313caa672 - main - Convert unmapped mbufs before computing checksums in IPsec. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e9313caa6725f8c65fcacb147ce88a9ba6f6f2a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 19:57:38 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8e9313caa6725f8c65fcacb147ce88a9ba6f6f2a commit 8e9313caa6725f8c65fcacb147ce88a9ba6f6f2a Author: John Baldwin AuthorDate: 2021-01-19 19:51:27 +0000 Commit: John Baldwin CommitDate: 2021-01-19 19:52:00 +0000 Convert unmapped mbufs before computing checksums in IPsec. This is similar to the logic used in ip_output() to convert mbufs prior to computing checksums. Unmapped mbufs can be sent when using sendfile() over IPsec or using KTLS over IPsec. Reported by: Sony Arpita Das @ Chelsio QA Reviewed by: np Sponsored by: Chelsio Differential Revision: https://reviews.freebsd.org/D28187 --- sys/netipsec/ipsec_output.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c index f95a35226f6f..86f06fd10947 100644 --- a/sys/netipsec/ipsec_output.c +++ b/sys/netipsec/ipsec_output.c @@ -323,13 +323,26 @@ ipsec4_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) * this is done in the normal processing path. */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + m = mb_unmapped_to_ext(m); + if (m == NULL) { + IPSECSTAT_INC(ips_out_nomem); + key_freesp(&sp); + return (ENOBUFS); + } in_delayed_cksum(m); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } #if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP) { - struct ip *ip = mtod(m, struct ip *); + struct ip *ip; + m = mb_unmapped_to_ext(m); + if (m == NULL) { + IPSECSTAT_INC(ips_out_nomem); + key_freesp(&sp); + return (ENOBUFS); + } + ip = mtod(m, struct ip *); sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP; } @@ -617,12 +630,24 @@ ipsec6_common_output(struct mbuf *m, struct inpcb *inp, int forwarding) * this is done in the normal processing path. */ if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) { + m = mb_unmapped_to_ext(m); + if (m == NULL) { + IPSEC6STAT_INC(ips_out_nomem); + key_freesp(&sp); + return (ENOBUFS); + } in6_delayed_cksum(m, m->m_pkthdr.len - sizeof(struct ip6_hdr), sizeof(struct ip6_hdr)); - m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; + m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; } #if defined(SCTP) || defined(SCTP_SUPPORT) if (m->m_pkthdr.csum_flags & CSUM_SCTP_IPV6) { + m = mb_unmapped_to_ext(m); + if (m == NULL) { + IPSEC6STAT_INC(ips_out_nomem); + key_freesp(&sp); + return (ENOBUFS); + } sctp_delayed_cksum(m, sizeof(struct ip6_hdr)); m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6; } From owner-dev-commits-src-main@freebsd.org Tue Jan 19 19:59:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 77C004DD69D; Tue, 19 Jan 2021 19:59:02 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DKzxf2x4Fz4cdf; Tue, 19 Jan 2021 19:59:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5774349D5; Tue, 19 Jan 2021 19:59:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JJx2og048617; Tue, 19 Jan 2021 19:59:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JJx2vP048616; Tue, 19 Jan 2021 19:59:02 GMT (envelope-from git) Date: Tue, 19 Jan 2021 19:59:02 GMT Message-Id: <202101191959.10JJx2vP048616@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 52e3a7300d81 - main - loader: handle malloc failures in vbe_init, use consistent naming MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 52e3a7300d817002d3b7f8336ba1716c9c2621a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 19:59:02 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=52e3a7300d817002d3b7f8336ba1716c9c2621a3 commit 52e3a7300d817002d3b7f8336ba1716c9c2621a3 Author: Toomas Soome AuthorDate: 2021-01-18 08:52:08 +0000 Commit: Toomas Soome CommitDate: 2021-01-19 19:58:46 +0000 loader: handle malloc failures in vbe_init, use consistent naming Handle malloc failures in vbe_init(). If it should so happen and we do get malloc failure in vbe_init(), use original mode list. Replace nitems with nentries to have naming consistency and avoid confusion with nitems() macro. Reported by: yuripv, rpokala --- stand/i386/libi386/vbe.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/stand/i386/libi386/vbe.c b/stand/i386/libi386/vbe.c index 8b2c74ade92e..0e9f6929ac05 100644 --- a/stand/i386/libi386/vbe.c +++ b/stand/i386/libi386/vbe.c @@ -565,8 +565,16 @@ vbe_init(void) gfx_state.tg_ctype = CT_INDEXED; gfx_state.tg_mode = 3; - if (vbe == NULL) + env_setenv("screen.textmode", EV_VOLATILE, "1", mode_set, + env_nounset); + env_setenv("vbe_max_resolution", EV_VOLATILE, NULL, mode_set, + env_nounset); + + if (vbe == NULL) { vbe = malloc(sizeof(*vbe)); + if (vbe == NULL) + return; + } if (vbe_mode == NULL) { vbe_mode = malloc(sizeof(*vbe_mode)); @@ -581,6 +589,7 @@ vbe_init(void) vbe = NULL; free(vbe_mode); vbe_mode = NULL; + return; } /* @@ -592,22 +601,21 @@ vbe_init(void) ; vbe_mode_list_size = (uintptr_t)p - (uintptr_t)ml; + + /* + * Since vbe_init() is used only once at very start of the loader, + * we assume malloc will not fail there, but in case it does, + * we point vbe_mode_list to memory pointed by VideoModePtr. + */ vbe_mode_list = malloc(vbe_mode_list_size); - if (vbe_mode_list == NULL) { - free(vbe); - vbe = NULL; - free(vbe_mode); - vbe_mode = NULL; - } - bcopy(ml, vbe_mode_list, vbe_mode_list_size); + if (vbe_mode_list == NULL) + vbe_mode_list = ml; + else + bcopy(ml, vbe_mode_list, vbe_mode_list_size); - /* reset VideoModePtr, so we will not have chance to use bad data. */ + /* reset VideoModePtr, to make sure, we only do use vbe_mode_list. */ vbe->VideoModePtr = 0; - env_setenv("screen.textmode", EV_VOLATILE, "1", mode_set, - env_nounset); - env_setenv("vbe_max_resolution", EV_VOLATILE, NULL, mode_set, - env_nounset); /* vbe_set_mode() will set up the rest. */ } @@ -758,7 +766,7 @@ vbe_find_mode_xydm(int x, int y, int depth, int m) struct modeinfoblock mi; uint16_t *farptr; uint16_t mode; - int idx, nitems, i; + int idx, nentries, i; memset(vbe, 0, sizeof (*vbe)); if (biosvbe_info(vbe) != VBE_SUCCESS) @@ -771,9 +779,9 @@ vbe_find_mode_xydm(int x, int y, int depth, int m) else i = depth; - nitems = vbe_mode_list_size / sizeof(*vbe_mode_list); + nentries = vbe_mode_list_size / sizeof(*vbe_mode_list); while (i > 0) { - for (idx = 0; idx < nitems; idx++) { + for (idx = 0; idx < nentries; idx++) { mode = vbe_mode_list[idx]; if (mode == 0xffff) break; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 20:16:48 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0139A4DE30D; Tue, 19 Jan 2021 20:16:48 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL0L76grmz4f6w; Tue, 19 Jan 2021 20:16:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8A084A4A; Tue, 19 Jan 2021 20:16:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JKGlmM073836; Tue, 19 Jan 2021 20:16:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JKGlOa073835; Tue, 19 Jan 2021 20:16:47 GMT (envelope-from git) Date: Tue, 19 Jan 2021 20:16:47 GMT Message-Id: <202101192016.10JKGlOa073835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 4bbfe4bf08d6 - main - loader: comment on rgb_to_color_index() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4bbfe4bf08d6d16ae65729bb22159c8dbd1027bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 20:16:48 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=4bbfe4bf08d6d16ae65729bb22159c8dbd1027bd commit 4bbfe4bf08d6d16ae65729bb22159c8dbd1027bd Author: Toomas Soome AuthorDate: 2021-01-13 16:38:08 +0000 Commit: Toomas Soome CommitDate: 2021-01-19 20:15:26 +0000 loader: comment on rgb_to_color_index() Add small comment block about rgb_to_color_index(). --- stand/common/gfx_fb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index d98e6d1bae4b..08c0f59505f2 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -303,7 +303,13 @@ gfx_fb_color_map(uint8_t index) return (rgb_color_map(index, rmask, 16, gmask, 8, bmask, 0)); } -/* Get indexed color */ +/* + * Get indexed color from RGB. This function is used to write data to video + * memory when the adapter is set to use indexed colors. + * Since UEFI does only support 32-bit colors, we do not implement it for + * UEFI because there is no need for it and we do not have palette array + * for UEFI. + */ static uint8_t rgb_to_color_index(uint8_t r, uint8_t g, uint8_t b) { @@ -321,8 +327,10 @@ rgb_to_color_index(uint8_t r, uint8_t g, uint8_t b) diff = b - pe8[k].Blue; dist += diff * diff; + /* Exact match, exit the loop */ if (dist == 0) break; + if (dist < best) { color = k; best = dist; From owner-dev-commits-src-main@freebsd.org Tue Jan 19 20:46:44 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B71684DEDA6; Tue, 19 Jan 2021 20:46:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 4DL10g4rC3z4gdd; Tue, 19 Jan 2021 20:46:43 +0000 (UTC) (envelope-from avg@FreeBSD.org) X-Originating-IP: 195.64.148.76 Received: from [192.168.0.24] (unknown [195.64.148.76]) (Authenticated sender: andriy.gapon@uabsd.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id A1DE760002; Tue, 19 Jan 2021 20:46:40 +0000 (UTC) Subject: Re: git: 248f0cabca75 - main - make maximum interrupt number tunable on ARM, ARM64, MIPS, and RISC-V To: meloun.michal@gmail.com, John Baldwin , Jessica Clarke , Oleksandr Tymoshenko Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202101190036.10J0aj3O033256@gitrepo.freebsd.org> <8FE79D0F-602A-4C98-893A-806E72ED991B@freebsd.org> <80a3722c-16d1-0e8e-b6e1-4bdcfb554aa4@gmail.com> From: Andriy Gapon Message-ID: Date: Tue, 19 Jan 2021 22:46:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <80a3722c-16d1-0e8e-b6e1-4bdcfb554aa4@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4DL10g4rC3z4gdd X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; TAGGED_RCPT(0.00)[]; ASN(0.00)[asn:29169, ipnet:217.70.176.0/20, country:FR] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 20:46:44 -0000 On 2021-01-19 21:42, Michal Meloun wrote: > > > On 19.01.2021 19:41, John Baldwin wrote: >> On 1/19/21 8:43 AM, Jessica Clarke wrote: >>> On 19 Jan 2021, at 00:36, Oleksandr Tymoshenko >>> wrote: >>>> @@ -142,21 +143,15 @@ static bool irq_assign_cpu = false; >>>> #endif >>>> #endif >>>> >>>> -/* >>>> - * - 2 counters for each I/O interrupt. >>>> - * - MAXCPU counters for each IPI counters for SMP. >>>> - */ >>>> -#ifdef SMP >>>> -#define INTRCNT_COUNT   (NIRQ * 2 + INTR_IPI_COUNT * MAXCPU) >>>> -#else >>>> -#define INTRCNT_COUNT   (NIRQ * 2) >>>> -#endif >>>> +int intr_nirq = NIRQ; >>>> +SYSCTL_UINT(_machdep, OID_AUTO, nirq, CTLFLAG_RDTUN, &intr_nirq, 0, >>>> +    "Number of IRQs"); >>> >>> Unsigned integer, given the SYSCTL_UINT? >>> >>> What's stopping us from dynamically resizing rather than forcing the >>> user to use a tunable (which also means that, in practice, the limit >>> will remain unchanged, because you want GENERIC kernels to work out of >>> the box)? >> >> For x86 (and probably the same here), the biggest headache is that there >> is a dynamically allocated array indexed by IRQ value at interrupt >> invocation time.  Currently it uses no locks since the value of the >> pointer is set during boot time and then never changes.  Making it >> dynamic would require allowing that pointer to change and dealing with >> what that entails in a very hot path.  Generally speaking, the majority >> of interrupts used in a given system are allocated during boot and not >> by hotplug devices added post-boot, so there is also not a lot of utility >> in having this run-time tunable vs a boot-time tunable. >> > To be exact, the main headaches are  intrcnt and intrnames arrays and > their relationship to the sysctl interface. These fields are used > without locking, they do not have the ability to mark interrupt at given > index as unused. This is the real reason why we can't unload a driver > that acts as an interrupt controller (e.g. USB parallel port with the > possibility of interrupts on each pin). > Everything else in subr_intr.c should be prepared for dynamic > allocation/delete of interrupt sources. x86 does not use subr_intr / intrng though. I've been playing with an idea of using two-level interrupt "arrays" for things like interrupt counts and descriptiopns. That is, having fixed size chunks and a dynamically growing array of pointers to the chunks with a restriction that once a chunk is allocated it is never deallocated. So a pointer to an entry stored in such a chunk would remain stable. I also tried to use vmem(9) to keep track of allocated interrupts (interrupt sources) so that they could be dynamically created and removed. I think that it is a feasible idea, but I got lost in implementation details. -- Andriy Gapon From owner-dev-commits-src-main@freebsd.org Tue Jan 19 21:38:15 2021 Return-Path: Delivered-To: dev-commits-src-main@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 EC95C4E0891; Tue, 19 Jan 2021 21:38:15 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL28760dVz4lMh; Tue, 19 Jan 2021 21:38:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0C935DE3; Tue, 19 Jan 2021 21:38:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JLcFxO078411; Tue, 19 Jan 2021 21:38:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JLcFIt078410; Tue, 19 Jan 2021 21:38:15 GMT (envelope-from git) Date: Tue, 19 Jan 2021 21:38:15 GMT Message-Id: <202101192138.10JLcFIt078410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: bc596e563245 - main - libalias: Fix -Wcast-align compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc596e563245d838a27e3c7aaf090caa49af1016 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 21:38:16 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=bc596e563245d838a27e3c7aaf090caa49af1016 commit bc596e563245d838a27e3c7aaf090caa49af1016 Author: Alex Richardson AuthorDate: 2021-01-19 11:32:32 +0000 Commit: Alex Richardson CommitDate: 2021-01-19 21:23:24 +0000 libalias: Fix -Wcast-align compiler warnings This fixes -Wcast-align warnings caused by the underaligned `struct ip`. This also silences them in the public functions by changing the function signature from char * to void *. This is source and binary compatible and avoids the -Wcast-align warning. Reviewed By: ae, gbe (manpages) Differential Revision: https://reviews.freebsd.org/D27882 --- sys/netinet/libalias/alias.c | 102 ++++++++++++++++++------------------- sys/netinet/libalias/alias.h | 14 ++--- sys/netinet/libalias/alias_db.c | 4 +- sys/netinet/libalias/alias_local.h | 4 +- sys/netinet/libalias/alias_proxy.c | 2 +- sys/netinet/libalias/libalias.3 | 16 +++--- 6 files changed, 69 insertions(+), 73 deletions(-) diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c index 267bd2118222..8d5097943080 100644 --- a/sys/netinet/libalias/alias.c +++ b/sys/netinet/libalias/alias.c @@ -274,9 +274,9 @@ static int IcmpAliasOut2(struct libalias *, struct ip *); static int IcmpAliasOut(struct libalias *, struct ip *, int create); static int ProtoAliasIn(struct libalias *la, struct in_addr ip_src, - struct in_addr *ip_dst, u_char ip_p, u_short *ip_sum); -static int ProtoAliasOut(struct libalias *la, struct in_addr *ip_src, - struct in_addr ip_dst, u_char ip_p, u_short *ip_sum, + struct ip *pip, u_char ip_p, u_short *ip_sum); +static int ProtoAliasOut(struct libalias *la, struct ip *pip, + struct in_addr ip_dst, u_char ip_p, u_short *ip_sum, int create); static int UdpAliasIn(struct libalias *, struct ip *); @@ -655,8 +655,8 @@ IcmpAliasOut(struct libalias *la, struct ip *pip, int create) } static int -ProtoAliasIn(struct libalias *la, struct in_addr ip_src, - struct in_addr *ip_dst, u_char ip_p, u_short *ip_sum) +ProtoAliasIn(struct libalias *la, struct in_addr ip_src, + struct ip *pip, u_char ip_p, u_short *ip_sum) { /* Handle incoming IP packets. The @@ -671,7 +671,7 @@ ProtoAliasIn(struct libalias *la, struct in_addr ip_src, if (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY) return (PKT_ALIAS_OK); - lnk = FindProtoIn(la, ip_src, *ip_dst, ip_p); + lnk = FindProtoIn(la, ip_src, pip->ip_dst, ip_p); if (lnk != NULL) { struct in_addr original_address; @@ -679,8 +679,8 @@ ProtoAliasIn(struct libalias *la, struct in_addr ip_src, /* Restore original IP address */ DifferentialChecksum(ip_sum, - &original_address, ip_dst, 2); - *ip_dst = original_address; + &original_address, &pip->ip_dst, 2); + pip->ip_dst = original_address; return (PKT_ALIAS_OK); } @@ -688,7 +688,7 @@ ProtoAliasIn(struct libalias *la, struct in_addr ip_src, } static int -ProtoAliasOut(struct libalias *la, struct in_addr *ip_src, +ProtoAliasOut(struct libalias *la, struct ip *pip, struct in_addr ip_dst, u_char ip_p, u_short *ip_sum, int create) { /* @@ -707,7 +707,7 @@ ProtoAliasOut(struct libalias *la, struct in_addr *ip_src, if (!create) return (PKT_ALIAS_IGNORED); - lnk = FindProtoOut(la, *ip_src, ip_dst, ip_p); + lnk = FindProtoOut(la, pip->ip_src, ip_dst, ip_p); if (lnk != NULL) { struct in_addr alias_address; @@ -715,8 +715,8 @@ ProtoAliasOut(struct libalias *la, struct in_addr *ip_src, /* Change source address */ DifferentialChecksum(ip_sum, - &alias_address, ip_src, 2); - *ip_src = alias_address; + &alias_address, &pip->ip_src, 2); + pip->ip_src = alias_address; return (PKT_ALIAS_OK); } @@ -1185,26 +1185,26 @@ saved and recalled when a header fragment is seen. */ /* Local prototypes */ -static int FragmentIn(struct libalias *la, struct in_addr ip_src, - struct in_addr *ip_dst, u_short ip_id, u_short *ip_sum); -static int FragmentOut(struct libalias *, struct in_addr *ip_src, +static int FragmentIn(struct libalias *la, struct in_addr ip_src, + struct ip *pip, u_short ip_id, u_short *ip_sum); +static int FragmentOut(struct libalias *, struct ip *pip, u_short *ip_sum); static int -FragmentIn(struct libalias *la, struct in_addr ip_src, struct in_addr *ip_dst, +FragmentIn(struct libalias *la, struct in_addr ip_src, struct ip *pip, u_short ip_id, u_short *ip_sum) { struct alias_link *lnk; LIBALIAS_LOCK_ASSERT(la); - lnk = FindFragmentIn2(la, ip_src, *ip_dst, ip_id); + lnk = FindFragmentIn2(la, ip_src, pip->ip_dst, ip_id); if (lnk != NULL) { struct in_addr original_address; GetFragmentAddr(lnk, &original_address); DifferentialChecksum(ip_sum, - &original_address, ip_dst, 2); - *ip_dst = original_address; + &original_address, &pip->ip_dst, 2); + pip->ip_dst = original_address; return (PKT_ALIAS_OK); } @@ -1212,15 +1212,15 @@ FragmentIn(struct libalias *la, struct in_addr ip_src, struct in_addr *ip_dst, } static int -FragmentOut(struct libalias *la, struct in_addr *ip_src, u_short *ip_sum) +FragmentOut(struct libalias *la, struct ip *pip, u_short *ip_sum) { struct in_addr alias_address; LIBALIAS_LOCK_ASSERT(la); - alias_address = FindAliasAddress(la, *ip_src); + alias_address = FindAliasAddress(la, pip->ip_src); DifferentialChecksum(ip_sum, - &alias_address, ip_src, 2); - *ip_src = alias_address; + &alias_address, &pip->ip_src, 2); + pip->ip_src = alias_address; return (PKT_ALIAS_OK); } @@ -1238,7 +1238,7 @@ FragmentOut(struct libalias *la, struct in_addr *ip_src, u_short *ip_sum) */ int -LibAliasSaveFragment(struct libalias *la, char *ptr) +LibAliasSaveFragment(struct libalias *la, void *ptr) { int iresult; struct alias_link *lnk; @@ -1256,11 +1256,11 @@ LibAliasSaveFragment(struct libalias *la, char *ptr) return (iresult); } -char * -LibAliasGetFragment(struct libalias *la, char *ptr) +void * +LibAliasGetFragment(struct libalias *la, void *ptr) { struct alias_link *lnk; - char *fptr; + void *fptr; struct ip *pip; LIBALIAS_LOCK(la); @@ -1278,10 +1278,10 @@ LibAliasGetFragment(struct libalias *la, char *ptr) } void -LibAliasFragmentIn(struct libalias *la, char *ptr, /* Points to correctly +LibAliasFragmentIn(struct libalias *la, void *ptr, /* Points to correctly * de-aliased header * fragment */ - char *ptr_fragment /* Points to fragment which must be + void *ptr_fragment /* Points to fragment which must be * de-aliased */ ) { @@ -1301,39 +1301,37 @@ LibAliasFragmentIn(struct libalias *la, char *ptr, /* Points to correctly /* Local prototypes */ static int -LibAliasOutLocked(struct libalias *la, char *ptr, +LibAliasOutLocked(struct libalias *la, struct ip *pip, int maxpacketsize, int create); static int -LibAliasInLocked(struct libalias *la, char *ptr, +LibAliasInLocked(struct libalias *la, struct ip *pip, int maxpacketsize); int -LibAliasIn(struct libalias *la, char *ptr, int maxpacketsize) +LibAliasIn(struct libalias *la, void *ptr, int maxpacketsize) { int res; LIBALIAS_LOCK(la); - res = LibAliasInLocked(la, ptr, maxpacketsize); + res = LibAliasInLocked(la, (struct ip *)ptr, maxpacketsize); LIBALIAS_UNLOCK(la); return (res); } static int -LibAliasInLocked(struct libalias *la, char *ptr, int maxpacketsize) +LibAliasInLocked(struct libalias *la, struct ip *pip, int maxpacketsize) { struct in_addr alias_addr; - struct ip *pip; int iresult; if (la->packetAliasMode & PKT_ALIAS_REVERSE) { la->packetAliasMode &= ~PKT_ALIAS_REVERSE; - iresult = LibAliasOutLocked(la, ptr, maxpacketsize, 1); + iresult = LibAliasOutLocked(la, pip, maxpacketsize, 1); la->packetAliasMode |= PKT_ALIAS_REVERSE; goto getout; } HouseKeeping(la); ClearCheckNewLink(la); - pip = (struct ip *)ptr; alias_addr = pip->ip_dst; /* Defense against mangled packets */ @@ -1377,12 +1375,12 @@ LibAliasInLocked(struct libalias *la, char *ptr, int maxpacketsize) if (error == 0) iresult = PKT_ALIAS_OK; else - iresult = ProtoAliasIn(la, pip->ip_src, - &pip->ip_dst, pip->ip_p, &pip->ip_sum); + iresult = ProtoAliasIn(la, pip->ip_src, + pip, pip->ip_p, &pip->ip_sum); } break; default: - iresult = ProtoAliasIn(la, pip->ip_src, &pip->ip_dst, + iresult = ProtoAliasIn(la, pip->ip_src, pip, pip->ip_p, &pip->ip_sum); break; } @@ -1399,7 +1397,7 @@ LibAliasInLocked(struct libalias *la, char *ptr, int maxpacketsize) } } } else { - iresult = FragmentIn(la, pip->ip_src, &pip->ip_dst, pip->ip_id, + iresult = FragmentIn(la, pip->ip_src, pip, pip->ip_id, &pip->ip_sum); } @@ -1426,29 +1424,29 @@ getout: #define UNREG_ADDR_CGN_UPPER 0x647fffff int -LibAliasOut(struct libalias *la, char *ptr, int maxpacketsize) +LibAliasOut(struct libalias *la, void *ptr, int maxpacketsize) { int res; LIBALIAS_LOCK(la); - res = LibAliasOutLocked(la, ptr, maxpacketsize, 1); + res = LibAliasOutLocked(la, (struct ip *)ptr, maxpacketsize, 1); LIBALIAS_UNLOCK(la); return (res); } int -LibAliasOutTry(struct libalias *la, char *ptr, int maxpacketsize, int create) +LibAliasOutTry(struct libalias *la, void *ptr, int maxpacketsize, int create) { int res; LIBALIAS_LOCK(la); - res = LibAliasOutLocked(la, ptr, maxpacketsize, create); + res = LibAliasOutLocked(la, (struct ip *)ptr, maxpacketsize, create); LIBALIAS_UNLOCK(la); return (res); } static int -LibAliasOutLocked(struct libalias *la, char *ptr, /* valid IP packet */ +LibAliasOutLocked(struct libalias *la, struct ip *pip, /* valid IP packet */ int maxpacketsize, /* How much the packet data may grow (FTP * and IRC inline changes) */ int create /* Create new entries ? */ @@ -1456,17 +1454,15 @@ LibAliasOutLocked(struct libalias *la, char *ptr, /* valid IP packet */ { int iresult; struct in_addr addr_save; - struct ip *pip; if (la->packetAliasMode & PKT_ALIAS_REVERSE) { la->packetAliasMode &= ~PKT_ALIAS_REVERSE; - iresult = LibAliasInLocked(la, ptr, maxpacketsize); + iresult = LibAliasInLocked(la, pip, maxpacketsize); la->packetAliasMode |= PKT_ALIAS_REVERSE; goto getout; } HouseKeeping(la); ClearCheckNewLink(la); - pip = (struct ip *)ptr; /* Defense against mangled packets */ if (ntohs(pip->ip_len) > maxpacketsize @@ -1532,17 +1528,17 @@ LibAliasOutLocked(struct libalias *la, char *ptr, /* valid IP packet */ if (error == 0) iresult = PKT_ALIAS_OK; else - iresult = ProtoAliasOut(la, &pip->ip_src, + iresult = ProtoAliasOut(la, pip, pip->ip_dst, pip->ip_p, &pip->ip_sum, create); } break; default: - iresult = ProtoAliasOut(la, &pip->ip_src, + iresult = ProtoAliasOut(la, pip, pip->ip_dst, pip->ip_p, &pip->ip_sum, create); break; } } else { - iresult = FragmentOut(la, &pip->ip_src, &pip->ip_sum); + iresult = FragmentOut(la, pip, &pip->ip_sum); } SetDefaultAliasAddress(la, addr_save); @@ -1551,7 +1547,7 @@ getout: } int -LibAliasUnaliasOut(struct libalias *la, char *ptr, /* valid IP packet */ +LibAliasUnaliasOut(struct libalias *la, void *ptr, /* valid IP packet */ int maxpacketsize /* for error checking */ ) { diff --git a/sys/netinet/libalias/alias.h b/sys/netinet/libalias/alias.h index a9935f7aa812..671241212799 100644 --- a/sys/netinet/libalias/alias.h +++ b/sys/netinet/libalias/alias.h @@ -93,10 +93,10 @@ unsigned int void LibAliasUninit(struct libalias *); /* Packet Handling functions. */ -int LibAliasIn (struct libalias *, char *_ptr, int _maxpacketsize); -int LibAliasOut(struct libalias *, char *_ptr, int _maxpacketsize); -int LibAliasOutTry(struct libalias *, char *_ptr, int _maxpacketsize, int _create); -int LibAliasUnaliasOut(struct libalias *, char *_ptr, int _maxpacketsize); +int LibAliasIn (struct libalias *, void *_ptr, int _maxpacketsize); +int LibAliasOut(struct libalias *, void *_ptr, int _maxpacketsize); +int LibAliasOutTry(struct libalias *, void *_ptr, int _maxpacketsize, int _create); +int LibAliasUnaliasOut(struct libalias *, void *_ptr, int _maxpacketsize); /* Port and address redirection functions. */ @@ -119,9 +119,9 @@ LibAliasRedirectProto(struct libalias *, struct in_addr _src_addr, unsigned char _proto); /* Fragment Handling functions. */ -void LibAliasFragmentIn(struct libalias *, char *_ptr, char *_ptr_fragment); -char *LibAliasGetFragment(struct libalias *, char *_ptr); -int LibAliasSaveFragment(struct libalias *, char *_ptr); +void LibAliasFragmentIn(struct libalias *, void *_ptr, void *_ptr_fragment); +void *LibAliasGetFragment(struct libalias *, void *_ptr); +int LibAliasSaveFragment(struct libalias *, void *_ptr); /* Miscellaneous functions. */ int LibAliasCheckNewLink(struct libalias *); diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index e05cc3da948f..8da9a7fe683a 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1742,13 +1742,13 @@ GetFragmentAddr(struct alias_link *lnk, struct in_addr *src_addr) } void -SetFragmentPtr(struct alias_link *lnk, char *fptr) +SetFragmentPtr(struct alias_link *lnk, void *fptr) { lnk->data.frag_ptr = fptr; } void -GetFragmentPtr(struct alias_link *lnk, char **fptr) +GetFragmentPtr(struct alias_link *lnk, void **fptr) { *fptr = lnk->data.frag_ptr; } diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index ff6c16f7d9eb..5919851a4019 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -322,8 +322,8 @@ FindNewPortGroup(struct libalias *la, struct in_addr _dst_addr, struct in_addr _ u_char _proto, u_char _align); void GetFragmentAddr(struct alias_link *_lnk, struct in_addr *_src_addr); void SetFragmentAddr(struct alias_link *_lnk, struct in_addr _src_addr); -void GetFragmentPtr(struct alias_link *_lnk, char **_fptr); -void SetFragmentPtr(struct alias_link *_lnk, char *fptr); +void GetFragmentPtr(struct alias_link *_lnk, void **_fptr); +void SetFragmentPtr(struct alias_link *_lnk, void *fptr); void SetStateIn(struct alias_link *_lnk, int _state); void SetStateOut(struct alias_link *_lnk, int _state); int GetStateIn (struct alias_link *_lnk); diff --git a/sys/netinet/libalias/alias_proxy.c b/sys/netinet/libalias/alias_proxy.c index fc8e148d62d0..79d9db82914c 100644 --- a/sys/netinet/libalias/alias_proxy.c +++ b/sys/netinet/libalias/alias_proxy.c @@ -382,7 +382,7 @@ ProxyEncodeIpHeader(struct ip *pip, #define OPTION_LEN_BYTES 8 #define OPTION_LEN_INT16 4 #define OPTION_LEN_INT32 2 - u_char option[OPTION_LEN_BYTES]; + _Alignas(_Alignof(u_short)) u_char option[OPTION_LEN_BYTES]; #ifdef LIBALIAS_DEBUG fprintf(stdout, " ip cksum 1 = %x\n", (u_int) IpChecksum(pip)); diff --git a/sys/netinet/libalias/libalias.3 b/sys/netinet/libalias/libalias.3 index c323edf4c499..beef2ff7fca5 100644 --- a/sys/netinet/libalias/libalias.3 +++ b/sys/netinet/libalias/libalias.3 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 25, 2013 +.Dd January 1, 2020 .Dt LIBALIAS 3 .Os .Sh NAME @@ -311,7 +311,7 @@ comprise the minimal set of functions needed for a basic IP masquerading implementation. .Pp .Ft int -.Fn LibAliasIn "struct libalias *" "char *buffer" "int maxpacketsize" +.Fn LibAliasIn "struct libalias *" "void *buffer" "int maxpacketsize" .Bd -ragged -offset indent An incoming packet coming from a remote machine to the local network is de-aliased by this function. @@ -352,7 +352,7 @@ An internal error within the packet aliasing engine occurred. .Ed .Pp .Ft int -.Fn LibAliasOut "struct libalias *" "char *buffer" "int maxpacketsize" +.Fn LibAliasOut "struct libalias *" "void *buffer" "int maxpacketsize" .Bd -ragged -offset indent An outgoing packet coming from the local network to a remote machine is aliased by this function. @@ -770,7 +770,7 @@ Fragments which arrive before the header are saved and then retrieved once the header fragment has been resolved. .Pp .Ft int -.Fn LibAliasSaveFragment "struct libalias *" "char *ptr" +.Fn LibAliasSaveFragment "struct libalias *" "void *ptr" .Bd -ragged -offset indent When .Fn LibAliasIn @@ -794,8 +794,8 @@ if it was successful and if there was an error. .Ed .Pp -.Ft char * -.Fn LibAliasGetFragment "struct libalias *" "char *buffer" +.Ft void * +.Fn LibAliasGetFragment "struct libalias *" "void *buffer" .Bd -ragged -offset indent This function can be used to retrieve fragment pointers saved by .Fn LibAliasSaveFragment . @@ -816,7 +816,7 @@ available, at which time it returns .Ed .Pp .Ft void -.Fn LibAliasFragmentIn "struct libalias *" "char *header" "char *fragment" +.Fn LibAliasFragmentIn "struct libalias *" "void *header" "void *fragment" .Bd -ragged -offset indent When a fragment is retrieved with .Fn LibAliasGetFragment , @@ -896,7 +896,7 @@ will return zero. .Ed .Pp .Ft int -.Fn LibAliasUnaliasOut "struct libalias *" "char *buffer" "int maxpacketsize" +.Fn LibAliasUnaliasOut "struct libalias *" "void *buffer" "int maxpacketsize" .Bd -ragged -offset indent An outgoing packet, which has already been aliased, has its private address/port information restored by this function. From owner-dev-commits-src-main@freebsd.org Tue Jan 19 21:38:18 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6B9154E06A0; Tue, 19 Jan 2021 21:38:18 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL28B1RfYz4lDN; Tue, 19 Jan 2021 21:38:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 15CA057FF; Tue, 19 Jan 2021 21:38:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JLcI1K078452; Tue, 19 Jan 2021 21:38:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JLcHIQ078451; Tue, 19 Jan 2021 21:38:17 GMT (envelope-from git) Date: Tue, 19 Jan 2021 21:38:17 GMT Message-Id: <202101192138.10JLcHIQ078451@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: a81c165bce14 - main - Require uint32_t alignment for ipfw_insn MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a81c165bce14257a5fee298214db181e3147ea19 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 21:38:18 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=a81c165bce14257a5fee298214db181e3147ea19 commit a81c165bce14257a5fee298214db181e3147ea19 Author: Alex Richardson AuthorDate: 2021-01-19 11:32:33 +0000 Commit: Alex Richardson CommitDate: 2021-01-19 21:23:25 +0000 Require uint32_t alignment for ipfw_insn There are many casts of this struct to uint32_t, so we also need to ensure that it is sufficiently aligned to safely perform this cast on architectures that don't allow unaligned accesses. This fixes lots of -Wcast-align warnings. Reviewed By: ae Differential Revision: https://reviews.freebsd.org/D27879 --- sys/netinet/ip_fw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/ip_fw.h b/sys/netinet/ip_fw.h index 57d2a4c607e8..f0531a67132d 100644 --- a/sys/netinet/ip_fw.h +++ b/sys/netinet/ip_fw.h @@ -339,7 +339,7 @@ enum ipfw_opcodes { /* arguments (4 byte each) */ * */ typedef struct _ipfw_insn { /* template for instructions */ - u_int8_t opcode; + _Alignas(_Alignof(u_int32_t)) u_int8_t opcode; u_int8_t len; /* number of 32-bit words */ #define F_NOT 0x80 #define F_OR 0x40 From owner-dev-commits-src-main@freebsd.org Tue Jan 19 21:38:17 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1B07A4E05B3; Tue, 19 Jan 2021 21:38:17 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL289091wz4lDJ; Tue, 19 Jan 2021 21:38:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E22AD5AE6; Tue, 19 Jan 2021 21:38:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JLcGVM078433; Tue, 19 Jan 2021 21:38:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JLcG8g078432; Tue, 19 Jan 2021 21:38:16 GMT (envelope-from git) Date: Tue, 19 Jan 2021 21:38:16 GMT Message-Id: <202101192138.10JLcG8g078432@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: be5972695f50 - main - libalias: Fix remaining compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be5972695f502ae92f675f35b543f6dc6aecb484 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 21:38:17 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=be5972695f502ae92f675f35b543f6dc6aecb484 commit be5972695f502ae92f675f35b543f6dc6aecb484 Author: Alex Richardson AuthorDate: 2021-01-19 11:32:32 +0000 Commit: Alex Richardson CommitDate: 2021-01-19 21:23:24 +0000 libalias: Fix remaining compiler warnings This fixes some sign-compare warnings and adds a missing static to a variable declaration. Differential Revision: https://reviews.freebsd.org/D27883 --- sys/netinet/libalias/alias.c | 15 +++++++++------ sys/netinet/libalias/alias_mod.c | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c index 8d5097943080..900731fcbec6 100644 --- a/sys/netinet/libalias/alias.c +++ b/sys/netinet/libalias/alias.c @@ -435,7 +435,8 @@ static int IcmpAliasIn(struct libalias *la, struct ip *pip) { struct icmp *ic; - int dlen, iresult; + int iresult; + size_t dlen; LIBALIAS_LOCK_ASSERT(la); @@ -462,7 +463,7 @@ IcmpAliasIn(struct libalias *la, struct ip *pip) case ICMP_TIMXCEED: case ICMP_PARAMPROB: if (dlen < ICMP_ADVLENMIN || - dlen < ICMP_ADVLEN(ic)) + dlen < (size_t)ICMP_ADVLEN(ic)) return (PKT_ALIAS_IGNORED); iresult = IcmpAliasIn2(la, pip); break; @@ -728,7 +729,7 @@ UdpAliasIn(struct libalias *la, struct ip *pip) { struct udphdr *ud; struct alias_link *lnk; - int dlen; + size_t dlen; LIBALIAS_LOCK_ASSERT(la); @@ -827,7 +828,8 @@ UdpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) u_short dest_port; u_short proxy_server_port; int proxy_type; - int dlen, error; + int error; + size_t dlen; LIBALIAS_LOCK_ASSERT(la); @@ -930,7 +932,7 @@ TcpAliasIn(struct libalias *la, struct ip *pip) { struct tcphdr *tc; struct alias_link *lnk; - int dlen; + size_t dlen; LIBALIAS_LOCK_ASSERT(la); @@ -1055,9 +1057,10 @@ TcpAliasIn(struct libalias *la, struct ip *pip) static int TcpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) { - int dlen, proxy_type, error; + int proxy_type, error; u_short dest_port; u_short proxy_server_port; + size_t dlen; struct in_addr dest_address; struct in_addr proxy_server_address; struct tcphdr *tc; diff --git a/sys/netinet/libalias/alias_mod.c b/sys/netinet/libalias/alias_mod.c index 8f1071ebc79e..835d76cf5152 100644 --- a/sys/netinet/libalias/alias_mod.c +++ b/sys/netinet/libalias/alias_mod.c @@ -129,7 +129,7 @@ first_handler(void) #ifndef _KERNEL /* Dll manipulation code - this code is not thread safe... */ -SLIST_HEAD(dll_chain, dll) dll_chain = SLIST_HEAD_INITIALIZER(dll_chain); +static SLIST_HEAD(dll_chain, dll) dll_chain = SLIST_HEAD_INITIALIZER(dll_chain); int attach_dll(struct dll *p) { From owner-dev-commits-src-main@freebsd.org Tue Jan 19 21:38:21 2021 Return-Path: Delivered-To: dev-commits-src-main@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 00BD94E04FD; Tue, 19 Jan 2021 21:38:20 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL28C4jySz4lbL; Tue, 19 Jan 2021 21:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F07C5C4E; Tue, 19 Jan 2021 21:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JLcJwp078474; Tue, 19 Jan 2021 21:38:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JLcJPZ078473; Tue, 19 Jan 2021 21:38:19 GMT (envelope-from git) Date: Tue, 19 Jan 2021 21:38:19 GMT Message-Id: <202101192138.10JLcJPZ078473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 8d30571d454d - main - include: Delete stale symlinks using find(1) instead of a shell loop. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d30571d454daa5d3ecee54847f805384f09c31d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 21:38:22 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=8d30571d454daa5d3ecee54847f805384f09c31d commit 8d30571d454daa5d3ecee54847f805384f09c31d Author: Alex Richardson AuthorDate: 2021-01-19 11:35:12 +0000 Commit: Alex Richardson CommitDate: 2021-01-19 21:23:25 +0000 include: Delete stale symlinks using find(1) instead of a shell loop. This reduces the number of execve() syscalls during make includes by 88. Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D27622 --- include/Makefile | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/include/Makefile b/include/Makefile index 4533dfea1b67..24762ea641f2 100644 --- a/include/Makefile +++ b/include/Makefile @@ -273,26 +273,19 @@ stage_includes: ${SHARED} SDESTDIR= ${SYSROOT:U${DESTDIR}} # Take care of stale directory-level symlinks. +# Note: The "|| true" after find is needed in case one of the directories does +# not exist (yet). compat: -.for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto - if [ -L ${SDESTDIR}${INCLUDEDIR}/$i ]; then \ - rm -f ${SDESTDIR}${INCLUDEDIR}/$i; \ - fi -.endfor + cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ + crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ -f ${SRCTOP}/etc/mtree/BSD.include.dist \ -p ${SDESTDIR}${INCLUDEDIR} > /dev/null copies: .PHONY .META -.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto machine machine/pc \ - ${_MARCHS} - if [ -d ${SDESTDIR}${INCLUDEDIR}/$i ]; then \ - cd ${SDESTDIR}${INCLUDEDIR}/$i; \ - for h in *.h; do \ - if [ -L $$h ]; then rm -f $$h; fi; \ - done; \ - fi -.endfor + cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ + machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ + -name "*.h" -print -delete || true .for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ From owner-dev-commits-src-main@freebsd.org Tue Jan 19 21:38:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E96084E06B8; Tue, 19 Jan 2021 21:38:21 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL28F4pgrz4lQd; Tue, 19 Jan 2021 21:38:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 641F05CA4; Tue, 19 Jan 2021 21:38:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JLcKZ8078496; Tue, 19 Jan 2021 21:38:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JLcK0d078493; Tue, 19 Jan 2021 21:38:20 GMT (envelope-from git) Date: Tue, 19 Jan 2021 21:38:20 GMT Message-Id: <202101192138.10JLcK0d078493@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 74eb7f97ecd6 - main - Fix make includes path to nvpair.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74eb7f97ecd62d0a7e056e4c2fd696f2c267e3a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 21:38:22 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=74eb7f97ecd62d0a7e056e4c2fd696f2c267e3a5 commit 74eb7f97ecd62d0a7e056e4c2fd696f2c267e3a5 Author: Alex Richardson AuthorDate: 2021-01-19 11:40:05 +0000 Commit: Alex Richardson CommitDate: 2021-01-19 21:23:25 +0000 Fix make includes path to nvpair.h Fixes a typo introduced in 9e5787d2284e187abb5b654d924394a65772e004 --- include/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Makefile b/include/Makefile index 24762ea641f2..b6eb63e5ef15 100644 --- a/include/Makefile +++ b/include/Makefile @@ -397,7 +397,7 @@ symlinks: .PHONY .META cd ${SRCTOP}/sys/rpc; .if ${MK_CDDL} != "no" ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - ../../../sys/contrib/openenzfs/include/sys/nvpair.h \ + ../../../sys/contrib/openzfs/include/sys/nvpair.h \ ${SDESTDIR}${INCLUDEDIR}/sys .endif .if ${MK_MLX5TOOL} != "no" From owner-dev-commits-src-main@freebsd.org Tue Jan 19 21:38:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BCB604E0894; Tue, 19 Jan 2021 21:38:22 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL28G3DfBz4lY6; Tue, 19 Jan 2021 21:38:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84FE45E09; Tue, 19 Jan 2021 21:38:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JLcL2d078514; Tue, 19 Jan 2021 21:38:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JLcLPW078513; Tue, 19 Jan 2021 21:38:21 GMT (envelope-from git) Date: Tue, 19 Jan 2021 21:38:21 GMT Message-Id: <202101192138.10JLcLPW078513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 0348c8fcfaa2 - main - getopt: Fix conversion from string-literal to non-const char * MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0348c8fcfaa22d4f2bf548ad9c187c09ef90c533 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 21:38:22 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=0348c8fcfaa22d4f2bf548ad9c187c09ef90c533 commit 0348c8fcfaa22d4f2bf548ad9c187c09ef90c533 Author: Alex Richardson AuthorDate: 2021-01-19 11:35:04 +0000 Commit: Alex Richardson CommitDate: 2021-01-19 21:23:25 +0000 getopt: Fix conversion from string-literal to non-const char * Define a non-const static char EMSG[] = "" to avoid having to add __DECONST() to all uses of EMSG. Also make current_dash a const char * to fix this warning. --- lib/libc/stdlib/getopt.c | 3 +-- lib/libc/stdlib/getopt_long.c | 4 ++-- tools/build/mk/Makefile.boot | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/stdlib/getopt.c b/lib/libc/stdlib/getopt.c index b6bdf8a1eeaf..b7f2229a2f54 100644 --- a/lib/libc/stdlib/getopt.c +++ b/lib/libc/stdlib/getopt.c @@ -54,8 +54,7 @@ char *optarg; /* argument associated with option */ #define BADCH (int)'?' #define BADARG (int)':' -#define EMSG "" - +static char EMSG[] = ""; /* * getopt -- * Parse argc/argv argument vector. diff --git a/lib/libc/stdlib/getopt_long.c b/lib/libc/stdlib/getopt_long.c index 4d92fd0cd45d..1f3548bef9ad 100644 --- a/lib/libc/stdlib/getopt_long.c +++ b/lib/libc/stdlib/getopt_long.c @@ -88,7 +88,7 @@ char *optarg; /* argument associated with option */ #define BADARG ((*options == ':') ? (int)':' : (int)'?') #define INORDER (int)1 -#define EMSG "" +static char EMSG[] = ""; #ifdef GNU_COMPATIBLE #define NO_PREFIX (-1) @@ -194,7 +194,7 @@ parse_long_options(char * const *nargv, const char *options, { char *current_argv, *has_equal; #ifdef GNU_COMPATIBLE - char *current_dash; + const char *current_dash; #endif size_t current_argv_len; int i, match, exact_match, second_partial_match; diff --git a/tools/build/mk/Makefile.boot b/tools/build/mk/Makefile.boot index 38df8135e53b..7ebbf726e7f2 100644 --- a/tools/build/mk/Makefile.boot +++ b/tools/build/mk/Makefile.boot @@ -41,6 +41,7 @@ CWARNFLAGS+= -Wno-typedef-redefinition # bsd.sys.mk explicitly turns on -Wsystem-headers, but that's extremely # noisy when building on Linux. CWARNFLAGS+= -Wno-system-headers +CWARNFLAGS.clang+=-Werror=incompatible-pointer-types-discards-qualifiers # b64_pton and b64_ntop is in libresolv on MacOS and Linux: # TODO: only needed for uuencode and uudecode From owner-dev-commits-src-main@freebsd.org Tue Jan 19 21:38:24 2021 Return-Path: Delivered-To: dev-commits-src-main@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 F17C74E0895; Tue, 19 Jan 2021 21:38:23 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL28H3FV3z4lN4; Tue, 19 Jan 2021 21:38:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BC5B5E0A; Tue, 19 Jan 2021 21:38:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JLcMkt078536; Tue, 19 Jan 2021 21:38:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JLcMg5078535; Tue, 19 Jan 2021 21:38:22 GMT (envelope-from git) Date: Tue, 19 Jan 2021 21:38:22 GMT Message-Id: <202101192138.10JLcMg5078535@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 7954ad9f22b3 - main - Fix macro-redefined warning in gnu/diff for fputc_unlocked MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7954ad9f22b3b453c4cea49dc663e7b17631a209 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 21:38:24 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7954ad9f22b3b453c4cea49dc663e7b17631a209 commit 7954ad9f22b3b453c4cea49dc663e7b17631a209 Author: Alex Richardson AuthorDate: 2021-01-19 11:35:15 +0000 Commit: Alex Richardson CommitDate: 2021-01-19 21:23:25 +0000 Fix macro-redefined warning in gnu/diff for fputc_unlocked While updating config.h to set HAVE_DECL_FPUTC_UNLOCKED to 1 also update the other macros that are defined in stdio.h. --- contrib/diff/config.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/diff/config.h b/contrib/diff/config.h index ce405203c2b2..1de273fded16 100644 --- a/contrib/diff/config.h +++ b/contrib/diff/config.h @@ -86,7 +86,7 @@ /* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if you don't. */ -#define HAVE_DECL_FFLUSH_UNLOCKED 0 +#define HAVE_DECL_FFLUSH_UNLOCKED 1 /* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if you don't. */ @@ -94,19 +94,19 @@ /* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if you don't. */ -#define HAVE_DECL_FPUTC_UNLOCKED 0 +#define HAVE_DECL_FPUTC_UNLOCKED 1 /* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if you don't. */ -#define HAVE_DECL_FPUTS_UNLOCKED 0 +#define HAVE_DECL_FPUTS_UNLOCKED 1 /* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if you don't. */ -#define HAVE_DECL_FREAD_UNLOCKED 0 +#define HAVE_DECL_FREAD_UNLOCKED 1 /* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if you don't. */ -#define HAVE_DECL_FWRITE_UNLOCKED 0 +#define HAVE_DECL_FWRITE_UNLOCKED 1 /* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if you don't. */ From owner-dev-commits-src-main@freebsd.org Tue Jan 19 21:38:59 2021 Return-Path: Delivered-To: dev-commits-src-main@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 41EFD4E0A10; Tue, 19 Jan 2021 21:38:58 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL28w4qLlz4lgT; Tue, 19 Jan 2021 21:38:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 697E95DE5; Tue, 19 Jan 2021 21:38:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JLcjOQ078725; Tue, 19 Jan 2021 21:38:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JLcj1E078724; Tue, 19 Jan 2021 21:38:45 GMT (envelope-from git) Date: Tue, 19 Jan 2021 21:38:45 GMT Message-Id: <202101192138.10JLcj1E078724@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: c1a3d7f20696 - main - Remove remaining uses of ${COMPILER_FEATURES:Mc++11} MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c1a3d7f20696ab5b72eee45863f3e04410d81fc8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 21:38:59 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c1a3d7f20696ab5b72eee45863f3e04410d81fc8 commit c1a3d7f20696ab5b72eee45863f3e04410d81fc8 Author: Alex Richardson AuthorDate: 2021-01-19 15:05:43 +0000 Commit: Alex Richardson CommitDate: 2021-01-19 21:37:36 +0000 Remove remaining uses of ${COMPILER_FEATURES:Mc++11} All supported compilers have C++11 support so these checks can be replaced with MK_CXX guards. See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252759 PR: 252759 Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D28234 --- lib/libc/tests/stdlib/Makefile | 2 -- lib/ofed/libibnetdisc/Makefile | 2 -- usr.bin/Makefile | 4 +--- usr.sbin/Makefile | 4 +--- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile index da152159f8a8..bd85efcb1b95 100644 --- a/lib/libc/tests/stdlib/Makefile +++ b/lib/libc/tests/stdlib/Makefile @@ -11,10 +11,8 @@ ATF_TESTS_C+= qsort_s_test ATF_TESTS_C+= set_constraint_handler_s_test ATF_TESTS_C+= strfmon_test ATF_TESTS_C+= tsearch_test -.if ${COMPILER_FEATURES:Mc++11} ATF_TESTS_CXX+= cxa_thread_atexit_test ATF_TESTS_CXX+= cxa_thread_atexit_nothr_test -.endif # All architectures on FreeBSD have fenv.h CFLAGS+= -D__HAVE_FENV diff --git a/lib/ofed/libibnetdisc/Makefile b/lib/ofed/libibnetdisc/Makefile index 0736ae93f12f..0c43685fa236 100644 --- a/lib/ofed/libibnetdisc/Makefile +++ b/lib/ofed/libibnetdisc/Makefile @@ -31,9 +31,7 @@ LIBADD= osmcomp ibmad ibumad CFLAGS+= -DHAVE_CONFIG_H=1 CFLAGS+= -I${_spath} CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/infiniband -.if ${COMPILER_FEATURES:Mc++11} CXXSTD= c++11 -.endif VERSION_MAP= ${_spath}/libibnetdisc.map .include diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 8ea3b1c2bfe3..c557d85b535c 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -212,9 +212,7 @@ SUBDIR.${MK_GAMES}+= number SUBDIR.${MK_GAMES}+= pom SUBDIR.${MK_GAMES}+= primes SUBDIR.${MK_GAMES}+= random -.if ${COMPILER_FEATURES:Mc++11} -SUBDIR+= dtc -.endif +SUBDIR.${MK_CXX}+= dtc .if ${MK_GH_BC} == "yes" SUBDIR+= gh-bc .else diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index bd2f0cbe0797..2e01b0fcf847 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -186,9 +186,7 @@ SUBDIR.${MK_NTP}+= ntp SUBDIR.${MK_OPENSSL}+= keyserv SUBDIR.${MK_PF}+= ftp-proxy SUBDIR.${MK_PKGBOOTSTRAP}+= pkg -.if ${COMPILER_FEATURES:Mc++11} -SUBDIR.${MK_PMC}+= pmc -.endif +SUBDIR.${MK_PMC}.${MK_CXX}+= pmc SUBDIR.${MK_PMC}+= pmcannotate pmccontrol pmcstat pmcstudy SUBDIR.${MK_PORTSNAP}+= portsnap SUBDIR.${MK_PPP}+= ppp From owner-dev-commits-src-main@freebsd.org Tue Jan 19 21:42:09 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E01114E1004 for ; Tue, 19 Jan 2021 21:42:09 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DL2Dd5tbxz4mfP for ; Tue, 19 Jan 2021 21:42:09 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f52.google.com with SMTP id c124so1084974wma.5 for ; Tue, 19 Jan 2021 13:42:09 -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:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=XFJdj+QBufKrZgBWDVIq9GmXPD3BNjrsDsPeGhy4W0s=; b=CdgcT2fce/q6cYIpeni7gvY3sAvD+c3ycqVbA7rBaQn5dblI5L7xvtvytZibtSW4ps lsvAbS242jC8tN/O9CG2Sya5QOqLCgYyU7XoixlecOLGJzVyVBU1jWnFj/moFC3rK0zs IdgEjPlLegm1k09PzvyDAIE0L6CC76Hw4+QnkBIt8nWF/cQerbiJ3QZsUyQplvo2r/zj S3IkFjqkGV981mrfI00B5xx8CwBmrofmV4SkLcLkWqBpLTK+YF+f5JxkNDk5T1sNcFAo XjTJJ3E8v4JYCw0gy9wCXMGgAH+EO64UufIY0Z8zHzzXyVTxuh8UvJjyz55Xw1qSccnH wOTg== X-Gm-Message-State: AOAM531wSSRJUH4ivWSF/sxm1KaLe7CjaBvdOIWToH1dS4Lk6I44dFsN xwuBD5kevev/i3IPQ/RzwYqd/g== X-Google-Smtp-Source: ABdhPJwiDy4hsh4B6CxsjJ9JcAj/uFVhBLXpp3gjzAiXZha4RuaPLqcfT51rGtiIdWdgsNkVeEAE1A== X-Received: by 2002:a1c:398b:: with SMTP id g133mr1363166wma.35.1611092527842; Tue, 19 Jan 2021 13:42:07 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id h5sm40208963wrp.56.2021.01.19.13.42.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jan 2021 13:42:07 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: c1a3d7f20696 - main - Remove remaining uses of ${COMPILER_FEATURES:Mc++11} From: Jessica Clarke In-Reply-To: <202101192138.10JLcj1E078724@gitrepo.freebsd.org> Date: Tue, 19 Jan 2021 21:42:06 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: 7bit Message-Id: <71483E38-0C2A-4A03-99A7-1438A691A975@freebsd.org> References: <202101192138.10JLcj1E078724@gitrepo.freebsd.org> To: Alex Richardson X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DL2Dd5tbxz4mfP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 21:42:09 -0000 On 19 Jan 2021, at 21:38, Alex Richardson wrote: > diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile > index bd2f0cbe0797..2e01b0fcf847 100644 > --- a/usr.sbin/Makefile > +++ b/usr.sbin/Makefile > @@ -186,9 +186,7 @@ SUBDIR.${MK_NTP}+= ntp > SUBDIR.${MK_OPENSSL}+= keyserv > SUBDIR.${MK_PF}+= ftp-proxy > SUBDIR.${MK_PKGBOOTSTRAP}+= pkg > -.if ${COMPILER_FEATURES:Mc++11} > -SUBDIR.${MK_PMC}+= pmc > -.endif > +SUBDIR.${MK_PMC}.${MK_CXX}+= pmc src.opts.mk already disables MK_PMC is MK_CXX is no. Jess. From owner-dev-commits-src-main@freebsd.org Tue Jan 19 22:12:42 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BABE54E1808; Tue, 19 Jan 2021 22:12:42 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DL2vt4kkvz4nmn; Tue, 19 Jan 2021 22:12:42 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ej1-f43.google.com with SMTP id rv9so11964034ejb.13; Tue, 19 Jan 2021 14:12: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=eKFMosnM7TxYEIy/X2+oL5KLUYQq1cSo/ee8w+NHorc=; b=lI43SFuAq062JqdNUigg5ITGynfyRjSbgU+jCuUC8MdwOTIzgYNh2KInptTFBjgJKi LZcRPqjFJftfWp2fV9O2UDI1trw9+jnuCwQsaPlLCGgj+uf1wMQvp0hdfrG8aHw7l3YR adLAv52pcAJjRwBVjEKw2eD2DA3qAkvFzGscTwOAdEcufzf9sIajQqeDrD2rSttwvxAo 8cWAFfFaQ6V9pZFDyuWOtIdb+3MvFrg2ZV0cIIw4uGq3EiHPEnTY+QRcdjydiwp6tG+N IsJlXNERWIWrgrtB5shYIllDvQ0YGKm5Fi99NswXLEtewmf1tbGaLJn+UmEQuM/XGTkk iJeA== X-Gm-Message-State: AOAM5321+9KBm9GI5+84WbZKtjw6wdyAnXIlKfKQ4JyFs8JwLSJIaVjV cuqXRWdwV2XjIx/k0Eh9mQTyGwEEqr4= X-Google-Smtp-Source: ABdhPJykyZthvi1zXYL2X5fBCPx7/ukDpVHxYC4K9xUbJtdTBX/Xbv2SZO3TIuSpDeO0UKNh7ea/vg== X-Received: by 2002:a17:907:961c:: with SMTP id gb28mr4119481ejc.393.1611094360445; Tue, 19 Jan 2021 14:12:40 -0800 (PST) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com. [209.85.128.50]) by smtp.gmail.com with ESMTPSA id di28sm74515edb.71.2021.01.19.14.12.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Jan 2021 14:12:40 -0800 (PST) Received: by mail-wm1-f50.google.com with SMTP id m2so1166083wmm.1; Tue, 19 Jan 2021 14:12:40 -0800 (PST) X-Received: by 2002:a7b:cb8a:: with SMTP id m10mr1427193wmi.127.1611094359970; Tue, 19 Jan 2021 14:12:39 -0800 (PST) MIME-Version: 1.0 References: <202101192138.10JLcj1E078724@gitrepo.freebsd.org> <71483E38-0C2A-4A03-99A7-1438A691A975@freebsd.org> In-Reply-To: <71483E38-0C2A-4A03-99A7-1438A691A975@freebsd.org> From: Alexander Richardson Date: Tue, 19 Jan 2021 22:12:29 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: c1a3d7f20696 - main - Remove remaining uses of ${COMPILER_FEATURES:Mc++11} To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DL2vt4kkvz4nmn X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 22:12:42 -0000 On Tue, 19 Jan 2021 at 21:42, Jessica Clarke wrote: > > On 19 Jan 2021, at 21:38, Alex Richardson wrote: > > diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile > > index bd2f0cbe0797..2e01b0fcf847 100644 > > --- a/usr.sbin/Makefile > > +++ b/usr.sbin/Makefile > > @@ -186,9 +186,7 @@ SUBDIR.${MK_NTP}+= ntp > > SUBDIR.${MK_OPENSSL}+= keyserv > > SUBDIR.${MK_PF}+= ftp-proxy > > SUBDIR.${MK_PKGBOOTSTRAP}+= pkg > > -.if ${COMPILER_FEATURES:Mc++11} > > -SUBDIR.${MK_PMC}+= pmc > > -.endif > > +SUBDIR.${MK_PMC}.${MK_CXX}+= pmc > > src.opts.mk already disables MK_PMC is MK_CXX is no. > > Jess. > Ah I didn't check src.opts. Will revert this part of the commit shortly. Thanks, Alex From owner-dev-commits-src-main@freebsd.org Tue Jan 19 22:24:28 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1F6244E1AEC; Tue, 19 Jan 2021 22:24:28 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL39S0RcZz4pQZ; Tue, 19 Jan 2021 22:24:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F190D67F3; Tue, 19 Jan 2021 22:24:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JMORv1042786; Tue, 19 Jan 2021 22:24:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JMORKp042785; Tue, 19 Jan 2021 22:24:27 GMT (envelope-from git) Date: Tue, 19 Jan 2021 22:24:27 GMT Message-Id: <202101192224.10JMORKp042785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John-Mark Gurney Subject: git: fd11270509f2 - main - add missing .Xr.. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jmg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd11270509f26e9ebde11ef7d3c3c34497f29124 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 22:24:28 -0000 The branch main has been updated by jmg: URL: https://cgit.FreeBSD.org/src/commit/?id=fd11270509f26e9ebde11ef7d3c3c34497f29124 commit fd11270509f26e9ebde11ef7d3c3c34497f29124 Author: John-Mark Gurney AuthorDate: 2021-01-19 22:18:55 +0000 Commit: John-Mark Gurney CommitDate: 2021-01-19 22:18:55 +0000 add missing .Xr.. --- share/man/man4/ktls.4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man4/ktls.4 b/share/man/man4/ktls.4 index f76083e93beb..9a8dccfb8afe 100644 --- a/share/man/man4/ktls.4 +++ b/share/man/man4/ktls.4 @@ -160,7 +160,7 @@ The control message contains a .Vt struct tls_get_record which includes fields from the TLS record header. If an invalid or corrupted TLS record is received, -recvmsg 2 +.Xr recvmsg 2 will fail with one of the following errors: .Bl -tag -width Er .It Bq Er EINVAL From owner-dev-commits-src-main@freebsd.org Tue Jan 19 22:26:19 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5B10E4E1B42; Tue, 19 Jan 2021 22:26:19 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL3Cb257fz4ptM; Tue, 19 Jan 2021 22:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3604C62DE; Tue, 19 Jan 2021 22:26:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10JMQJGM043183; Tue, 19 Jan 2021 22:26:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10JMQJQ9043182; Tue, 19 Jan 2021 22:26:19 GMT (envelope-from git) Date: Tue, 19 Jan 2021 22:26:19 GMT Message-Id: <202101192226.10JMQJQ9043182@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Watson Subject: git: adc96a51a553 - main - Add a new FreeBSD/arm64 kernel configuration, GENERIC-MMCCAM-NODEBUG, which is the same as GENERIC-MMCCAM but using a nodebug baseline. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rwatson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: adc96a51a5539a185898d71ebb22f17cbf61e039 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2021 22:26:19 -0000 The branch main has been updated by rwatson: URL: https://cgit.FreeBSD.org/src/commit/?id=adc96a51a5539a185898d71ebb22f17cbf61e039 commit adc96a51a5539a185898d71ebb22f17cbf61e039 Author: Robert Watson AuthorDate: 2021-01-16 12:42:26 +0000 Commit: Robert Watson CommitDate: 2021-01-19 22:26:20 +0000 Add a new FreeBSD/arm64 kernel configuration, GENERIC-MMCCAM-NODEBUG, which is the same as GENERIC-MMCCAM but using a nodebug baseline. Reviewed by: andrew, br (earlier version), jrtc27 (earlier version) Differential revision: https://reviews.freebsd.org/D28091 --- sys/arm64/conf/GENERIC-MMCCAM-NODEBUG | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/arm64/conf/GENERIC-MMCCAM-NODEBUG b/sys/arm64/conf/GENERIC-MMCCAM-NODEBUG new file mode 100644 index 000000000000..93360bea9bc0 --- /dev/null +++ b/sys/arm64/conf/GENERIC-MMCCAM-NODEBUG @@ -0,0 +1,13 @@ +# +# GENERIC-MMCCAM-NODEBUG +# +# Custom kernel for arm64 plus MMCCAM as opposed to the prior MMC stack. It is +# present to keep it building in tree since it wouldn't work in LINT. This +# version without debugging features. +# +# $FreeBSD$ + +include GENERIC-MMCCAP +include "../../conf/std.nodebug" + +ident GENERIC-MMCCAM-NODEBUG From owner-dev-commits-src-main@freebsd.org Wed Jan 20 01:36:11 2021 Return-Path: Delivered-To: dev-commits-src-main@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 506684E52BC; Wed, 20 Jan 2021 01:36:11 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL7Qg1s2Gz3FyB; Wed, 20 Jan 2021 01:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 328FF10CF8; Wed, 20 Jan 2021 01:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K1aBmg089649; Wed, 20 Jan 2021 01:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K1aB6A089648; Wed, 20 Jan 2021 01:36:11 GMT (envelope-from git) Date: Wed, 20 Jan 2021 01:36:11 GMT Message-Id: <202101200136.10K1aB6A089648@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: d1816248899a - main - opencrypto: Embed the driver softc in the session structure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d1816248899aca31db94b1a3d7a21d52f6b3ede6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 01:36:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d1816248899aca31db94b1a3d7a21d52f6b3ede6 commit d1816248899aca31db94b1a3d7a21d52f6b3ede6 Author: Mark Johnston AuthorDate: 2021-01-20 01:34:35 +0000 Commit: Mark Johnston CommitDate: 2021-01-20 01:34:35 +0000 opencrypto: Embed the driver softc in the session structure Store the driver softc below the fields owned by opencrypto. This is a bit simpler and saves a pointer dereference when fetching the driver softc when processing a request. Get rid of the crypto session UMA zone. Session allocations are frequent or performance-critical enough to warrant a dedicated zone. No functional change intended. Reviewed by: cem, jhb Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D28158 --- sys/opencrypto/crypto.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index cf02667e2a35..7bc230140568 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -134,7 +134,6 @@ static int crypto_drivers_size = 0; struct crypto_session { struct cryptocap *cap; - void *softc; struct crypto_session_params csp; }; @@ -201,7 +200,6 @@ SYSCTL_INT(_kern, OID_AUTO, crypto_workers_num, CTLFLAG_RDTUN, #endif static uma_zone_t cryptop_zone; -static uma_zone_t cryptoses_zone; int crypto_userasymcrypto = 1; SYSCTL_INT(_kern_crypto, OID_AUTO, asym_enable, CTLFLAG_RW, @@ -332,9 +330,6 @@ crypto_init(void) cryptop_zone = uma_zcreate("cryptop", sizeof(struct cryptop), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); - cryptoses_zone = uma_zcreate("crypto_session", - sizeof(struct crypto_session), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, UMA_ZONE_ZINIT); crypto_drivers_size = CRYPTO_DRIVERS_INITIAL; crypto_drivers = malloc(crypto_drivers_size * @@ -487,8 +482,6 @@ crypto_destroy(void) } free(crypto_drivers, M_CRYPTO_DATA); - if (cryptoses_zone != NULL) - uma_zdestroy(cryptoses_zone); if (cryptop_zone != NULL) uma_zdestroy(cryptop_zone); mtx_destroy(&crypto_q_mtx); @@ -515,7 +508,7 @@ crypto_ses2caps(crypto_session_t crypto_session) void * crypto_get_driver_session(crypto_session_t crypto_session) { - return (crypto_session->softc); + return (crypto_session + 1); } const struct crypto_session_params * @@ -895,8 +888,7 @@ crypto_deletesession(crypto_session_t cses) cap = cses->cap; - zfree(cses->softc, M_CRYPTO_DATA); - uma_zfree(cryptoses_zone, cses); + zfree(cses, M_CRYPTO_DATA); CRYPTO_DRIVER_LOCK(); cap->cc_sessions--; @@ -948,10 +940,9 @@ crypto_newsession(crypto_session_t *cses, cap->cc_sessions++; CRYPTO_DRIVER_UNLOCK(); - res = uma_zalloc(cryptoses_zone, M_WAITOK | M_ZERO); + res = malloc(sizeof(*res) + cap->cc_session_size, M_CRYPTO_DATA, + M_WAITOK | M_ZERO); res->cap = cap; - res->softc = malloc(cap->cc_session_size, M_CRYPTO_DATA, M_WAITOK | - M_ZERO); res->csp = *csp; /* Call the driver initialization routine. */ From owner-dev-commits-src-main@freebsd.org Wed Jan 20 01:36:12 2021 Return-Path: Delivered-To: dev-commits-src-main@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 70CFE4E5642; Wed, 20 Jan 2021 01:36:12 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL7Qh2qh1z3Fhv; Wed, 20 Jan 2021 01:36:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 540BE11076; Wed, 20 Jan 2021 01:36:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K1aCb2089670; Wed, 20 Jan 2021 01:36:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K1aCT9089669; Wed, 20 Jan 2021 01:36:12 GMT (envelope-from git) Date: Wed, 20 Jan 2021 01:36:12 GMT Message-Id: <202101200136.10K1aCT9089669@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 98d788c867b9 - main - opencrypto: Fix assignment of crypto completions to worker threads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 98d788c867b9e1d7a7e290254443b87ea77d8ab1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 01:36:12 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=98d788c867b9e1d7a7e290254443b87ea77d8ab1 commit 98d788c867b9e1d7a7e290254443b87ea77d8ab1 Author: Mark Johnston AuthorDate: 2021-01-20 01:34:35 +0000 Commit: Mark Johnston CommitDate: 2021-01-20 01:34:35 +0000 opencrypto: Fix assignment of crypto completions to worker threads Since r336439 we simply take the session pointer value mod the number of worker threads (ncpu by default). On small systems this ends up funneling all completion work through a single thread, which becomes a bottleneck when processing IPSec traffic using hardware crypto drivers. (Software drivers such as aesni(4) are unaffected since they invoke completion handlers synchonously.) Instead, maintain an incrementing counter with a unique value per session, and use that to distribute work to completion threads. Reviewed by: cem, jhb MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D28159 --- sys/opencrypto/crypto.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 7bc230140568..fc4169fb2365 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -135,6 +135,7 @@ static int crypto_drivers_size = 0; struct crypto_session { struct cryptocap *cap; struct crypto_session_params csp; + uint64_t id; }; /* @@ -908,6 +909,7 @@ int crypto_newsession(crypto_session_t *cses, const struct crypto_session_params *csp, int crid) { + static uint64_t sessid = 0; crypto_session_t res; struct cryptocap *cap; int err; @@ -944,6 +946,7 @@ crypto_newsession(crypto_session_t *cses, M_WAITOK | M_ZERO); res->cap = cap; res->csp = *csp; + res->id = atomic_fetchadd_64(&sessid, 1); /* Call the driver initialization routine. */ err = CRYPTODEV_NEWSESSION(cap->cc_dev, res, csp); @@ -1416,7 +1419,7 @@ crypto_dispatch(struct cryptop *crp) CRYPTOSTAT_INC(cs_ops); - crp->crp_retw_id = ((uintptr_t)crp->crp_session) % crypto_workers_num; + crp->crp_retw_id = crp->crp_session->id % crypto_workers_num; if (CRYPTOP_ASYNC(crp)) { if (crp->crp_flags & CRYPTO_F_ASYNC_KEEPORDER) { From owner-dev-commits-src-main@freebsd.org Wed Jan 20 01:36:13 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A2B0B4E4F68; Wed, 20 Jan 2021 01:36:13 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL7Qj3wZZz3FvB; Wed, 20 Jan 2021 01:36:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A4BD10C6D; Wed, 20 Jan 2021 01:36:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K1aDGl089692; Wed, 20 Jan 2021 01:36:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K1aDq9089691; Wed, 20 Jan 2021 01:36:13 GMT (envelope-from git) Date: Wed, 20 Jan 2021 01:36:13 GMT Message-Id: <202101200136.10K1aDq9089691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 089eafaff3ec - main - arm64: Stop setting VM_BCACHE_SIZE_MAX MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 089eafaff3ec632e1fc56db35dc3b30214c9e5f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 01:36:13 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=089eafaff3ec632e1fc56db35dc3b30214c9e5f9 commit 089eafaff3ec632e1fc56db35dc3b30214c9e5f9 Author: Mark Johnston AuthorDate: 2021-01-20 01:34:35 +0000 Commit: Mark Johnston CommitDate: 2021-01-20 01:34:35 +0000 arm64: Stop setting VM_BCACHE_SIZE_MAX This setting places a (small) limit on the size of the buffer cache, constraining UFS performance on large servers. The setting comes from the initial arm64 implementation and appears to be vestigal. Remove it. Reviewed by: kib Submitted by: Klara, Inc. Sponsored by: Ampere Computing Differential Revision: https://reviews.freebsd.org/D28162 --- sys/arm64/include/param.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sys/arm64/include/param.h b/sys/arm64/include/param.h index a01b37da84c5..f331fd19e2c8 100644 --- a/sys/arm64/include/param.h +++ b/sys/arm64/include/param.h @@ -108,15 +108,6 @@ #define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ #define PCPU_PAGES 1 -/* - * Ceiling on size of buffer cache (really only effects write queueing, - * the VM page cache is not effected), can be changed via - * the kern.maxbcache /boot/loader.conf variable. - */ -#ifndef VM_BCACHE_SIZE_MAX -#define VM_BCACHE_SIZE_MAX (400 * 1024 * 1024) -#endif - /* * Mach derived conversion macros */ From owner-dev-commits-src-main@freebsd.org Wed Jan 20 01:36:15 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8E6BF4E53F3; Wed, 20 Jan 2021 01:36:15 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL7Ql2fXWz3FwY; Wed, 20 Jan 2021 01:36:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A4F4910C6E; Wed, 20 Jan 2021 01:36:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K1aEx0089711; Wed, 20 Jan 2021 01:36:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K1aEJH089710; Wed, 20 Jan 2021 01:36:14 GMT (envelope-from git) Date: Wed, 20 Jan 2021 01:36:14 GMT Message-Id: <202101200136.10K1aEJH089710@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3e3eb5f45f33 - main - arm64, riscv: Set VM_KMEM_SIZE_SCALE to 1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e3eb5f45f330435e49bac04ba18cc89f2e1f75a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 01:36:15 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3e3eb5f45f330435e49bac04ba18cc89f2e1f75a commit 3e3eb5f45f330435e49bac04ba18cc89f2e1f75a Author: Mark Johnston AuthorDate: 2021-01-20 01:34:36 +0000 Commit: Mark Johnston CommitDate: 2021-01-20 01:34:36 +0000 arm64, riscv: Set VM_KMEM_SIZE_SCALE to 1 This setting limits the amount of memory that can be allocated to UMA. On systems with a direct map and ample KVA, however, there is no reason for VM_KMEM_SIZE_SCALE to be larger than 1. This appears to have been inherited from the 32-bit ARM platform definitions. Also remove VM_KMEM_SIZE_MIN, which is not needed when VM_KMEM_SIZE_SCALE is defined to be 1.[*] Reviewed by: alc, kp, kib Reported by: alc [*] Submitted by: Klara, Inc. Sponsored by: Ampere Computing Differential Revision: https://reviews.freebsd.org/D28225 --- sys/arm64/include/vmparam.h | 9 +-------- sys/riscv/include/vmparam.h | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h index 9b9c406867f6..4a90c7711e01 100644 --- a/sys/arm64/include/vmparam.h +++ b/sys/arm64/include/vmparam.h @@ -201,14 +201,7 @@ * How many physical pages per kmem arena virtual page. */ #ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (3) -#endif - -/* - * Optional floor (in bytes) on the size of the kmem arena. - */ -#ifndef VM_KMEM_SIZE_MIN -#define VM_KMEM_SIZE_MIN (16 * 1024 * 1024) +#define VM_KMEM_SIZE_SCALE (1) #endif /* diff --git a/sys/riscv/include/vmparam.h b/sys/riscv/include/vmparam.h index 9580ab3e1218..94782da779f7 100644 --- a/sys/riscv/include/vmparam.h +++ b/sys/riscv/include/vmparam.h @@ -196,14 +196,7 @@ * How many physical pages per kmem arena virtual page. */ #ifndef VM_KMEM_SIZE_SCALE -#define VM_KMEM_SIZE_SCALE (3) -#endif - -/* - * Optional floor (in bytes) on the size of the kmem arena. - */ -#ifndef VM_KMEM_SIZE_MIN -#define VM_KMEM_SIZE_MIN (16 * 1024 * 1024) +#define VM_KMEM_SIZE_SCALE (1) #endif /* From owner-dev-commits-src-main@freebsd.org Wed Jan 20 02:33:25 2021 Return-Path: Delivered-To: dev-commits-src-main@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 EC8834E76C9; Wed, 20 Jan 2021 02:33:25 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL8hj6MQBz3KbX; Wed, 20 Jan 2021 02:33:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD2CF11BC8; Wed, 20 Jan 2021 02:33:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K2XPbv067382; Wed, 20 Jan 2021 02:33:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K2XP4w067381; Wed, 20 Jan 2021 02:33:25 GMT (envelope-from git) Date: Wed, 20 Jan 2021 02:33:25 GMT Message-Id: <202101200233.10K2XP4w067381@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 8adcc757b82c - main - opencrypto: Add comments describing the new crypto_session layout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8adcc757b82c9c80ad743a11292287cebdb6d6f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 02:33:26 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8adcc757b82c9c80ad743a11292287cebdb6d6f9 commit 8adcc757b82c9c80ad743a11292287cebdb6d6f9 Author: Mark Johnston AuthorDate: 2021-01-20 02:32:33 +0000 Commit: Mark Johnston CommitDate: 2021-01-20 02:32:33 +0000 opencrypto: Add comments describing the new crypto_session layout Requested by: rpokala --- sys/opencrypto/crypto.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index fc4169fb2365..0316eb35361a 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -136,6 +136,7 @@ struct crypto_session { struct cryptocap *cap; struct crypto_session_params csp; uint64_t id; + /* Driver softc follows. */ }; /* @@ -942,6 +943,7 @@ crypto_newsession(crypto_session_t *cses, cap->cc_sessions++; CRYPTO_DRIVER_UNLOCK(); + /* Allocate a single block for the generic session and driver softc. */ res = malloc(sizeof(*res) + cap->cc_session_size, M_CRYPTO_DATA, M_WAITOK | M_ZERO); res->cap = cap; From owner-dev-commits-src-main@freebsd.org Wed Jan 20 02:33:27 2021 Return-Path: Delivered-To: dev-commits-src-main@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 212E64E790C; Wed, 20 Jan 2021 02:33:27 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DL8hl0WDhz3KbY; Wed, 20 Jan 2021 02:33:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEA3B11B62; Wed, 20 Jan 2021 02:33:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K2XQ7W067402; Wed, 20 Jan 2021 02:33:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K2XQre067401; Wed, 20 Jan 2021 02:33:26 GMT (envelope-from git) Date: Wed, 20 Jan 2021 02:33:26 GMT Message-Id: <202101200233.10K2XQre067401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4dc1b17dbb9f - main - ktls: Improve handling of the bind_threads tunable a bit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4dc1b17dbb9fc8d51699037d8e2b550b9329b934 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 02:33:27 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4dc1b17dbb9fc8d51699037d8e2b550b9329b934 commit 4dc1b17dbb9fc8d51699037d8e2b550b9329b934 Author: Mark Johnston AuthorDate: 2021-01-20 02:32:33 +0000 Commit: Mark Johnston CommitDate: 2021-01-20 02:32:33 +0000 ktls: Improve handling of the bind_threads tunable a bit - Only check for empty domains if we actually tried to configure domain affinity in the first place. Otherwise setting bind_threads=1 will always cause the sysctl value to be reported as zero. This is harmless since the threads end up being bound, but it's confusing. - Try to improve the sysctl description a bit. Reviewed by: gallatin, jhb Submitted by: Klara, Inc. Sponsored by: Ampere Computing Differential Revision: https://reviews.freebsd.org/D28161 --- sys/kern/uipc_ktls.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index e430afdabc23..72c228e80199 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -113,7 +113,7 @@ static int ktls_bind_threads; #endif SYSCTL_INT(_kern_ipc_tls, OID_AUTO, bind_threads, CTLFLAG_RDTUN, &ktls_bind_threads, 0, - "Bind crypto threads to cores or domains at boot"); + "Bind crypto threads to cores (1) or cores and domains (2) at boot"); static u_int ktls_maxlen = 16384; SYSCTL_UINT(_kern_ipc_tls, OID_AUTO, maxlen, CTLFLAG_RWTUN, @@ -435,10 +435,12 @@ ktls_init(void *dummy __unused) * If we somehow have an empty domain, fall back to choosing * among all KTLS threads. */ - for (i = 0; i < vm_ndomains; i++) { - if (ktls_domains[i].count == 0) { - ktls_bind_threads = 0; - break; + if (ktls_bind_threads > 1) { + for (i = 0; i < vm_ndomains; i++) { + if (ktls_domains[i].count == 0) { + ktls_bind_threads = 1; + break; + } } } From owner-dev-commits-src-main@freebsd.org Wed Jan 20 07:28:54 2021 Return-Path: Delivered-To: dev-commits-src-main@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 501B04EC7DC; Wed, 20 Jan 2021 07:28:54 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLHFf1c1pz3nqD; Wed, 20 Jan 2021 07:28:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A224158A4; Wed, 20 Jan 2021 07:28:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K7SssQ047203; Wed, 20 Jan 2021 07:28:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K7SsfV047202; Wed, 20 Jan 2021 07:28:54 GMT (envelope-from git) Date: Wed, 20 Jan 2021 07:28:54 GMT Message-Id: <202101200728.10K7SsfV047202@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: aae03cfe6489 - main - cache: whitespace nit in cache_fplookup_modifying MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aae03cfe648979e4d80b8ffc7d6fdf1556b9429d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 07:28:54 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=aae03cfe648979e4d80b8ffc7d6fdf1556b9429d commit aae03cfe648979e4d80b8ffc7d6fdf1556b9429d Author: Mateusz Guzik AuthorDate: 2021-01-20 07:22:04 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-20 07:22:04 +0000 cache: whitespace nit in cache_fplookup_modifying --- sys/kern/vfs_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 0621bfb12d3e..5a1ebffece05 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4283,7 +4283,7 @@ cache_fplookup_modifying(struct cache_fpl *fpl) if (!cache_fpl_islastcn(ndp)) { return (cache_fpl_partial(fpl)); } - return (cache_fplookup_final_modifying(fpl)); + return (cache_fplookup_final_modifying(fpl)); } static int __noinline From owner-dev-commits-src-main@freebsd.org Wed Jan 20 07:28:55 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5D34D4EC3A8; Wed, 20 Jan 2021 07:28:55 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLHFg2FJKz3nhL; Wed, 20 Jan 2021 07:28:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FE78156A7; Wed, 20 Jan 2021 07:28:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K7StZO047222; Wed, 20 Jan 2021 07:28:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K7StDC047221; Wed, 20 Jan 2021 07:28:55 GMT (envelope-from git) Date: Wed, 20 Jan 2021 07:28:55 GMT Message-Id: <202101200728.10K7StDC047221@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 2171b8e8a263 - main - cache: augment sdt probe in cache_fplookup_dot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2171b8e8a263fa92b043d9ef53c10ba7941c3001 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 07:28:55 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=2171b8e8a263fa92b043d9ef53c10ba7941c3001 commit 2171b8e8a263fa92b043d9ef53c10ba7941c3001 Author: Mateusz Guzik AuthorDate: 2021-01-20 07:23:14 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-20 07:23:14 +0000 cache: augment sdt probe in cache_fplookup_dot Same as 6d386b4c ("cache: save a branch in cache_fplookup_next") --- sys/kern/vfs_cache.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 5a1ebffece05..cfa25dc59ee4 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4578,16 +4578,15 @@ cache_fplookup_dot(struct cache_fpl *fpl) */ fpl->tvp = fpl->dvp; fpl->tvp_seqc = fpl->dvp_seqc; - if (cache_fplookup_is_mp(fpl)) { - error = cache_fplookup_cross_mount(fpl); - if (__predict_false(error != 0)) { - return (error); - } - } counter_u64_add(dothits, 1); SDT_PROBE3(vfs, namecache, lookup, hit, fpl->dvp, ".", fpl->dvp); - return (0); + + error = 0; + if (cache_fplookup_is_mp(fpl)) { + error = cache_fplookup_cross_mount(fpl); + } + return (error); } static int __noinline From owner-dev-commits-src-main@freebsd.org Wed Jan 20 08:29:54 2021 Return-Path: Delivered-To: dev-commits-src-main@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 788594EE50C; Wed, 20 Jan 2021 08:29:54 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from maybe.home.utahime.org (gate.home.utahime.org [183.180.29.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLJc20KfYz3swL; Wed, 20 Jan 2021 08:29:53 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from eastasia.home.utahime.org (eastasia.home.utahime.org [192.168.174.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by maybe.home.utahime.org (Postfix) with ESMTPS id B9CBF4C9D0; Wed, 20 Jan 2021 17:29:43 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=utahime.org; s=maybe2019112701; t=1611131383; bh=tQgbemXDS/VOIIJIYluLFcEknqqDHzZIRfS2pa8pIds=; h=Date:To:Cc:Subject:From:In-Reply-To:References; b=b+nJkgRdHtqRBIc0NQzepQ2qCkYF1D12yRHj+q0ClMRojvdze3WWzTZTzhknKFFmZ 6lATrYlUOOpHezBKRChDducjcHlwZ1jouj+KqZGK/IBCPDtJNC/LoF6leMxlgT69xs /l/NjecQz61ZuNOqqEultnChpMZJIyoNYELx5SU9crTMV86Y3B9xj+cPjSGPRP6gEu qfx1kd5S2u/eo9Ta+Q5OL6Nu5YpdG7Oo1kf50QuISo7qONYrtbzmPRvgwSqrvZh13F EOgzN+cz3ocKYTe+yIFf7d7pikLG0qJqSGiMsXxBr6ma+iBsar6hF/zXv/hVCdzH/a 7GwmqDMPW7b8g== Received: from localhost (rolling.home.utahime.org [192.168.174.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by eastasia.home.utahime.org (Postfix) with ESMTPSA id 1708348673; Wed, 20 Jan 2021 17:29:43 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.0 at eastasia.home.utahime.org Date: Wed, 20 Jan 2021 17:29:33 +0900 (JST) Message-Id: <20210120.172933.1039050893851306070.yasu@utahime.org> To: gjb@FreeBSD.org Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 041b28524a3c - main - release: Add workaround to use SVN for ports From: Yasuhiro Kimura In-Reply-To: <202101191838.10JIcorS044601@gitrepo.freebsd.org> References: <202101191838.10JIcorS044601@gitrepo.freebsd.org> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DLJc20KfYz3swL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 08:29:54 -0000 From: Glen Barber Subject: git: 041b28524a3c - main - release: Add workaround to use SVN for ports Date: Tue, 19 Jan 2021 18:38:50 GMT > The branch main has been updated by gjb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=041b28524a3c69ff6e893067df156c3faabcac9a > > commit 041b28524a3c69ff6e893067df156c3faabcac9a > Author: Glen Barber > AuthorDate: 2021-01-19 18:38:33 +0000 > Commit: Glen Barber > CommitDate: 2021-01-19 18:38:33 +0000 > > release: Add workaround to use SVN for ports > > The ports tree is scheduled to be converted from Subversion to Git > after the currently-scheduled 13.0-RELEASE, so the source of truth > will be Subversion for the ports tree. > > Implement a hack specifically for this case. This change results in accessing 'svn://svn.freebsd.org/ports/head/head' and failing to check out ports tree. --- Yasuhiro Kimura From owner-dev-commits-src-main@freebsd.org Wed Jan 20 08:31:55 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E73784EE47B; Wed, 20 Jan 2021 08:31:55 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DLJfL6VmTz3t7c; Wed, 20 Jan 2021 08:31:54 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pj1-x1033.google.com with SMTP id l23so1761169pjg.1; Wed, 20 Jan 2021 00:31:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=uiEulb/uccQD7sLqwgfwsRnCJVquzEUSECqFG1e4Jyg=; b=Djz/2AWZmCS6pG1msy1rTTG23fkVDeTJ+ykn4BbTD544EQ+srQIWOg2qSGDmzH0yqC 1ncJ3WljWEOeMBii7w90iM4vvI6nYgU6/57S7QYXps5qmN+8y+o2hq6Nk4hCYqREx2Ls dowfEGl9ualrInDOyUsXM355znEE7iK8i5xIGIBC8y2OoYvPEVsSKcCqF4T3W11snfZ4 ePKQZ2uNSj5o2RMy1PLJd2rzNsru+WS0V/8RRteBxJMkEd2kKEZL0E1lRpaA1omH3Ysz 0WPVmubHjtzqdlof1yRqFiAWCRIOar6U6+kbYcuKGBzXYljerb+VmInge3c/DtJPkeUb 86OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=uiEulb/uccQD7sLqwgfwsRnCJVquzEUSECqFG1e4Jyg=; b=AHpBI4TlEh/5dzhzxRYjk5DHCli5KTxwjHiF/Sud84QmO1jF6MuFYW1coJrAfcwCwp AFuyRCc+m2IZaFk2szpi6OfQshYON8zUrwVsK2S815p2nCEeHSme8Eq24TKuo1PEQ2HS Y6QiiMIaPvMe0gmAlbptfvvqm2tcSQxXdLpJOFA4PL32pl0LEaKXngnkVp98XKbY6x0s DxrINGommVW+Ri4XcJ4TB2dKByhb4GPdYqhy80o1ba+kTN7aJ0h7vA7SNrU5bgoTbYpd 1sTgwOaXcKNAbRmTe/rvsqHTZPcnPETXhpmOe+A78O1GUiu3joxxNdPpBurskSIGA//z gLvA== X-Gm-Message-State: AOAM533iJQRcDoOJ4NN0xQdnQTGCXGNWP1XChZzl/4Wnwwi88qp9D81b U0Y+TV0UVKWphse4yZHsrI8oiaBOogsLZw== X-Google-Smtp-Source: ABdhPJzGvRa5jSmZduF69CeDmFZ2cBAQsaeuSYBXOaQEiGx7rmgPjfqyLtfY0jRDjjWRyVrrLIG9jA== X-Received: by 2002:a17:902:b904:b029:dc:18f2:9419 with SMTP id bf4-20020a170902b904b02900dc18f29419mr8751309plb.66.1611131513198; Wed, 20 Jan 2021 00:31:53 -0800 (PST) Received: from [192.168.20.29] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id n2sm1475949pfu.129.2021.01.20.00.31.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jan 2021 00:31:52 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: e83b514a9563 - main - cat: depend on Makefile to rebuild when WITH_CASPER changes From: Enji Cooper In-Reply-To: <202101171722.10HHMQwh098665@gitrepo.freebsd.org> Date: Wed, 20 Jan 2021 00:31:50 -0800 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202101171722.10HHMQwh098665@gitrepo.freebsd.org> To: Ed Maste X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DLJfL6VmTz3t7c X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Djz/2AWZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::1033 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-1.51 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::1033:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_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]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RECEIVED_SPAMHAUS_PBL(0.00)[73.19.52.228:received]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; NEURAL_SPAM_SHORT(0.99)[0.994]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::1033:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::1033:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 08:31:56 -0000 > On Jan 17, 2021, at 9:22 AM, Ed Maste wrote: >=20 > The branch main has been updated by emaste: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3De83b514a9563d5812c9d158ff976f0de= 96bd90e0 >=20 > commit e83b514a9563d5812c9d158ff976f0de96bd90e0 > Author: Ed Maste > AuthorDate: 2021-01-17 17:15:40 +0000 > Commit: Ed Maste > CommitDate: 2021-01-17 17:19:00 +0000 >=20 > cat: depend on Makefile to rebuild when WITH_CASPER changes >=20 > We try to ensure building WITHOUT_CLEAN (or -DNO_CLEAN) works on an > ongoing basis. b7ab6832cd98 changed cat to build w/o -DWITH_CASPER > by default; add a cat.o dependency on the Makefile so that it gets > rebuilt. > --- > bin/cat/Makefile | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/bin/cat/Makefile b/bin/cat/Makefile > index cce69d8aad9e..06bb071363f8 100644 > --- a/bin/cat/Makefile > +++ b/bin/cat/Makefile > @@ -22,5 +22,7 @@ SUBDIR.${MK_TESTS}+=3D tests > #LIBADD+=3D cap_net > #CFLAGS+=3D-DWITH_CASPER > #.endif > +# Depend on Makefile to rebiuld when WITH_CASPER changes > +cat.o: Makefile Hi Ed, Could this maybe use ${MAKEFILE} or .MAKE.MAKEFILES, e.g., = ${.MAKE.MAKEFILES:[0]}, instead? IIRC meta mode might take care of this automatically, but bdrewery could = answer this definitively. Cheers! -Enji= From owner-dev-commits-src-main@freebsd.org Wed Jan 20 08:48:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 023384EEC88; Wed, 20 Jan 2021 08:48:22 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLK1K6kM9z3vNl; Wed, 20 Jan 2021 08:48:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D884C163EB; Wed, 20 Jan 2021 08:48:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K8mLpY050761; Wed, 20 Jan 2021 08:48:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K8mL6C050760; Wed, 20 Jan 2021 08:48:21 GMT (envelope-from git) Date: Wed, 20 Jan 2021 08:48:21 GMT Message-Id: <202101200848.10K8mL6C050760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: a0e85d0eb5a5 - main - Remove the unnecessary space before the colon MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a0e85d0eb5a5c30d47d6bfb014f59b9fcd32dbe4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 08:48:22 -0000 The branch main has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a0e85d0eb5a5c30d47d6bfb014f59b9fcd32dbe4 commit a0e85d0eb5a5c30d47d6bfb014f59b9fcd32dbe4 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-01-20 08:46:15 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-01-20 08:46:15 +0000 Remove the unnecessary space before the colon MFC after: 3 days --- bin/df/df.1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/df/df.1 b/bin/df/df.1 index 8949ab1c71b0..6221f4c43726 100644 --- a/bin/df/df.1 +++ b/bin/df/df.1 @@ -220,8 +220,7 @@ Mounted on .Ed .Pp Show human readable information for the file system containing the file -.Pa /etc/rc.conf -: +.Pa /etc/rc.conf : .Bd -literal -offset indent $ df -h /etc/rc.conf Filesystem Size Used Avail Capacity Mounted on From owner-dev-commits-src-main@freebsd.org Wed Jan 20 09:49:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0C4C44EFDA4; Wed, 20 Jan 2021 09:49:49 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLLND6bgyz4SK1; Wed, 20 Jan 2021 09:49:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D526917428; Wed, 20 Jan 2021 09:49:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10K9nmLD029086; Wed, 20 Jan 2021 09:49:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10K9nmkZ029085; Wed, 20 Jan 2021 09:49:48 GMT (envelope-from git) Date: Wed, 20 Jan 2021 09:49:48 GMT Message-Id: <202101200949.10K9nmkZ029085@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ulrich Spörlein Subject: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: uqs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a9fc14fbf445cffd18f34f6a602bdba84bb5a867 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 09:49:49 -0000 The branch main has been updated by uqs: URL: https://cgit.FreeBSD.org/src/commit/?id=a9fc14fbf445cffd18f34f6a602bdba84bb5a867 commit a9fc14fbf445cffd18f34f6a602bdba84bb5a867 Author: Michael Osipov AuthorDate: 2021-01-05 10:48:39 +0000 Commit: Ulrich Spörlein CommitDate: 2021-01-20 09:48:27 +0000 newvers.sh: add support for gitup(1) gitup writes a .gituprevision file into the shallow clone directory. Read that file and print commit information only. Submitted by: Michael Osipov Pull Request: https://github.com/freebsd/freebsd-src/pull/449 While here, drop the redundant branch name from the git output and don't count commits in shallow clones. Reported by: Michael Osipov MFC after: 2 weeks --- sys/conf/newvers.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 2a0ace45f2f6..92c275d19fb9 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -221,6 +221,10 @@ if findvcs .git; then done fi +if findvcs .gituprevision; then + gituprevision="${VCSTOP}/.gituprevision" +fi + if findvcs .hg; then for dir in /usr/bin /usr/local/bin; do if [ -x "${dir}/hg" ] ; then @@ -248,13 +252,11 @@ fi if [ -n "$git_cmd" ] ; then git=$($git_cmd rev-parse --verify --short HEAD 2>/dev/null) - git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null) - if [ -n "$git_cnt" ] ; then - git="c${git_cnt}-g${git}" - fi - git_b=$($git_cmd rev-parse --abbrev-ref HEAD) - if [ -n "$git_b" -a "$git_b" != "HEAD" ] ; then - git="${git_b}-${git}" + if [ "$(git rev-parse --is-shallow-repository)" = false ] ; then + git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null) + if [ -n "$git_cnt" ] ; then + git="c${git_cnt}-g${git}" + fi fi if git_tree_modified; then git="${git}-dirty" @@ -263,6 +265,10 @@ if [ -n "$git_cmd" ] ; then git=" ${git}" fi +if [ -n "$gituprevision" ] ; then + gitup=" $(awk -F: '{print $2}' $gituprevision)" +fi + if [ -n "$hg_cmd" ] ; then hg=$($hg_cmd id 2>/dev/null) hgsvn=$($hg_cmd svn info 2>/dev/null | \ @@ -277,10 +283,10 @@ fi [ ${include_metadata} = "if-modified" -a ${modified} = "yes" ] && include_metadata=yes if [ ${include_metadata} != "yes" ]; then - VERINFO="${VERSION}${svn}${git}${hg} ${i}" + VERINFO="${VERSION}${svn}${git}${gitup}${hg} ${i}" VERSTR="${VERINFO}\\n" else - VERINFO="${VERSION} #${v}${svn}${git}${hg}: ${t}" + VERINFO="${VERSION} #${v}${svn}${git}${gitup}${hg}: ${t}" VERSTR="${VERINFO}\\n ${u}@${h}:${d}\\n" fi From owner-dev-commits-src-main@freebsd.org Wed Jan 20 10:37:43 2021 Return-Path: Delivered-To: dev-commits-src-main@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 3287B4F13A7; Wed, 20 Jan 2021 10:37:43 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLMRW0yG6z4Wqr; Wed, 20 Jan 2021 10:37:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 141941785F; Wed, 20 Jan 2021 10:37:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KAbgRW093407; Wed, 20 Jan 2021 10:37:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KAbgGU093406; Wed, 20 Jan 2021 10:37:42 GMT (envelope-from git) Date: Wed, 20 Jan 2021 10:37:42 GMT Message-Id: <202101201037.10KAbgGU093406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: db4b5a16a30a - main - Minor simplification of MK_PMC case in usr.sbin/Makefile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db4b5a16a30a7587fc12812d5c8a018fa7a16ded Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 10:37:43 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=db4b5a16a30a7587fc12812d5c8a018fa7a16ded commit db4b5a16a30a7587fc12812d5c8a018fa7a16ded Author: Alex Richardson AuthorDate: 2021-01-20 09:52:58 +0000 Commit: Alex Richardson CommitDate: 2021-01-20 09:52:58 +0000 Minor simplification of MK_PMC case in usr.sbin/Makefile MK_PMC is already guarded by MK_CXX in src.opts.mk, so we can actually merge it with the following SUBDIR statement after c1a3d7f20696. Suggested By: jrtc27 --- usr.sbin/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 2e01b0fcf847..da61617e408b 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -186,8 +186,7 @@ SUBDIR.${MK_NTP}+= ntp SUBDIR.${MK_OPENSSL}+= keyserv SUBDIR.${MK_PF}+= ftp-proxy SUBDIR.${MK_PKGBOOTSTRAP}+= pkg -SUBDIR.${MK_PMC}.${MK_CXX}+= pmc -SUBDIR.${MK_PMC}+= pmcannotate pmccontrol pmcstat pmcstudy +SUBDIR.${MK_PMC}+= pmc pmcannotate pmccontrol pmcstat pmcstudy SUBDIR.${MK_PORTSNAP}+= portsnap SUBDIR.${MK_PPP}+= ppp SUBDIR.${MK_QUOTAS}+= edquota From owner-dev-commits-src-main@freebsd.org Wed Jan 20 10:37:44 2021 Return-Path: Delivered-To: dev-commits-src-main@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 833D94F1348; Wed, 20 Jan 2021 10:37:44 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLMRX2Wtfz4X3B; Wed, 20 Jan 2021 10:37:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39CCD17DB3; Wed, 20 Jan 2021 10:37:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KAbiM9093427; Wed, 20 Jan 2021 10:37:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KAbiCb093426; Wed, 20 Jan 2021 10:37:44 GMT (envelope-from git) Date: Wed, 20 Jan 2021 10:37:44 GMT Message-Id: <202101201037.10KAbiCb093426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 7e99c034f788 - main - Emit uprintf() output for initproc if there is no controlling terminal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7e99c034f788128c7d168eaf27af9a3acaa06163 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 10:37:44 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7e99c034f788128c7d168eaf27af9a3acaa06163 commit 7e99c034f788128c7d168eaf27af9a3acaa06163 Author: Alex Richardson AuthorDate: 2021-01-20 09:54:46 +0000 Commit: Alex Richardson CommitDate: 2021-01-20 09:54:46 +0000 Emit uprintf() output for initproc if there is no controlling terminal This patch helped me debug why /sbin/init was not being loaded after making changes to the image activator in CheriBSD. Reviewed By: jhb (earlier version), kib Differential Revision: https://reviews.freebsd.org/D28121 --- sys/kern/subr_prf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 31117c4e3415..b51213a25d0d 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -179,6 +179,14 @@ uprintf(const char *fmt, ...) if (TD_IS_IDLETHREAD(td)) return (0); + if (td->td_proc == initproc) { + /* Produce output when we fail to load /sbin/init: */ + va_start(ap, fmt); + retval = vprintf(fmt, ap); + va_end(ap); + return (retval); + } + sx_slock(&proctree_lock); p = td->td_proc; PROC_LOCK(p); From owner-dev-commits-src-main@freebsd.org Wed Jan 20 10:37:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A39534F148E; Wed, 20 Jan 2021 10:37:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLMRY2zqXz4X79; Wed, 20 Jan 2021 10:37:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F3EB17CBF; Wed, 20 Jan 2021 10:37:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KAbjl1093452; Wed, 20 Jan 2021 10:37:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KAbjT8093451; Wed, 20 Jan 2021 10:37:45 GMT (envelope-from git) Date: Wed, 20 Jan 2021 10:37:45 GMT Message-Id: <202101201037.10KAbjT8093451@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: cef194271162 - main - libc: Fix null pointer arithmetic warning in mergesort MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cef1942711624c6cf1d237118531cfad9ade05ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 10:37:46 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=cef1942711624c6cf1d237118531cfad9ade05ac commit cef1942711624c6cf1d237118531cfad9ade05ac Author: Alex Richardson AuthorDate: 2021-01-20 09:56:01 +0000 Commit: Alex Richardson CommitDate: 2021-01-20 09:56:01 +0000 libc: Fix null pointer arithmetic warning in mergesort This file has other questionable code and "optimizations" (such as copying one int at a time) that are probably no longer useful, so it might make sense to replace it with a different implementation at some point. Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D28134 --- lib/libc/stdlib/merge.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/libc/stdlib/merge.c b/lib/libc/stdlib/merge.c index 3a47e424e4da..853d6ae93fcb 100644 --- a/lib/libc/stdlib/merge.c +++ b/lib/libc/stdlib/merge.c @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); * (The default is pairwise merging.) */ -#include +#include #include #include @@ -97,9 +97,7 @@ static void insertionsort(u_char *, size_t, size_t, cmp_t); * boundaries. */ /* Assumption: PSIZE is a power of 2. */ -#define EVAL(p) (u_char **) \ - ((u_char *)0 + \ - (((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1))) +#define EVAL(p) (u_char **)roundup2((uintptr_t)p, PSIZE) #ifdef I_AM_MERGESORT_B int mergesort_b(void *, size_t, size_t, cmp_t); From owner-dev-commits-src-main@freebsd.org Wed Jan 20 10:47:19 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9E8BC4F16B7; Wed, 20 Jan 2021 10:47:19 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from maybe.home.utahime.org (gate.home.utahime.org [183.180.29.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLMfZ01F3z4XvQ; Wed, 20 Jan 2021 10:47:17 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from eastasia.home.utahime.org (eastasia.home.utahime.org [192.168.174.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by maybe.home.utahime.org (Postfix) with ESMTPS id BED344CAC8; Wed, 20 Jan 2021 19:47:12 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=utahime.org; s=maybe2019112701; t=1611139632; bh=ie62pcZDkiga6czGAJzIaFu6YJ6QFbfraCYCovZcUCY=; h=Date:To:Cc:Subject:From:In-Reply-To:References; b=keJtNxugbZC8mPTEE/akUwjuQXIAPaEHerAQFcnkQq0Cp2YYSrrd70KSO1rQ+RH9l T04o9v62TNGANNT8kGmgIqVx4ujqv349Bi4hdKduOHMiHYHJzUQWa9vJxG9rSwJ9wY hkdxYeCrzMHe00gaB9VWO1Wa+wyBO+Tl9bpjh3cCJlxzASTimGbfkaWjye07qvzLlo wFrzRY+fGiZgcN2M7jriMydpccCOrGAPFu/UoReTPeXIF1dOMXHXWXrCZUCYORU8A0 LGoGLxI6cTstu1IvfnZMWvdP7p5TIe3zQjf3jTtsISPiC/UABl7lgT7SrIP3XPAnD4 qd4APE6phk0xA== Received: from localhost (rolling-vm-freebsd1.home.utahime.org [192.168.174.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by eastasia.home.utahime.org (Postfix) with ESMTPSA id 5DEAA4883C; Wed, 20 Jan 2021 19:47:11 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.0 at eastasia.home.utahime.org Date: Wed, 20 Jan 2021 19:46:46 +0900 (JST) Message-Id: <20210120.194646.2281393142538351130.yasu@utahime.org> To: gjb@FreeBSD.org Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 041b28524a3c - main - release: Add workaround to use SVN for ports From: Yasuhiro Kimura In-Reply-To: <20210120.172933.1039050893851306070.yasu@utahime.org> References: <202101191838.10JIcorS044601@gitrepo.freebsd.org> <20210120.172933.1039050893851306070.yasu@utahime.org> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DLMfZ01F3z4XvQ X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=utahime.org header.s=maybe2019112701 header.b=keJtNxug; dmarc=none; spf=pass (mx1.freebsd.org: domain of yasu@utahime.org designates 183.180.29.210 as permitted sender) smtp.mailfrom=yasu@utahime.org X-Spamd-Result: default: False [-0.70 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+a:spf-authorized.utahime.org]; TO_DN_NONE(0.00)[]; HFILTER_HELO_IP_A(1.00)[maybe.home.utahime.org]; HFILTER_HELO_NORES_A_OR_MX(0.30)[maybe.home.utahime.org]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[utahime.org:+]; NEURAL_HAM_SHORT(-1.00)[-0.999]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[183.180.29.210:from]; ASN(0.00)[asn:2519, ipnet:183.180.0.0/16, country:JP]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[utahime.org:s=maybe2019112701]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[utahime.org]; SPAMHAUS_ZRD(0.00)[183.180.29.210:from:127.0.2.255]; MID_CONTAINS_FROM(1.00)[]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 10:47:19 -0000 From: Yasuhiro Kimura Subject: Re: git: 041b28524a3c - main - release: Add workaround to use SVN for ports Date: Wed, 20 Jan 2021 17:29:33 +0900 (JST) > From: Glen Barber > Subject: git: 041b28524a3c - main - release: Add workaround to use SVN for ports > Date: Tue, 19 Jan 2021 18:38:50 GMT > >> The branch main has been updated by gjb: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=041b28524a3c69ff6e893067df156c3faabcac9a >> >> commit 041b28524a3c69ff6e893067df156c3faabcac9a >> Author: Glen Barber >> AuthorDate: 2021-01-19 18:38:33 +0000 >> Commit: Glen Barber >> CommitDate: 2021-01-19 18:38:33 +0000 >> >> release: Add workaround to use SVN for ports >> >> The ports tree is scheduled to be converted from Subversion to Git >> after the currently-scheduled 13.0-RELEASE, so the source of truth >> will be Subversion for the ports tree. >> >> Implement a hack specifically for this case. > > This change results in accessing 'svn://svn.freebsd.org/ports/head/head' > and failing to check out ports tree. Following patch fixes the problem. diff --git a/release/release.sh b/release/release.sh index 60034f12349..fbd64bb8234 100755 --- a/release/release.sh +++ b/release/release.sh @@ -147,7 +147,7 @@ env_check() { SRC="${GITROOT}${GITSRC}" DOC="${GITROOT}${GITDOC}" #PORT="${GITROOT}${GITPORTS}" - PORT="svn://svn.freebsd.org/ports/${PORTBRANCH}" + PORT="svn://svn.freebsd.org/ports/" if [ -n "${EMBEDDEDBUILD}" ]; then WITH_DVD= --- Yasuhiro Kimura From owner-dev-commits-src-main@freebsd.org Wed Jan 20 11:21:36 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0BC0D4F2158; Wed, 20 Jan 2021 11:21:36 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLNQ770H9z4ZZr; Wed, 20 Jan 2021 11:21:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E356E182F1; Wed, 20 Jan 2021 11:21:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KBLZAw053426; Wed, 20 Jan 2021 11:21:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KBLZE7053425; Wed, 20 Jan 2021 11:21:35 GMT (envelope-from git) Date: Wed, 20 Jan 2021 11:21:35 GMT Message-Id: <202101201121.10KBLZE7053425@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: bc7ee8e5bc55 - main - Address panic with PRR due to missed initialization of recover_fs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc7ee8e5bc555c246bad8bbb9cdf964fa0a08f41 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 11:21:36 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=bc7ee8e5bc555c246bad8bbb9cdf964fa0a08f41 commit bc7ee8e5bc555c246bad8bbb9cdf964fa0a08f41 Author: Richard Scheffenegger AuthorDate: 2021-01-20 11:06:34 +0000 Commit: Richard Scheffenegger CommitDate: 2021-01-20 11:06:34 +0000 Address panic with PRR due to missed initialization of recover_fs Summary: When using the base stack in conjunction with RACK, it appears that infrequently, ++tp->t_dupacks is instantly larger than tcprexmtthresh. This leaves the recover flightsize (sackhint.recover_fs) uninitialized, leading to a div/0 panic. Address this by properly initializing the variable just prior to first use, if it is not properly initialized. In order to prevent stale information from a prior recovery to negatively impact the PRR calculations in this event, also clear recover_fs once loss recovery is finished. Finally, improve the readability of the initialization of recover_fs when t_dupacks == tcprexmtthresh by adjusting the indentation and using the max(1, snd_nxt - snd_una) macro. Reviewers: rrs, kbowling, tuexen, jtl, #transport, gnn!, jmg, manu, #manpages Reviewed By: rrs, kbowling, #transport Subscribers: bdrewery, andrew, rpokala, ae, emaste, bz, bcran, #linuxkpi, imp, melifaro Differential Revision: https://reviews.freebsd.org/D28114 --- sys/netinet/tcp_input.c | 20 ++++++++++++-------- sys/netinet/tcp_subr.c | 10 ++++++++++ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 283d42b594bd..75718352da00 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -510,6 +510,7 @@ cc_post_recovery(struct tcpcb *tp, struct tcphdr *th) } /* XXXLAS: EXIT_RECOVERY ? */ tp->t_bytes_acked = 0; + tp->sackhint.recover_fs = 0; } /* @@ -2590,6 +2591,9 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->sackhint.sack_bytes_rexmit; tp->sackhint.prr_delivered += del_data; if (pipe > tp->snd_ssthresh) { + if (tp->sackhint.recover_fs == 0) + tp->sackhint.recover_fs = + max(1, tp->snd_nxt - tp->snd_una); snd_cnt = (tp->sackhint.prr_delivered * tp->snd_ssthresh / tp->sackhint.recover_fs) + @@ -2677,14 +2681,14 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tcp_timer_activate(tp, TT_REXMT, 0); tp->t_rtttime = 0; if (V_tcp_do_prr) { - /* - * snd_ssthresh is already updated by - * cc_cong_signal. - */ - tp->sackhint.prr_delivered = 0; - tp->sackhint.sack_bytes_rexmit = 0; - if (!(tp->sackhint.recover_fs = tp->snd_nxt - tp->snd_una)) - tp->sackhint.recover_fs = 1; + /* + * snd_ssthresh is already updated by + * cc_cong_signal. + */ + tp->sackhint.prr_delivered = 0; + tp->sackhint.sack_bytes_rexmit = 0; + tp->sackhint.recover_fs = max(1, + tp->snd_nxt - tp->snd_una); } if (tp->t_flags & TF_SACK_PERMIT) { TCPSTAT_INC( diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index b39d2b43d3a2..c49ff680d201 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -742,6 +742,16 @@ tcp_default_fb_init(struct tcpcb *tp) TCPS_HAVEESTABLISHED(tp->t_state) ? TP_KEEPIDLE(tp) : TP_KEEPINIT(tp)); + /* + * Make sure critical variables are initialized + * if transitioning while in Recovery. + */ + if IN_FASTRECOVERY(tp->t_flags) { + if (tp->sackhint.recover_fs == 0) + tp->sackhint.recover_fs = max(1, + tp->snd_nxt - tp->snd_una); + } + return (0); } From owner-dev-commits-src-main@freebsd.org Wed Jan 20 14:30:13 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BD28F4F7B1E; Wed, 20 Jan 2021 14:30:13 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLSbn4z8Vz4nsY; Wed, 20 Jan 2021 14:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E3751AE82; Wed, 20 Jan 2021 14:30:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KEUDvT098262; Wed, 20 Jan 2021 14:30:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KEUDIi098259; Wed, 20 Jan 2021 14:30:13 GMT (envelope-from git) Date: Wed, 20 Jan 2021 14:30:13 GMT Message-Id: <202101201430.10KEUDIi098259@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: b9fdd1446cda - main - Regenerate src.conf(5) after 7c5a624afae4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b9fdd1446cdaf396a63ef9bf31c55a8aa4a5fa31 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 14:30:13 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b9fdd1446cdaf396a63ef9bf31c55a8aa4a5fa31 commit b9fdd1446cdaf396a63ef9bf31c55a8aa4a5fa31 Author: Kyle Evans AuthorDate: 2021-01-20 14:29:16 +0000 Commit: Kyle Evans CommitDate: 2021-01-20 14:29:16 +0000 Regenerate src.conf(5) after 7c5a624afae4 WITHOUT_CRYPT no longer implies WITHOUT_WIRELESS after the aforementioned commit. --- share/man/man5/src.conf.5 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index fa44fac74a51..5ff5b31b80be 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 7, 2021 +.Dd January 20, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -400,8 +400,6 @@ When set, it enforces these options: .Va WITHOUT_SVNLITE .It .Va WITHOUT_UNBOUND -.It -.Va WITHOUT_WIRELESS .El .Pp When set, these options are also in effect: @@ -1309,8 +1307,6 @@ When set, it enforces these options: .Va WITHOUT_SVNLITE .It .Va WITHOUT_UNBOUND -.It -.Va WITHOUT_WIRELESS .El .Pp When set, these options are also in effect: From owner-dev-commits-src-main@freebsd.org Wed Jan 20 15:00:31 2021 Return-Path: Delivered-To: dev-commits-src-main@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 81B824F974A; Wed, 20 Jan 2021 15:00:31 +0000 (UTC) (envelope-from kevans@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLTGl3Fdpz4tD6; Wed, 20 Jan 2021 15:00:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 5D698774C; Wed, 20 Jan 2021 15:00:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f52.google.com with SMTP id j18so11001120qvu.3; Wed, 20 Jan 2021 07:00:31 -0800 (PST) X-Gm-Message-State: AOAM532UoIAY6r22dO9NggHjWryxKandRCTM6c0UtJaJ+u2Na28NBMLh TAhPNINF3eX95VLmJcnoRQMVh0uwqQKG7A/a+6c= X-Google-Smtp-Source: ABdhPJw93zow2zaa02K+X+kSkg9xbCCt9dDikJUNI4NL/piH3kw+wvMGAoItV9y64lgbw0k0bFJd7A+P4ChsMuFAxus= X-Received: by 2002:a0c:b59a:: with SMTP id g26mr9731043qve.26.1611154830837; Wed, 20 Jan 2021 07:00:30 -0800 (PST) MIME-Version: 1.0 References: <202101140704.10E74KhX070996@gitrepo.freebsd.org> In-Reply-To: From: Kyle Evans Date: Wed, 20 Jan 2021 09:00:17 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: bd72252aace3 - main - [mips] revert r366664 - flip mips back from -O2 to -O To: Adrian Chadd Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Mateusz Guzik , Alex Richardson Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 15:00:31 -0000 On Thu, Jan 14, 2021 at 7:26 AM Mateusz Guzik wrote: > > This breaks tinderbox, for example: > > make[5]: "/usr/src/share/mk/sys.mk" line 169: Malformed conditional > (${MACHINE_CPUARCH} == "mips" && ${COMPILER_TYPE} == "gcc") > make[5]: Fatal errors encountered -- cannot continue > make[5]: stopped in /usr/obj/usr/src/mips.mips64/sys/BERI_NETFPGA_MDROOT > Adrian, ping. Tinderbox has been broken from this for nearly a full week now, and it makes it hard to defend mips when we apparently can't garner up the energy to fix stuff like this in a timely fashion. sys.mk is way too early for checking COMPILER_TYPE, we should either revert back to -O2 or to the previous version entirely by dropping the COMPILER_TYPE check. freebsd-wifi-build can set CFLAGS to override it, so it's tempting to say we should just revert this and you can override CFLAGS in freebsd-wifi-build until you can work out why gcc6 vomits at runtime. Thanks, Kyle Evans > On 1/14/21, Adrian Chadd wrote: > > The branch main has been updated by adrian: > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=bd72252aace382921840ddbceea712b96f4ad242 > > > > commit bd72252aace382921840ddbceea712b96f4ad242 > > Author: Adrian Chadd > > AuthorDate: 2021-01-12 21:13:20 +0000 > > Commit: Adrian Chadd > > CommitDate: 2021-01-14 07:03:53 +0000 > > > > [mips] revert r366664 - flip mips back from -O2 to -O > > > > Now that I have -head fitting in 8MB of flash again, I can test > > out freebsd-head on my home AP test setup. Unfortunately, > > the introduction of -O2 in r366664 causes the following infinite > > loop shortly after boot: > > > > ------ > > > > MAP: No valid partition found at map/rootfs.uzip > > Warning: no time-of-day clock registered, system time will not be set > > accurately > > start_init: trying /sbin/init > > BAD_PAGE_FAULT: pid 1 tid 100001 (init), uid 0: pc 0x4042c320 got a read > > fault (type 0x2) at 0x2e3a0 > > Trapframe Register Dump: > > zero: 0 at: 0 v0: 0 v1: 0 > > a0: 0x1af34 a1: 0 a2: 0 a3: 0x7fffeff0 > > t0: 0 t1: 0 t2: 0 t3: 0 > > t4: 0 t5: 0 t6: 0 t7: 0 > > t8: 0 t9: 0x152e8 s0: 0x7fffee84 s1: 0 > > s2: 0 s3: 0 s4: 0 s5: 0 > > s6: 0 s7: 0 k0: 0 k1: 0 > > gp: 0x362c0 sp: 0x7fffedf0 s8: 0 ra: 0x40417df0 > > sr: 0xf413 mullo: 0 mulhi: 0 badvaddr: > > 0x2e3a0 > > cause: 0xffffffff80000008 pc: 0x4042c31c > > Page table info for pc address 0x4042c320: pde = 0x80712000, pte = > > 0xa002065a > > Dumping 4 words starting at pc address 0x4042c320: > > 8f9980e0 80820000 10400067 00809825 > > Page table info for bad address 0x2e3a0: pde = 0, pte = 0 > > > > ------ > > > > I'm not yet sure why, but until I figure it out with the mips64/cheri > > folk this should be reverted. > > > > This should only use -O on GCC generated code for MIPS platforms. > > > > Tested: > > > > * QCA934x (mips74k) - WDR-3600/WDR-4300 APs > > > > Differential Revision: https://reviews.freebsd.org/D28122 > > --- > > share/mk/sys.mk | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/share/mk/sys.mk b/share/mk/sys.mk > > index 8f456b28593a..72f458397683 100644 > > --- a/share/mk/sys.mk > > +++ b/share/mk/sys.mk > > @@ -166,7 +166,14 @@ CC ?= c89 > > CFLAGS ?= -O > > .else > > CC ?= cc > > +.if ${MACHINE_CPUARCH} == "mips" && ${COMPILER_TYPE} == "gcc" > > +# Note: there are currently issues generating code gcc-6.x targeting > > +# code for at least mips32. The system hits infinite page faults > > +# when starting /sbin/init if -O2 is used. > > +CFLAGS ?= -O -pipe > > +.else > > CFLAGS ?= -O2 -pipe > > +.endif > > .if defined(NO_STRICT_ALIASING) > > CFLAGS += -fno-strict-aliasing > > .endif > > _______________________________________________ > > dev-commits-src-all@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > > To unsubscribe, send any mail to > > "dev-commits-src-all-unsubscribe@freebsd.org" > > > > > -- > Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Wed Jan 20 15:45:44 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AF8E14FA35E; Wed, 20 Jan 2021 15:45:44 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLVGw4ZX7z3CYY; Wed, 20 Jan 2021 15:45:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 903441B75E; Wed, 20 Jan 2021 15:45:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KFjiEl097817; Wed, 20 Jan 2021 15:45:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KFjiYU097815; Wed, 20 Jan 2021 15:45:44 GMT (envelope-from git) Date: Wed, 20 Jan 2021 15:45:44 GMT Message-Id: <202101201545.10KFjiYU097815@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: d70886d06316 - main - wpa_supplicant uses PF_ROUTE to return the routing table in order to determine the length of the routing table buffer. As of 81728a538d24 wpa_supplicant is started before the routing table has been populated resulting in the length of zero to be returned. This causes wpa_supplicant to loop endlessly. (The workaround is to kill and restart wpa_supplicant as by the time it is restarted the routing table is populated.) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d70886d063166786ded0007af8cdcbf57b7b4827 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 15:45:44 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=d70886d063166786ded0007af8cdcbf57b7b4827 commit d70886d063166786ded0007af8cdcbf57b7b4827 Author: Cy Schubert AuthorDate: 2021-01-20 15:20:22 +0000 Commit: Cy Schubert CommitDate: 2021-01-20 15:45:18 +0000 wpa_supplicant uses PF_ROUTE to return the routing table in order to determine the length of the routing table buffer. As of 81728a538d24 wpa_supplicant is started before the routing table has been populated resulting in the length of zero to be returned. This causes wpa_supplicant to loop endlessly. (The workaround is to kill and restart wpa_supplicant as by the time it is restarted the routing table is populated.) (Personally, I was not able to reproduce this unless wlan0 was a member of lagg0. However, others experienced this problem on standalone wlan0.) PR: 252844 Submitted by: shu Reported by: shu Reviewed by: cy X-MFC with: 81728a538d24f483d0986850fa3f51d5d84d8f26 Differential Revision: https://reviews.freebsd.org/D28249 --- contrib/wpa/src/drivers/driver_bsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/wpa/src/drivers/driver_bsd.c b/contrib/wpa/src/drivers/driver_bsd.c index f99122e477c1..96cf066a7a46 100644 --- a/contrib/wpa/src/drivers/driver_bsd.c +++ b/contrib/wpa/src/drivers/driver_bsd.c @@ -648,7 +648,7 @@ rtbuf_len(void) len = 2048; } - return len; + return (len == 0) ? 2048 : len; } #ifdef HOSTAPD From owner-dev-commits-src-main@freebsd.org Wed Jan 20 15:50:50 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2FD754FA5F0; Wed, 20 Jan 2021 15:50:50 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLVNp0w0gz3CsZ; Wed, 20 Jan 2021 15:50:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 125211BF13; Wed, 20 Jan 2021 15:50:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KFoosK008513; Wed, 20 Jan 2021 15:50:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KFooYA008512; Wed, 20 Jan 2021 15:50:50 GMT (envelope-from git) Date: Wed, 20 Jan 2021 15:50:50 GMT Message-Id: <202101201550.10KFooYA008512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: b84d0aaa4e64 - main - ifconfig: add vlanproto "qiniq" as an alias for "802.1ad" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b84d0aaa4e64fb95b105d0d38f6295fec7a82110 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 15:50:50 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=b84d0aaa4e64fb95b105d0d38f6295fec7a82110 commit b84d0aaa4e64fb95b105d0d38f6295fec7a82110 Author: Allan Jude AuthorDate: 2021-01-19 23:22:07 +0000 Commit: Allan Jude CommitDate: 2021-01-20 15:50:45 +0000 ifconfig: add vlanproto "qiniq" as an alias for "802.1ad" QinQ is better known by this name, so accept it as an alias Reported-by: Mike Geiger Reviewed-by: melifaro, hselasky, rpokala MFC-with: 366917 Sponsored-by: Klara Inc. Differential-Revision: https://reviews.freebsd.org/D28245 --- sbin/ifconfig/ifconfig.8 | 5 +++++ sbin/ifconfig/ifvlan.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index c1ffb6a82ccc..bbaaa00d419b 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -2706,6 +2706,11 @@ and .Dq 802.1ad . The default encapsulation protocol is .Dq 802.1Q . +The +.Dq 802.1ad +protocol is also commonly known as +.Dq QinQ ; +either name can be used. .It Cm vlanpcp Ar priority_code_point Priority code point .Pq Dv PCP diff --git a/sbin/ifconfig/ifvlan.c b/sbin/ifconfig/ifvlan.c index f316b0404459..60f97338ee27 100644 --- a/sbin/ifconfig/ifvlan.c +++ b/sbin/ifconfig/ifvlan.c @@ -68,6 +68,7 @@ static const char rcsid[] = static const char proto_8021Q[] = "802.1q"; static const char proto_8021ad[] = "802.1ad"; +static const char proto_qinq[] = "qinq"; static struct vlanreq params = { .vlr_tag = NOTAG, @@ -220,8 +221,8 @@ DECL_CMD_FUNC(setvlanproto, val, d) if (strncasecmp(proto_8021Q, val, strlen(proto_8021Q)) == 0) { params.vlr_proto = ETHERTYPE_VLAN; - } else if (strncasecmp(proto_8021ad, val, - strlen(proto_8021ad)) == 0) { + } else if ((strncasecmp(proto_8021ad, val, strlen(proto_8021ad)) == 0) + || (strncasecmp(proto_qinq, val, strlen(proto_qinq)) == 0)) { params.vlr_proto = ETHERTYPE_QINQ; } else errx(1, "invalid value for vlanproto"); From owner-dev-commits-src-main@freebsd.org Wed Jan 20 16:03:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8B5054FAFB4; Wed, 20 Jan 2021 16:03:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLVgj3VP8z3F1Q; Wed, 20 Jan 2021 16:03:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AA721C0A5; Wed, 20 Jan 2021 16:03:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KG3jq4024041; Wed, 20 Jan 2021 16:03:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KG3jqM024040; Wed, 20 Jan 2021 16:03:45 GMT (envelope-from git) Date: Wed, 20 Jan 2021 16:03:45 GMT Message-Id: <202101201603.10KG3jqM024040@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 2247f4894174 - main - aio: micro-optimize the lio_opcode assignments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2247f48941743cab420394b5ff0fc65ec8c69a99 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 16:03:45 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=2247f48941743cab420394b5ff0fc65ec8c69a99 commit 2247f48941743cab420394b5ff0fc65ec8c69a99 Author: Alan Somers AuthorDate: 2021-01-03 04:25:05 +0000 Commit: Alan Somers CommitDate: 2021-01-20 16:02:25 +0000 aio: micro-optimize the lio_opcode assignments This allows slightly more efficient opcode testing in-kernel. It is transparent to userland, except to applications that sneakily submit aio fsync or aio mlock operations via lio_listio, which has never been documented, requires the use of deliberately undefined constants (LIO_SYNC and LIO_MLOCK), and is arguably a bug. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D27942 --- sys/kern/sys_socket.c | 8 +++----- sys/kern/vfs_aio.c | 48 ++++++++++++++---------------------------------- sys/sys/aio.h | 11 ++++++----- 3 files changed, 23 insertions(+), 44 deletions(-) diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 18803b6a5ac0..e53b0367960b 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -775,10 +775,10 @@ soo_aio_cancel(struct kaiocb *job) so = job->fd_file->f_data; opcode = job->uaiocb.aio_lio_opcode; - if (opcode == LIO_READ || opcode == LIO_READV) + if (opcode & LIO_READ) sb = &so->so_rcv; else { - MPASS(opcode == LIO_WRITE || opcode == LIO_WRITEV); + MPASS(opcode & LIO_WRITE); sb = &so->so_snd; } @@ -808,13 +808,11 @@ soo_aio_queue(struct file *fp, struct kaiocb *job) if (error == 0) return (0); - switch (job->uaiocb.aio_lio_opcode) { + switch (job->uaiocb.aio_lio_opcode & (LIO_WRITE | LIO_READ)) { case LIO_READ: - case LIO_READV: sb = &so->so_rcv; break; case LIO_WRITE: - case LIO_WRITEV: sb = &so->so_snd; break; default: diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index bc0d7e04c9d5..9b45a06c5f9f 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -817,8 +817,7 @@ aio_process_rw(struct kaiocb *job) if (error != 0 && job->uiop->uio_resid != cnt) { if (error == ERESTART || error == EINTR || error == EWOULDBLOCK) error = 0; - if (error == EPIPE && - (opcode == LIO_WRITE || opcode == LIO_WRITEV)) { + if (error == EPIPE && (opcode & LIO_WRITE)) { PROC_LOCK(job->userproc); kern_psignal(job->userproc, SIGPIPE); PROC_UNLOCK(job->userproc); @@ -841,8 +840,7 @@ aio_process_sync(struct kaiocb *job) struct file *fp = job->fd_file; int error = 0; - KASSERT(job->uaiocb.aio_lio_opcode == LIO_SYNC || - job->uaiocb.aio_lio_opcode == LIO_DSYNC, + KASSERT(job->uaiocb.aio_lio_opcode & LIO_SYNC, ("%s: opcode %d", __func__, job->uaiocb.aio_lio_opcode)); td->td_ucred = job->cred; @@ -1239,8 +1237,7 @@ aio_qbio(struct proc *p, struct kaiocb *job) if (vp->v_bufobj.bo_bsize == 0) return (-1); - bio_cmd = opcode == LIO_WRITE || opcode == LIO_WRITEV ? BIO_WRITE : - BIO_READ; + bio_cmd = (opcode & LIO_WRITE) ? BIO_WRITE : BIO_READ; iovcnt = job->uiop->uio_iovcnt; if (iovcnt > max_buf_aio) return (-1); @@ -1422,7 +1419,7 @@ aiocb_copyin(struct aiocb *ujob, struct kaiocb *kjob, int type) error = copyin(ujob, kcb, sizeof(struct aiocb)); if (error) return (error); - if (type == LIO_READV || type == LIO_WRITEV) { + if (type & LIO_VECTORED) { /* malloc a uio and copy in the iovec */ error = copyinuio(__DEVOLATILE(struct iovec*, kcb->aio_iov), kcb->aio_iovcnt, &kjob->uiop); @@ -1609,7 +1606,7 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, struct aioliojob *lj, if (error) goto err3; - if ((opcode == LIO_SYNC || opcode == LIO_DSYNC) && fp->f_vnode == NULL) { + if ((opcode & LIO_SYNC) && fp->f_vnode == NULL) { error = EINVAL; goto err3; } @@ -1669,14 +1666,10 @@ no_kqueue: job->jobflags = KAIOCB_QUEUEING; job->lio = lj; - switch (opcode) { - case LIO_READV: - case LIO_WRITEV: + if (opcode & LIO_VECTORED) { /* Use the uio copied in by aio_copyin */ MPASS(job->uiop != &job->uio && job->uiop != NULL); - break; - case LIO_READ: - case LIO_WRITE: + } else { /* Setup the inline uio */ job->iov[0].iov_base = (void *)(uintptr_t)job->uaiocb.aio_buf; job->iov[0].iov_len = job->uaiocb.aio_nbytes; @@ -1684,18 +1677,13 @@ no_kqueue: job->uio.uio_iovcnt = 1; job->uio.uio_resid = job->uaiocb.aio_nbytes; job->uio.uio_segflg = UIO_USERSPACE; - /* FALLTHROUGH */ - default: job->uiop = &job->uio; - break; } - switch (opcode) { + switch (opcode & (LIO_READ | LIO_WRITE)) { case LIO_READ: - case LIO_READV: job->uiop->uio_rw = UIO_READ; break; case LIO_WRITE: - case LIO_WRITEV: job->uiop->uio_rw = UIO_WRITE; break; } @@ -1813,21 +1801,14 @@ aio_queue_file(struct file *fp, struct kaiocb *job) return (EOPNOTSUPP); } - switch (job->uaiocb.aio_lio_opcode) { - case LIO_READ: - case LIO_READV: - case LIO_WRITE: - case LIO_WRITEV: + if (job->uaiocb.aio_lio_opcode & (LIO_WRITE | LIO_READ)) { aio_schedule(job, aio_process_rw); error = 0; - break; - case LIO_SYNC: - case LIO_DSYNC: + } else if (job->uaiocb.aio_lio_opcode & LIO_SYNC) { AIO_LOCK(ki); TAILQ_FOREACH(job2, &ki->kaio_jobqueue, plist) { if (job2->fd_file == job->fd_file && - job2->uaiocb.aio_lio_opcode != LIO_SYNC && - job2->uaiocb.aio_lio_opcode != LIO_DSYNC && + ((job2->uaiocb.aio_lio_opcode & LIO_SYNC) == 0) && job2->seqno < job->seqno) { job2->jobflags |= KAIOCB_CHECKSYNC; job->pending++; @@ -1847,8 +1828,7 @@ aio_queue_file(struct file *fp, struct kaiocb *job) AIO_UNLOCK(ki); aio_schedule(job, aio_process_sync); error = 0; - break; - default: + } else { error = EINVAL; } return (error); @@ -2498,7 +2478,7 @@ aio_biowakeup(struct bio *bp) */ if (flags & BIO_ERROR) atomic_set_int(&job->error, bio_error); - if (opcode == LIO_WRITE || opcode == LIO_WRITEV) + if (opcode & LIO_WRITE) atomic_add_int(&job->outblock, nblks); else atomic_add_int(&job->inblock, nblks); @@ -2836,7 +2816,7 @@ aiocb32_copyin(struct aiocb *ujob, struct kaiocb *kjob, int type) CP(job32, *kcb, aio_fildes); CP(job32, *kcb, aio_offset); CP(job32, *kcb, aio_lio_opcode); - if (type == LIO_READV || type == LIO_WRITEV) { + if (type & LIO_VECTORED) { iov32 = PTRIN(job32.aio_iov); CP(job32, *kcb, aio_iovcnt); /* malloc a uio and copy in the iovec */ diff --git a/sys/sys/aio.h b/sys/sys/aio.h index ee928b8bf846..d3e03efa310e 100644 --- a/sys/sys/aio.h +++ b/sys/sys/aio.h @@ -44,11 +44,12 @@ #define LIO_WRITE 0x1 #define LIO_READ 0x2 #if defined(_KERNEL) || defined(_WANT_ALL_LIO_OPCODES) -#define LIO_SYNC 0x3 -#define LIO_MLOCK 0x4 -#define LIO_WRITEV 0x5 -#define LIO_READV 0x6 -#define LIO_DSYNC 0x7 +#define LIO_VECTORED 0x4 +#define LIO_WRITEV (LIO_WRITE | LIO_VECTORED) +#define LIO_READV (LIO_READ | LIO_VECTORED) +#define LIO_SYNC 0x8 +#define LIO_DSYNC (0x10 | LIO_SYNC) +#define LIO_MLOCK 0x20 #endif /* From owner-dev-commits-src-main@freebsd.org Wed Jan 20 17:16:00 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C8CB04FC916; Wed, 20 Jan 2021 17:16:00 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLXH457z7z3KKc; Wed, 20 Jan 2021 17:16:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A35D81CCF1; Wed, 20 Jan 2021 17:16:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KHG02G015560; Wed, 20 Jan 2021 17:16:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KHG0rJ015559; Wed, 20 Jan 2021 17:16:00 GMT (envelope-from git) Date: Wed, 20 Jan 2021 17:16:00 GMT Message-Id: <202101201716.10KHG0rJ015559@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: 5b0914aea27c - main - release: fix PORT variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5b0914aea27c8227b7d1f42d8a504f048cc3d2ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 17:16:00 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=5b0914aea27c8227b7d1f42d8a504f048cc3d2ec commit 5b0914aea27c8227b7d1f42d8a504f048cc3d2ec Author: Glen Barber AuthorDate: 2021-01-20 17:15:13 +0000 Commit: Glen Barber CommitDate: 2021-01-20 17:15:13 +0000 release: fix PORT variable Reported by: Yasuhiro Kimura (yasu xat utahime dot org) Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/release.sh b/release/release.sh index 60034f123490..fbd64bb8234d 100755 --- a/release/release.sh +++ b/release/release.sh @@ -147,7 +147,7 @@ env_check() { SRC="${GITROOT}${GITSRC}" DOC="${GITROOT}${GITDOC}" #PORT="${GITROOT}${GITPORTS}" - PORT="svn://svn.freebsd.org/ports/${PORTBRANCH}" + PORT="svn://svn.freebsd.org/ports/" if [ -n "${EMBEDDEDBUILD}" ]; then WITH_DVD= From owner-dev-commits-src-main@freebsd.org Wed Jan 20 17:16:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4A7384FC73A; Wed, 20 Jan 2021 17:16:49 +0000 (UTC) (envelope-from gjb@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLXJ11hvzz3Khh; Wed, 20 Jan 2021 17:16:49 +0000 (UTC) (envelope-from gjb@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1611163009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xXh9sEyUPKYqDWlujHww2OSSwS2sH3lbaHjFEBm6pLE=; b=FOxDj8GgByZBC5mnemGvlgbILGvIEE6vDUCXOryGJhsq2bgGkF1KI03zoVcoWIDpCEtn9N f12jAEFmWFqgGzT+4sHWdUioub8wjht0QyDc2cYAbsxwrB5/hgljoSGigSVDSDiG1uoG4q eccnc0Q0yBx1wsv/13vadn/nDSor27cooaLgy6Gge9sXNXx+I8yPleucyo15Qv5vZWa6dY 8eVHvxFSu3Cu+MvpvEUz2ajteONyFcWg0xI5zAZzsmeyyip5YdxIsZRrNe6B5XTbEKr2lD 6o/ywPVhpntntFczaCKru+/BwfJQuCRK9K967TlYP3EqgLlvFCaQx9DMqT4ZWw== Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id B6633A6EF; Wed, 20 Jan 2021 17:16:48 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Wed, 20 Jan 2021 17:16:46 +0000 From: Glen Barber To: Yasuhiro Kimura Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 041b28524a3c - main - release: Add workaround to use SVN for ports Message-ID: <20210120171646.GN77557@FreeBSD.org> References: <202101191838.10JIcorS044601@gitrepo.freebsd.org> <20210120.172933.1039050893851306070.yasu@utahime.org> <20210120.194646.2281393142538351130.yasu@utahime.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ucfHZChuBC0NsER/" Content-Disposition: inline In-Reply-To: <20210120.194646.2281393142538351130.yasu@utahime.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1611163009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xXh9sEyUPKYqDWlujHww2OSSwS2sH3lbaHjFEBm6pLE=; b=oa2yQNGcdVQWOYpUCPevAaYe4WWVyLoKTejPpUKmjWUFxY4zAX2OT+f5+G3Id9xNS7k5qL 5vvML+xUPfX6C37Er1r2beMWaEH5mskK1lgN4JWF0FrzDHM5KJ+C1hyGoR985i75yn5xw6 sC/CLQZ+Jd9jUQyVTBp2VrlCZo9JerR0mK3Rfu/xcvoHIjqNlcQS9WsbQ5fkCCLFywsJUo R3eD62jXuFNAuDwnL4tUQGNWP79eOJvFCcW2+wUHnx8u3aY4hyLv6yLIseAkPl9S6yJX25 vnBg99CeZ5a0qP1y2UGoNgeWhD+ne0b3H+4TkO25tcbuxsR9XgJe1uBxsRPSKA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1611163009; a=rsa-sha256; cv=none; b=bdYT9D5eJ9WdrzPdpRqeQvJ2458Qn40p5sohc/JXtrCt8v92evAMQRBBeH/Y4Ap/wp3WH5 dzlXEYjcTPlkEkUQOCG0529WMjYod5XhF4b4XnrlnZ/5NI2+2azcVPolfgmuLRTuV5PeD4 6HEVuEqrmh+6CXFmvzchOZDQrgg+TVckMWkOiAqkwt9qZy/ohetoJLWbaKmjrkQnSEJAKU j5cFH8z0n3thAXR3+lq0k3PLWQeBlQloSbs/KYa61X0aOWBdXex6S8dIMtdEXNUBc44ySM aNK38PAo+AjqDSqzSBMrqFjiNafr2E2Uglua6BFvYF/Sosl4ZPwJQvLu3yY47A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 17:16:49 -0000 --ucfHZChuBC0NsER/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 20, 2021 at 07:46:46PM +0900, Yasuhiro Kimura wrote: > From: Yasuhiro Kimura > Subject: Re: git: 041b28524a3c - main - release: Add workaround to use SV= N for ports > Date: Wed, 20 Jan 2021 17:29:33 +0900 (JST) >=20 > > From: Glen Barber > > Subject: git: 041b28524a3c - main - release: Add workaround to use SVN = for ports > > Date: Tue, 19 Jan 2021 18:38:50 GMT > >=20 > >> The branch main has been updated by gjb: > >>=20 > >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D041b28524a3c69ff6e89306= 7df156c3faabcac9a > >>=20 > >> commit 041b28524a3c69ff6e893067df156c3faabcac9a > >> Author: Glen Barber > >> AuthorDate: 2021-01-19 18:38:33 +0000 > >> Commit: Glen Barber > >> CommitDate: 2021-01-19 18:38:33 +0000 > >>=20 > >> release: Add workaround to use SVN for ports > >> =20 > >> The ports tree is scheduled to be converted from Subversion to Git > >> after the currently-scheduled 13.0-RELEASE, so the source of truth > >> will be Subversion for the ports tree. > >> =20 > >> Implement a hack specifically for this case. > >=20 > > This change results in accessing 'svn://svn.freebsd.org/ports/head/head' > > and failing to check out ports tree. >=20 > Following patch fixes the problem. >=20 > diff --git a/release/release.sh b/release/release.sh > index 60034f12349..fbd64bb8234 100755 > --- a/release/release.sh > +++ b/release/release.sh > @@ -147,7 +147,7 @@ env_check() { > SRC=3D"${GITROOT}${GITSRC}" > DOC=3D"${GITROOT}${GITDOC}" > #PORT=3D"${GITROOT}${GITPORTS}" > - PORT=3D"svn://svn.freebsd.org/ports/${PORTBRANCH}" > + PORT=3D"svn://svn.freebsd.org/ports/" > =20 > if [ -n "${EMBEDDEDBUILD}" ]; then > WITH_DVD=3D >=20 Thank you very much. Committed as 5b0914aea27. Sorry for the breakage. Glen --ucfHZChuBC0NsER/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAmAIZXkACgkQAxRYpUeP 4pOYGw//Ugp3yN4tEpEUS9aNe65mEt7WhfehlV7ZWCFLUdYB+LcHdUOb8W6HOHjG tOhCM3qq/CQHaHS7VDIaQPCKYV8GQsrXRkiAKr9BXZw9oIe6J7cPy31ydmiJ2BvM SGO6RDyzgp2qpW3/UKW1FHNHgrJytJeQOdMvLIOmD5olXLMfiNMXlXtlJIhUNphH +yynMBmz1Hy0fFOo5i01V8TwDksv2jim00XnHyHHbhvLkKi+GqEaOVtdRYe4Shw+ kcP+Zt5F26NHKAn05l6QX51YF0+9Jq227G5Fx4h7+CdDoD1lIz12D+0vC8zlWoz8 Ur5IjhWqGZ1YONrS+KfZQPejqhRdyKi7QNNMR+rUD7U0POHig+0TB6FPdJRu6ozO aQvvAvSMKoQkqsYeHWhDsVIH0dInN73S9/YN8sINKD+/wZaZ+30FBGroGvnhopVU GbFOeOnt8LXqkexiDcdCoylGLvOO5BId2cR9HhAxJYzbs3dv3qdHbt/zbQndCGV7 y1MMhYXG8KAVAkoCWdGmP61glsqALdaNVnYOhkVUR/CPMqKVBjteoTB0hH9GX4Hd l6nrKR5n4TJ+l45QszDa7+OgSDaQI9Mx0KxEFm9W3Ru4YR8ygfWN9mEXXcCwEwST gy4T0ALsTPrJlaKe5k8jFUHhddxf3O5GLfJn2dVWnJnGW8FVkvo= =X9P7 -----END PGP SIGNATURE----- --ucfHZChuBC0NsER/-- From owner-dev-commits-src-main@freebsd.org Wed Jan 20 17:47:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 EA65F4FD308; Wed, 20 Jan 2021 17:47:22 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLXzG6MPSz3MRj; Wed, 20 Jan 2021 17:47:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8EC71D4BC; Wed, 20 Jan 2021 17:47:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KHlM9U055102; Wed, 20 Jan 2021 17:47:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KHlM32055101; Wed, 20 Jan 2021 17:47:22 GMT (envelope-from git) Date: Wed, 20 Jan 2021 17:47:22 GMT Message-Id: <202101201747.10KHlM32055101@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 0614d7396798 - main - cat: style nits MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0614d7396798a268bd9efb103dffdeb0ad4a066c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 17:47:23 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=0614d7396798a268bd9efb103dffdeb0ad4a066c commit 0614d7396798a268bd9efb103dffdeb0ad4a066c Author: Mariusz Zaborski AuthorDate: 2021-01-20 17:46:26 +0000 Commit: Mariusz Zaborski CommitDate: 2021-01-20 17:46:26 +0000 cat: style nits Pointed out by: jhb --- bin/cat/cat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cat/cat.c b/bin/cat/cat.c index 764c97c7ad43..5a1fab0c26a0 100644 --- a/bin/cat/cat.c +++ b/bin/cat/cat.c @@ -428,7 +428,7 @@ udom_open(const char *path, int flags) { struct addrinfo hints, *res, *res0; char rpath[PATH_MAX]; - int fd, error, serrno; + int error, fd, serrno; cap_rights_t rights; /* From owner-dev-commits-src-main@freebsd.org Wed Jan 20 18:08:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4740A4FDE6E; Wed, 20 Jan 2021 18:08:49 +0000 (UTC) (envelope-from gbe@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLYS11fPVz3PT2; Wed, 20 Jan 2021 18:08:49 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d72fc8fc40f3276f59ff0075.dip0.t-ipconnect.de [IPv6:2003:d5:d72f:c8fc:40f3:276f:59ff:75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id C96658E33; Wed, 20 Jan 2021 18:08:48 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Wed, 20 Jan 2021 19:08:07 +0100 From: Gordon Bergling To: Baptiste Daroussin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 821aa63a0940 - main - ncurses: only keep the version with widechar support Message-ID: References: <202101051302.105D24lW041218@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202101051302.105D24lW041218@gitrepo.freebsd.org> X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 6:51PM up 7 days, 7:20, 4 users, load averages: 0.53, 0.46, 0.38 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 18:08:49 -0000 On Tue, Jan 05, 2021 at 01:02:04PM +0000, Baptiste Daroussin wrote: > The branch main has been updated by bapt: > > URL: https://cgit.FreeBSD.org/src/commit/?id=821aa63a09402935da0a73abf20ba0441562aa07 > > commit 821aa63a09402935da0a73abf20ba0441562aa07 > Author: Baptiste Daroussin > AuthorDate: 2021-01-04 16:29:40 +0000 > Commit: Baptiste Daroussin > CommitDate: 2021-01-05 13:01:32 +0000 > > ncurses: only keep the version with widechar support > > Only keep the widechar version of ncurses as libncursesw.so.9 > > Keep the old name to avoid breaking the ABI compatibility (the non > widechar version libncurses.so.9 is not binary compatible with > libncursesw.so.9) since all ports and base are already only linking > against the widechar version we can simply remove libncurses.so.9 > > Since the .9 version only lived in the dev branch and never ended in a > release, it is simply removed and not added to any binary compat > package. > > Add symlinks to keep build time compatibility for anyone linking against > -lncurses Hi Baptiste, thanks for the cleanup. It would be nice if you could send a HEADS UP to current@ before such changes. This change rendered my login shell on arm64 useless and it took me about 8 hours on a saturday to get the shell working againg, by using a FreeBSD livesystem, booted on my MacBook, while hurderling with pwd_mkdb(8). --Gordon From owner-dev-commits-src-main@freebsd.org Wed Jan 20 18:33:17 2021 Return-Path: Delivered-To: dev-commits-src-main@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 419C04FE966; Wed, 20 Jan 2021 18:33:17 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLZ0F1Q5Gz3Qsv; Wed, 20 Jan 2021 18:33:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22D5A1E218; Wed, 20 Jan 2021 18:33:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KIXHaC019299; Wed, 20 Jan 2021 18:33:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KIXHdV019298; Wed, 20 Jan 2021 18:33:17 GMT (envelope-from git) Date: Wed, 20 Jan 2021 18:33:17 GMT Message-Id: <202101201833.10KIXHdV019298@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: f6f0b849fb26 - main - Reuse the amd64 loader relocation code on arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6f0b849fb2683feebf2416a793964be0bd05cc5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 18:33:17 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f6f0b849fb2683feebf2416a793964be0bd05cc5 commit f6f0b849fb2683feebf2416a793964be0bd05cc5 Author: Andrew Turner AuthorDate: 2021-01-17 18:11:11 +0000 Commit: Andrew Turner CommitDate: 2021-01-20 17:59:38 +0000 Reuse the amd64 loader relocation code on arm64 There is no need to keep multiple copies of the relocation code. The amd64 code works on arm64 with a few small changes to relocation types. Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D28213 --- stand/common/reloc_elf.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/stand/common/reloc_elf.c b/stand/common/reloc_elf.c index 56b661dc21bd..262091b9f6c6 100644 --- a/stand/common/reloc_elf.c +++ b/stand/common/reloc_elf.c @@ -52,7 +52,8 @@ int __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata, int reltype, Elf_Addr relbase, Elf_Addr dataaddr, void *data, size_t len) { -#if (defined(__i386__) || defined(__amd64__)) && __ELF_WORD_SIZE == 64 +#if (defined(__aarch64__) || defined(__amd64__) || defined(__i386__)) && \ + __ELF_WORD_SIZE == 64 Elf64_Addr *where, val; Elf_Addr addend, addr; Elf_Size rtype, symidx; @@ -87,12 +88,29 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata, if (reltype == ELF_RELOC_REL) addend = *where; +#if defined(__aarch64__) +#define RELOC_RELATIVE R_AARCH64_RELATIVE +#define RELOC_IRELATIVE R_AARCH64_IRELATIVE +#elif defined(__amd64__) || defined(__i386__) /* XXX, definitions not available on i386. */ #define R_X86_64_64 1 #define R_X86_64_RELATIVE 8 #define R_X86_64_IRELATIVE 37 +#define RELOC_RELATIVE R_X86_64_RELATIVE +#define RELOC_IRELATIVE R_X86_64_IRELATIVE +#endif + switch (rtype) { + case RELOC_RELATIVE: + addr = (Elf_Addr)addend + relbase; + val = addr; + memcpy(where, &val, sizeof(val)); + break; + case RELOC_IRELATIVE: + /* leave it to kernel */ + break; +#if defined(__amd64__) || defined(__i386__) case R_X86_64_64: /* S + A */ addr = symaddr(ef, symidx); if (addr == 0) @@ -100,14 +118,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata, val = addr + addend; *where = val; break; - case R_X86_64_RELATIVE: - addr = (Elf_Addr)addend + relbase; - val = addr; - *where = val; - break; - case R_X86_64_IRELATIVE: - /* leave it to kernel */ - break; +#endif default: printf("\nunhandled relocation type %u\n", (u_int)rtype); return (EFTYPE); @@ -175,7 +186,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata, } return (0); -#elif defined(__aarch64__) || defined(__powerpc__) || defined(__riscv) +#elif defined(__powerpc__) || defined(__riscv) Elf_Size w; const Elf_Rela *rela; @@ -185,9 +196,7 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata, if (relbase + rela->r_offset >= dataaddr && relbase + rela->r_offset < dataaddr + len) { switch (ELF_R_TYPE(rela->r_info)) { -#if defined(__aarch64__) - case R_AARCH64_RELATIVE: -#elif defined(__powerpc__) +#if defined(__powerpc__) case R_PPC_RELATIVE: #elif defined(__riscv) case R_RISCV_RELATIVE: From owner-dev-commits-src-main@freebsd.org Wed Jan 20 18:33:18 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5C15B4FE858; Wed, 20 Jan 2021 18:33:18 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLZ0G2CwDz3R20; Wed, 20 Jan 2021 18:33:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EFE11E219; Wed, 20 Jan 2021 18:33:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KIXIWo019321; Wed, 20 Jan 2021 18:33:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KIXIt9019320; Wed, 20 Jan 2021 18:33:18 GMT (envelope-from git) Date: Wed, 20 Jan 2021 18:33:18 GMT Message-Id: <202101201833.10KIXIt9019320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 8e67b9389df1 - main - Handle arm64 undefied instructions on msr exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8e67b9389df12d36ef4bc6bf2a7f2e60e3bcd94a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 18:33:18 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=8e67b9389df12d36ef4bc6bf2a7f2e60e3bcd94a commit 8e67b9389df12d36ef4bc6bf2a7f2e60e3bcd94a Author: Andrew Turner AuthorDate: 2021-01-20 09:56:47 +0000 Commit: Andrew Turner CommitDate: 2021-01-20 17:59:38 +0000 Handle arm64 undefied instructions on msr exceptions When userspace tries to access a special register that it doesn't have access to the kernel receives an exception. On most cores this exception has been observed to be the undefined instruction exception, however on the Apple M1 under a QEMU based hypervisor it can be the MSR exception. Handle this second case by also running the undefined exception handler on these exceptions. Sponsored by: Innovate UK --- sys/arm64/arm64/trap.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 12d10ff1d261..0b2d4760cea3 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -535,8 +535,14 @@ do_el0_sync(struct thread *td, struct trapframe *frame) userret(td, frame); break; case EXCP_MSR: - call_trapsignal(td, SIGILL, ILL_PRVOPC, (void *)frame->tf_elr, - exception); + /* + * The CPU can raise EXCP_MSR when userspace executes an mrs + * instruction to access a special register userspace doesn't + * have access to. + */ + if (!undef_insn(0, frame)) + call_trapsignal(td, SIGILL, ILL_PRVOPC, + (void *)frame->tf_elr, exception); userret(td, frame); break; case EXCP_SOFTSTP_EL0: From owner-dev-commits-src-main@freebsd.org Wed Jan 20 20:10:43 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5979A4D8C48; Wed, 20 Jan 2021 20:10:43 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLc8g2814z3mXc; Wed, 20 Jan 2021 20:10:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C6D81F498; Wed, 20 Jan 2021 20:10:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KKAhPL045041; Wed, 20 Jan 2021 20:10:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KKAhAO045040; Wed, 20 Jan 2021 20:10:43 GMT (envelope-from git) Date: Wed, 20 Jan 2021 20:10:43 GMT Message-Id: <202101202010.10KKAhAO045040@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: fa656aefe43b - main - hconf(4): Do not fetch report before writing new usage values back. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fa656aefe43b91a06191d4a99e11876998a50c46 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 20:10:43 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=fa656aefe43b91a06191d4a99e11876998a50c46 commit fa656aefe43b91a06191d4a99e11876998a50c46 Author: Vladimir Kondratyev AuthorDate: 2021-01-20 20:10:06 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-20 20:10:06 +0000 hconf(4): Do not fetch report before writing new usage values back. There is a report that reading of surface/button switch feature report causes SYN1B7D touchpad malfunction. As specs does not require it to be readable assume that report usages have default value on attach and last written value during operation. Do not apply default usage values on attachment and resume. While here fix manpage typos and add avg@ to copyright header. Reported by: Jakob Alvermark Reviewed by: avg Differential revision: https://reviews.freebsd.org/D28196 --- share/man/man4/hconf.4 | 8 +++---- sys/dev/hid/hconf.c | 57 ++++++++++++++++++++++++-------------------------- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/share/man/man4/hconf.4 b/share/man/man4/hconf.4 index 4d595e9f1c6c..944f3376b187 100644 --- a/share/man/man4/hconf.4 +++ b/share/man/man4/hconf.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2020 +.Dd January 18, 2021 .Dt HCONF 4 .Os .Sh NAME @@ -61,11 +61,11 @@ Debug parameter is available as .Xr loader 8 tunable as well. .Bl -tag -width indent -.It Va dev.hmt.*.input_mode +.It Va dev.hconf.*.input_mode HID device input mode: 0 = mouse, 3 = touchpad. -.It Va dev.hmt.*.surface_switch +.It Va dev.hconf.*.surface_switch Enable / disable switch for surface: 1 = on, 0 = off. -.It Va dev.hmt.*.buttons_switch +.It Va dev.hconf.*.buttons_switch Enable / disable switch for buttons: 1 = on, 0 = off. .It Va hw.hid.hconf.debug Debug output level, where 0 is debugging disabled and larger values increase diff --git a/sys/dev/hid/hconf.c b/sys/dev/hid/hconf.c index 71650421ee33..cb0465e71b3e 100644 --- a/sys/dev/hid/hconf.c +++ b/sys/dev/hid/hconf.c @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2019 Vladimir Kondratyev + * Copyright (c) 2020 Andriy Gapon * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -69,21 +70,25 @@ struct feature_control_descr { const char *name; const char *descr; uint16_t usage; + u_int value; } feature_control_descrs[] = { [INPUT_MODE] = { .name = "input_mode", .descr = "HID device input mode: 0 = mouse, 3 = touchpad", - .usage = HUD_INPUT_MODE + .usage = HUD_INPUT_MODE, + .value = HCONF_INPUT_MODE_MOUSE, }, [SURFACE_SWITCH] = { .name = "surface_switch", .descr = "Enable / disable switch for surface: 1 = on, 0 = off", - .usage = HUD_SURFACE_SWITCH + .usage = HUD_SURFACE_SWITCH, + .value = 1, }, [BUTTONS_SWITCH] = { .name = "buttons_switch", .descr = "Enable / disable switch for buttons: 1 = on, 0 = off", - .usage = HUD_BUTTONS_SWITCH + .usage = HUD_BUTTONS_SWITCH, + .value = 1, }, }; @@ -145,35 +150,25 @@ hconf_set_feature_control(struct hconf_softc *sc, int ctrl_id, u_int val) fbuf = malloc(fc->rlen, M_TEMP, M_WAITOK | M_ZERO); sx_xlock(&sc->lock); - /* Reports are not strictly required to be readable */ - error = hid_get_report(sc->dev, fbuf, fc->rlen, NULL, - HID_FEATURE_REPORT, fc->rid); - /* - * If the report is write-only, then we have to check for other controls - * that may share the same report and set their bits as well. + * Assume the report is write-only. Then we have to check for other + * controls that may share the same report and set their bits as well. */ - if (error != 0) { - bzero(fbuf + 1, fc->rlen - 1); - for (i = 0; i < nitems(sc->feature_controls); i++) { - struct feature_control *ofc = &sc->feature_controls[i]; - - /* Skip unrelated report IDs. */ - if (ofc->rid != fc->rid) - continue; - /* Skip self. */ - if (ofc == fc) - continue; - KASSERT(fc->rlen == ofc->rlen, - ("different lengths for report %d: %d vs %d\n", - fc->rid, fc->rlen, ofc->rlen)); - hid_put_udata(fbuf + 1, ofc->rlen - 1, &ofc->loc, - ofc->val); - } + bzero(fbuf + 1, fc->rlen - 1); + for (i = 0; i < nitems(sc->feature_controls); i++) { + struct feature_control *ofc = &sc->feature_controls[i]; + + /* Skip unrelated report IDs. */ + if (ofc->rid != fc->rid) + continue; + KASSERT(fc->rlen == ofc->rlen, + ("different lengths for report %d: %d vs %d\n", + fc->rid, fc->rlen, ofc->rlen)); + hid_put_udata(fbuf + 1, ofc->rlen - 1, &ofc->loc, + i == ctrl_id ? val : ofc->val); } fbuf[0] = fc->rid; - hid_put_udata(fbuf + 1, fc->rlen - 1, &fc->loc, val); error = hid_set_report(sc->dev, fbuf, fc->rlen, HID_FEATURE_REPORT, fc->rid); @@ -277,11 +272,9 @@ hconf_attach(device_t dev) sc, i, hconf_feature_control_handler, "I", feature_control_descrs[i].descr); } + sc->feature_controls[i].val = feature_control_descrs[i].value; } - /* Fully enable (at least, try to). */ - (void)hconf_set_feature_control(sc, SURFACE_SWITCH, 1); - (void)hconf_set_feature_control(sc, BUTTONS_SWITCH, 1); return (0); } @@ -305,6 +298,10 @@ hconf_resume(device_t dev) for (i = 0; i < nitems(sc->feature_controls); i++) { if (sc->feature_controls[i].rlen < 2) continue; + /* Do not update usages to default value */ + if (sc->feature_controls[i].val == + feature_control_descrs[i].value) + continue; error = hconf_set_feature_control(sc, i, sc->feature_controls[i].val); if (error != 0) { From owner-dev-commits-src-main@freebsd.org Wed Jan 20 20:10:44 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9AB924D88DB; Wed, 20 Jan 2021 20:10:44 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLc8h3YrSz3mT2; Wed, 20 Jan 2021 20:10:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F6281F26D; Wed, 20 Jan 2021 20:10:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KKAidO045064; Wed, 20 Jan 2021 20:10:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KKAiA6045063; Wed, 20 Jan 2021 20:10:44 GMT (envelope-from git) Date: Wed, 20 Jan 2021 20:10:44 GMT Message-Id: <202101202010.10KKAiA6045063@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 3e954a8bc64e - main - hms: Workaround idle mouse drift in I2C sampling mode. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e954a8bc64ebc21893eedba0f2f1159c242c9b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 20:10:44 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=3e954a8bc64ebc21893eedba0f2f1159c242c9b6 commit 3e954a8bc64ebc21893eedba0f2f1159c242c9b6 Author: Vladimir Kondratyev AuthorDate: 2021-01-20 20:10:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-20 20:10:07 +0000 hms: Workaround idle mouse drift in I2C sampling mode. Many I2C "compatibility" mouse devices found on touchpads continue to return last report data in sampling mode after touch has been ended. That results in cursor drift. Filter out such a reports with comparing content of current report with content of previous one. Reported by: many Tested by: omatsuda, gllb (github.com) Obtained from: sysutils/iichid --- sys/dev/hid/hms.c | 71 +++++++++++++++++++++++++++++++++++++++++++- sys/modules/hid/hms/Makefile | 1 + 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/sys/dev/hid/hms.c b/sys/dev/hid/hms.c index 7f3455ff2725..94267b3fcd52 100644 --- a/sys/dev/hid/hms.c +++ b/sys/dev/hid/hms.c @@ -32,6 +32,8 @@ __FBSDID("$FreeBSD$"); * HID spec: https://www.usb.org/sites/default/files/documents/hid1_11.pdf */ +#include "opt_hid.h" + #include #include #include @@ -65,6 +67,9 @@ enum { }; static hidmap_cb_t hms_final_cb; +#ifdef IICHID_SAMPLING +static hid_intr_t hms_intr; +#endif #define HMS_MAP_BUT_RG(usage_from, usage_to, code) \ { HIDMAP_KEY_RANGE(HUP_BUTTON, usage_from, usage_to, code) } @@ -110,8 +115,46 @@ static const struct hid_device_id hms_devs[] = { struct hms_softc { struct hidmap hm; HIDMAP_CAPS(caps, hms_map); +#ifdef IICHID_SAMPLING + bool iichid_sampling; + void *last_ir; + hid_size_t last_irsize; + hid_size_t isize; + uint32_t drift_cnt; + uint32_t drift_thresh; +#endif }; +#ifdef IICHID_SAMPLING +static void +hms_intr(void *context, void *buf, hid_size_t len) +{ + struct hidmap *hm = context; + struct hms_softc *sc = device_get_softc(hm->dev); + + if (len > sc->isize) + len = sc->isize; + + /* + * Many I2C "compatibility" mouse devices found on touchpads continue + * to return last report data in sampling mode even after touch has + * been ended. That results in cursor drift. Filter out such a + * reports through comparing with previous one. + */ + if (len == sc->last_irsize && memcmp(buf, sc->last_ir, len) == 0) { + sc->drift_cnt++; + if (sc->drift_thresh != 0 && sc->drift_cnt >= sc->drift_thresh) + return; + } else { + sc->drift_cnt = 0; + sc->last_irsize = len; + bcopy(buf, sc->last_ir, len); + } + + hidmap_intr(context, buf, len); +} +#endif + static int hms_final_cb(HIDMAP_CB_ARGS) { @@ -124,6 +167,11 @@ hms_final_cb(HIDMAP_CB_ARGS) evdev_support_prop(evdev, INPUT_PROP_DIRECT); else evdev_support_prop(evdev, INPUT_PROP_POINTER); +#ifdef IICHID_SAMPLING + /* Overload interrupt handler to skip identical reports */ + if (sc->iichid_sampling) + hidbus_set_intr(sc->hm.dev, hms_intr, &sc->hm); +#endif } /* Do not execute callback at interrupt handler and detach */ @@ -212,6 +260,21 @@ hms_attach(device_t dev) else HIDMAP_ADD_MAP(&sc->hm, hms_map_wheel, cap_wheel); +#ifdef IICHID_SAMPLING + if (hid_test_quirk(hw, HQ_IICHID_SAMPLING) && + hidmap_test_cap(sc->caps, HMS_REL_X) && + hidmap_test_cap(sc->caps, HMS_REL_Y)) { + sc->iichid_sampling = true; + sc->isize = hid_report_size_max(d_ptr, d_len, hid_input, NULL); + sc->last_ir = malloc(sc->isize, M_DEVBUF, M_WAITOK | M_ZERO); + sc->drift_thresh = 2; + SYSCTL_ADD_U32(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "drift_thresh", CTLFLAG_RW, &sc->drift_thresh, 0, + "drift detection threshhold"); + } +#endif + error = hidmap_attach(&sc->hm); if (error) return (error); @@ -243,8 +306,14 @@ static int hms_detach(device_t dev) { struct hms_softc *sc = device_get_softc(dev); + int error; - return (hidmap_detach(&sc->hm)); + error = hidmap_detach(&sc->hm); +#ifdef IICHID_SAMPLING + if (error == 0) + free(sc->last_ir, M_DEVBUF); +#endif + return (error); } static devclass_t hms_devclass; diff --git a/sys/modules/hid/hms/Makefile b/sys/modules/hid/hms/Makefile index 71fbd2a77b89..29514b86385b 100644 --- a/sys/modules/hid/hms/Makefile +++ b/sys/modules/hid/hms/Makefile @@ -4,6 +4,7 @@ KMOD= hms SRCS= hms.c +SRCS+= opt_hid.h SRCS+= bus_if.h device_if.h .include From owner-dev-commits-src-main@freebsd.org Wed Jan 20 20:10:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C7B6A4D88DC; Wed, 20 Jan 2021 20:10:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLc8j4c71z3mHF; Wed, 20 Jan 2021 20:10:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 849381F511; Wed, 20 Jan 2021 20:10:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KKAjIF045086; Wed, 20 Jan 2021 20:10:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KKAjVN045085; Wed, 20 Jan 2021 20:10:45 GMT (envelope-from git) Date: Wed, 20 Jan 2021 20:10:45 GMT Message-Id: <202101202010.10KKAjVN045085@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 5cc21ab9949a - main - hmt: Allow I2C sampling mode support to be compiled out. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5cc21ab9949a189c809285823dbb6eadde6c6864 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 20:10:45 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=5cc21ab9949a189c809285823dbb6eadde6c6864 commit 5cc21ab9949a189c809285823dbb6eadde6c6864 Author: Vladimir Kondratyev AuthorDate: 2021-01-20 20:10:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-20 20:10:07 +0000 hmt: Allow I2C sampling mode support to be compiled out. --- sys/dev/hid/hmt.c | 10 ++++++++++ sys/modules/hid/hmt/Makefile | 1 + 2 files changed, 11 insertions(+) diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c index 6cfe43157e64..fd50ea4de829 100644 --- a/sys/dev/hid/hmt.c +++ b/sys/dev/hid/hmt.c @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); * https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt */ +#include "opt_hid.h" + #include #include #include @@ -207,7 +209,9 @@ struct hmt_softc { bool has_int_button; bool is_clickpad; bool do_timestamps; +#ifdef IICHID_SAMPLING bool iichid_sampling; +#endif struct hid_location cont_max_loc; uint32_t cont_max_rlen; @@ -372,8 +376,10 @@ hmt_attach(device_t dev) if (hid_test_quirk(hw, HQ_MT_TIMESTAMP) || hmt_timestamps) sc->do_timestamps = true; +#ifdef IICHID_SAMPLING if (hid_test_quirk(hw, HQ_IICHID_SAMPLING)) sc->iichid_sampling = true; +#endif hidbus_set_intr(dev, hmt_intr, sc); @@ -404,8 +410,10 @@ hmt_attach(device_t dev) evdev_support_event(sc->evdev, EV_MSC); evdev_support_msc(sc->evdev, MSC_TIMESTAMP); } +#ifdef IICHID_SAMPLING if (sc->iichid_sampling) evdev_set_flag(sc->evdev, EVDEV_FLAG_MT_AUTOREL); +#endif nbuttons = 0; if (sc->max_button != 0 || sc->has_int_button) { evdev_support_event(sc->evdev, EV_KEY); @@ -476,6 +484,7 @@ hmt_intr(void *context, void *buf, hid_size_t len) int32_t delta; uint8_t id; +#ifdef IICHID_SAMPLING /* * Special packet of zero length is generated by iichid driver running * in polling mode at the start of inactivity period to workaround @@ -492,6 +501,7 @@ hmt_intr(void *context, void *buf, hid_size_t len) evdev_sync(sc->evdev); return; } +#endif /* Ignore irrelevant reports */ id = sc->report_id != 0 ? *(uint8_t *)buf : 0; diff --git a/sys/modules/hid/hmt/Makefile b/sys/modules/hid/hmt/Makefile index f6bed08d439d..975c94fa0b88 100644 --- a/sys/modules/hid/hmt/Makefile +++ b/sys/modules/hid/hmt/Makefile @@ -4,6 +4,7 @@ KMOD= hmt SRCS= hmt.c +SRCS+= opt_hid.h SRCS+= bus_if.h device_if.h .include From owner-dev-commits-src-main@freebsd.org Wed Jan 20 20:10:48 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5AADE4D8A49; Wed, 20 Jan 2021 20:10:48 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLc8l4dl6z3mXs; Wed, 20 Jan 2021 20:10:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA6E31F513; Wed, 20 Jan 2021 20:10:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KKAk3U045104; Wed, 20 Jan 2021 20:10:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KKAklL045103; Wed, 20 Jan 2021 20:10:46 GMT (envelope-from git) Date: Wed, 20 Jan 2021 20:10:46 GMT Message-Id: <202101202010.10KKAklL045103@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 7a810290b8f6 - main - evdev: Make variable-size ioctls return actual length of copyouted data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a810290b8f6c6885fdb9917cf590d46fa270a61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 20:10:48 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=7a810290b8f6c6885fdb9917cf590d46fa270a61 commit 7a810290b8f6c6885fdb9917cf590d46fa270a61 Author: Vladimir Kondratyev AuthorDate: 2021-01-20 20:10:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-20 20:10:07 +0000 evdev: Make variable-size ioctls return actual length of copyouted data on success instead of 0 to match Linux. Imprivata binary depends on this. Submitted by: Shunchao Hu Reviewed by: wulf Differential revision: https://reviews.freebsd.org/D28218 --- sys/dev/evdev/cdev.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/sys/dev/evdev/cdev.c b/sys/dev/evdev/cdev.c index 91536c119fb4..66d00ad16aee 100644 --- a/sys/dev/evdev/cdev.c +++ b/sys/dev/evdev/cdev.c @@ -78,7 +78,8 @@ static d_kqfilter_t evdev_kqfilter; static int evdev_kqread(struct knote *kn, long hint); static void evdev_kqdetach(struct knote *kn); static void evdev_dtor(void *); -static int evdev_ioctl_eviocgbit(struct evdev_dev *, int, int, caddr_t); +static int evdev_ioctl_eviocgbit(struct evdev_dev *, int, int, caddr_t, + struct thread *); static void evdev_client_filter_queue(struct evdev_client *, uint16_t); static struct cdevsw evdev_cdevsw = { @@ -576,29 +577,38 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, /* evdev variable-length ioctls handling */ switch (IOCBASECMD(cmd)) { case EVIOCGNAME(0): - strlcpy(data, evdev->ev_name, len); + /* Linux evdev does not terminate truncated strings with 0 */ + limit = MIN(strlen(evdev->ev_name) + 1, len); + memcpy(data, evdev->ev_name, limit); + td->td_retval[0] = limit; return (0); case EVIOCGPHYS(0): if (evdev->ev_shortname[0] == 0) return (ENOENT); - strlcpy(data, evdev->ev_shortname, len); + limit = MIN(strlen(evdev->ev_shortname) + 1, len); + memcpy(data, evdev->ev_shortname, limit); + td->td_retval[0] = limit; return (0); case EVIOCGUNIQ(0): if (evdev->ev_serial[0] == 0) return (ENOENT); - strlcpy(data, evdev->ev_serial, len); + limit = MIN(strlen(evdev->ev_serial) + 1, len); + memcpy(data, evdev->ev_serial, limit); + td->td_retval[0] = limit; return (0); case EVIOCGPROP(0): limit = MIN(len, bitstr_size(INPUT_PROP_CNT)); memcpy(data, evdev->ev_prop_flags, limit); + td->td_retval[0] = limit; return (0); case EVIOCGMTSLOTS(0): + /* EVIOCGMTSLOTS always returns 0 on success */ if (evdev->ev_mt == NULL) return (EINVAL); if (len < sizeof(uint32_t)) @@ -620,6 +630,7 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, evdev_client_filter_queue(client, EV_KEY); memcpy(data, evdev->ev_key_states, limit); EVDEV_UNLOCK(evdev); + td->td_retval[0] = limit; return (0); case EVIOCGLED(0): @@ -628,6 +639,7 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, evdev_client_filter_queue(client, EV_LED); memcpy(data, evdev->ev_led_states, limit); EVDEV_UNLOCK(evdev); + td->td_retval[0] = limit; return (0); case EVIOCGSND(0): @@ -636,6 +648,7 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, evdev_client_filter_queue(client, EV_SND); memcpy(data, evdev->ev_snd_states, limit); EVDEV_UNLOCK(evdev); + td->td_retval[0] = limit; return (0); case EVIOCGSW(0): @@ -644,20 +657,22 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, evdev_client_filter_queue(client, EV_SW); memcpy(data, evdev->ev_sw_states, limit); EVDEV_UNLOCK(evdev); + td->td_retval[0] = limit; return (0); case EVIOCGBIT(0, 0) ... EVIOCGBIT(EV_MAX, 0): type_num = IOCBASECMD(cmd) - EVIOCGBIT(0, 0); debugf(client, "EVIOCGBIT(%d): data=%p, len=%d", type_num, data, len); - return (evdev_ioctl_eviocgbit(evdev, type_num, len, data)); + return (evdev_ioctl_eviocgbit(evdev, type_num, len, data, td)); } return (EINVAL); } static int -evdev_ioctl_eviocgbit(struct evdev_dev *evdev, int type, int len, caddr_t data) +evdev_ioctl_eviocgbit(struct evdev_dev *evdev, int type, int len, caddr_t data, + struct thread *td) { unsigned long *bitmap; int limit; @@ -701,6 +716,7 @@ evdev_ioctl_eviocgbit(struct evdev_dev *evdev, int type, int len, caddr_t data) * just fake it returning only zeros. */ bzero(data, len); + td->td_retval[0] = len; return (0); default: return (ENOTTY); @@ -715,6 +731,7 @@ evdev_ioctl_eviocgbit(struct evdev_dev *evdev, int type, int len, caddr_t data) limit = bitstr_size(limit); len = MIN(limit, len); memcpy(data, bitmap, len); + td->td_retval[0] = len; return (0); } From owner-dev-commits-src-main@freebsd.org Wed Jan 20 22:00:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 16DFF4DB2B4; Wed, 20 Jan 2021 22:00:38 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLfbV0BvCz3tnR; Wed, 20 Jan 2021 22:00:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDCBA20B8C; Wed, 20 Jan 2021 22:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KM0bpP088075; Wed, 20 Jan 2021 22:00:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KM0bwX088074; Wed, 20 Jan 2021 22:00:37 GMT (envelope-from git) Date: Wed, 20 Jan 2021 22:00:37 GMT Message-Id: <202101202200.10KM0bwX088074@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: 84ab9074d4c1 - main - pms: quiet -Wunused-variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 84ab9074d4c17203977205b1fb33ed70723e4f89 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 22:00:38 -0000 The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=84ab9074d4c17203977205b1fb33ed70723e4f89 commit 84ab9074d4c17203977205b1fb33ed70723e4f89 Author: Ryan Libby AuthorDate: 2021-01-20 21:59:49 +0000 Commit: Ryan Libby CommitDate: 2021-01-20 21:59:49 +0000 pms: quiet -Wunused-variable Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27994 --- sys/dev/pms/freebsd/driver/common/lxcommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/pms/freebsd/driver/common/lxcommon.h b/sys/dev/pms/freebsd/driver/common/lxcommon.h index 71ce230c3812..bbe33cf1fef7 100644 --- a/sys/dev/pms/freebsd/driver/common/lxcommon.h +++ b/sys/dev/pms/freebsd/driver/common/lxcommon.h @@ -313,7 +313,7 @@ ag_card_id_t ag_card_type[] = { #endif //AGTIAPI_SA }; -static const char *ag_card_names[] = { +static char const * const ag_card_names[] = { "Unknown", "iSCSI DiXL Card", "iSCSI iDX1 Card", From owner-dev-commits-src-main@freebsd.org Wed Jan 20 22:00:39 2021 Return-Path: Delivered-To: dev-commits-src-main@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 39B0E4DB151; Wed, 20 Jan 2021 22:00:39 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLfbW1C1vz3tL4; Wed, 20 Jan 2021 22:00:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A3AF209B3; Wed, 20 Jan 2021 22:00:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KM0dir088098; Wed, 20 Jan 2021 22:00:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KM0dDU088097; Wed, 20 Jan 2021 22:00:39 GMT (envelope-from git) Date: Wed, 20 Jan 2021 22:00:39 GMT Message-Id: <202101202200.10KM0dDU088097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: e54a1d575180 - main - pms: handle maximum size IO with any alignment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e54a1d5751805714bf6ea5e2e99887388110f9f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 22:00:39 -0000 The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=e54a1d5751805714bf6ea5e2e99887388110f9f0 commit e54a1d5751805714bf6ea5e2e99887388110f9f0 Author: Ryan Libby AuthorDate: 2021-01-20 21:59:49 +0000 Commit: Ryan Libby CommitDate: 2021-01-20 21:59:49 +0000 pms: handle maximum size IO with any alignment Define the maximum numbers of segments to allow for non-page alignment at the beginning and end of a maxphys size transfer. Also set ccb_pathinq.maxio consistent with maxphys. Reviewed by: imp Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D28043 --- sys/dev/pms/freebsd/driver/ini/src/agdef.h | 2 +- sys/dev/pms/freebsd/driver/ini/src/agtiapi.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/pms/freebsd/driver/ini/src/agdef.h b/sys/dev/pms/freebsd/driver/ini/src/agdef.h index cabcafc1819c..4c2ba2867f5f 100644 --- a/sys/dev/pms/freebsd/driver/ini/src/agdef.h +++ b/sys/dev/pms/freebsd/driver/ini/src/agdef.h @@ -62,7 +62,7 @@ EW 09-17-2004 1.0.0 Constant definitions #define AGTIAPI_MAX_DEVICE_7H 256 /*Max devices per channel in 7H */ #define AGTIAPI_MAX_DEVICE_8H 512 /*Max devices per channel in 8H*/ #define AGTIAPI_MAX_CAM_Q_DEPTH 1024 -#define AGTIAPI_NSEGS (maxphys / PAGE_SIZE) +#define AGTIAPI_NSEGS (btoc(maxphys) + 1) /* ** Adapter specific defines */ diff --git a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c index 7738e1216907..69f488c4199b 100644 --- a/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c +++ b/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c @@ -1833,7 +1833,8 @@ static void agtiapi_cam_action( struct cam_sim *sim, union ccb * ccb ) cpi->hba_eng_cnt = 0; cpi->max_target = maxTargets - 1; cpi->max_lun = AGTIAPI_MAX_LUN; - cpi->maxio = 1024 *1024; /* Max supported I/O size, in bytes. */ + /* Max supported I/O size, in bytes. */ + cpi->maxio = ulmin(1024 * 1024, maxphys); cpi->initiator_id = 255; strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strlcpy(cpi->hba_vid, "PMC", HBA_IDLEN); From owner-dev-commits-src-main@freebsd.org Wed Jan 20 23:07:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9EAA24DC8B2; Wed, 20 Jan 2021 23:07:02 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLh4646MZz4S2t; Wed, 20 Jan 2021 23:07:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C28D212F0; Wed, 20 Jan 2021 23:07:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KN72ra071146; Wed, 20 Jan 2021 23:07:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KN7209071145; Wed, 20 Jan 2021 23:07:02 GMT (envelope-from git) Date: Wed, 20 Jan 2021 23:07:02 GMT Message-Id: <202101202307.10KN7209071145@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: e3dd8ed77b4e - main - devinfo sysctl handler: Do not write zero-length strings in to sbuf twice MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3dd8ed77b4e7d8fda12ec80b91d89e8460b64f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 23:07:02 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=e3dd8ed77b4e7d8fda12ec80b91d89e8460b64f8 commit e3dd8ed77b4e7d8fda12ec80b91d89e8460b64f8 Author: Vladimir Kondratyev AuthorDate: 2021-01-20 23:06:16 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-20 23:06:16 +0000 devinfo sysctl handler: Do not write zero-length strings in to sbuf twice This fixes missing PnPinfo and location strings in devinfo(8) output for devices with no attached drivers. --- sys/kern/subr_bus.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 78d07796659c..ecd6c9685e36 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -5528,18 +5528,12 @@ sysctl_devices(SYSCTL_HANDLER_ARGS) sbuf_new(&sb, udev->dv_fields, sizeof(udev->dv_fields), SBUF_FIXEDLEN); if (dev->nameunit != NULL) sbuf_cat(&sb, dev->nameunit); - else - sbuf_putc(&sb, '\0'); sbuf_putc(&sb, '\0'); if (dev->desc != NULL) sbuf_cat(&sb, dev->desc); - else - sbuf_putc(&sb, '\0'); sbuf_putc(&sb, '\0'); if (dev->driver != NULL) sbuf_cat(&sb, dev->driver->name); - else - sbuf_putc(&sb, '\0'); sbuf_putc(&sb, '\0'); bus_child_pnpinfo_sb(dev, &sb); sbuf_putc(&sb, '\0'); From owner-dev-commits-src-main@freebsd.org Wed Jan 20 23:08:43 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9B9EB4DCC0F; Wed, 20 Jan 2021 23:08:43 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLh633ytSz4RsW; Wed, 20 Jan 2021 23:08:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B14C217C4; Wed, 20 Jan 2021 23:08:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10KN8h0p071501; Wed, 20 Jan 2021 23:08:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10KN8h7a071500; Wed, 20 Jan 2021 23:08:43 GMT (envelope-from git) Date: Wed, 20 Jan 2021 23:08:43 GMT Message-Id: <202101202308.10KN8h7a071500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 6754ae2572eb - main - jail: Use refcount(9) for prison references. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6754ae2572eb20dbc23d2452b5e8fe4e07125f93 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2021 23:08:43 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=6754ae2572eb20dbc23d2452b5e8fe4e07125f93 commit 6754ae2572eb20dbc23d2452b5e8fe4e07125f93 Author: Jamie Gritton AuthorDate: 2021-01-20 23:08:27 +0000 Commit: Jamie Gritton CommitDate: 2021-01-20 23:08:27 +0000 jail: Use refcount(9) for prison references. Use refcount(9) for both pr_ref and pr_uref in struct prison. This allows prisons to held and freed without requiring the prison mutex. An exception to this is that dropping the last reference will still lock the prison, to keep the guarantee that a locked prison remains valid and alive (provided it was at the time it was locked). Among other things, this honors the promise made in a comment in crcopy(9), that it will not block, which hasn't been true for two decades. --- sys/kern/kern_jail.c | 145 ++++++++++++++++++++++++++++++--------------------- sys/sys/jail.h | 9 ++-- 2 files changed, 91 insertions(+), 63 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 757b8bd06b89..e869bafc96b8 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1116,7 +1116,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) name_again: deadpr = NULL; FOREACH_PRISON_CHILD(ppr, tpr) { - if (tpr != pr && tpr->pr_ref > 0 && + if (tpr != pr && !strcmp(tpr->pr_name + pnamelen, namelc)) { mtx_lock(&tpr->pr_mtx); if (prison_isalive(tpr)) { @@ -1199,8 +1199,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) prison_name(mypr, ppr)); goto done_deref; } - ppr->pr_ref++; - ppr->pr_uref++; + prison_hold(ppr); + refcount_acquire(&ppr->pr_uref); mtx_unlock(&ppr->pr_mtx); if (jid == 0 && (jid = get_next_prid(&inspr)) == 0) { @@ -1315,7 +1315,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * Grab a reference for existing prisons, to ensure they * continue to exist for the duration of the call. */ - pr->pr_ref++; + prison_hold(pr); drflags |= PD_DEREF; #if defined(VIMAGE) && (defined(INET) || defined(INET6)) if ((pr->pr_flags & PR_VNET) && @@ -1434,7 +1434,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #ifdef VIMAGE (tpr != tppr && (tpr->pr_flags & PR_VNET)) || #endif - tpr->pr_uref == 0) { + refcount_load(&tpr->pr_uref) == 0) { descend = 0; continue; } @@ -1502,7 +1502,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #ifdef VIMAGE (tpr != tppr && (tpr->pr_flags & PR_VNET)) || #endif - tpr->pr_uref == 0) { + refcount_load(&tpr->pr_uref) == 0) { descend = 0; continue; } @@ -1738,11 +1738,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) born = !prison_isalive(pr); if (!created && (ch_flags & PR_PERSIST & (pr_flags ^ pr->pr_flags))) { if (pr_flags & PR_PERSIST) { - pr->pr_ref++; - pr->pr_uref++; + prison_hold(pr); + refcount_acquire(&pr->pr_uref); } else { - pr->pr_ref--; - pr->pr_uref--; + refcount_release(&pr->pr_uref); + refcount_release(&pr->pr_ref); } } pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; @@ -1857,8 +1857,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) if (pr_flags & PR_PERSIST) { mtx_lock(&pr->pr_mtx); drflags |= PD_LOCKED; - pr->pr_ref++; - pr->pr_uref++; + refcount_acquire(&pr->pr_ref); + refcount_acquire(&pr->pr_uref); } else { /* Non-persistent jails need no further changes. */ pr = NULL; @@ -1933,7 +1933,8 @@ get_next_prid(struct prison **insprp) TAILQ_FOREACH(inspr, &allprison, pr_list) { if (inspr->pr_id < jid) continue; - if (inspr->pr_id > jid || inspr->pr_ref == 0) { + if (inspr->pr_id > jid || + refcount_load(&inspr->pr_ref) == 0) { /* * Found an opening. This may be a gap * in the list, or a dead jail with the @@ -2096,7 +2097,7 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) found_prison: /* Get the parameters of the prison. */ - pr->pr_ref++; + prison_hold(pr); drflags |= PD_DEREF; td->td_retval[0] = pr->pr_id; error = vfs_setopt(opts, "jid", &pr->pr_id, sizeof(pr->pr_id)); @@ -2309,7 +2310,7 @@ sys_jail_remove(struct thread *td, struct jail_remove_args *uap) } /* Remove all descendants of this prison, then remove this prison. */ - pr->pr_ref++; + prison_hold(pr); if (!LIST_EMPTY(&pr->pr_children)) { mtx_unlock(&pr->pr_mtx); lpr = NULL; @@ -2317,7 +2318,7 @@ sys_jail_remove(struct thread *td, struct jail_remove_args *uap) mtx_lock(&cpr->pr_mtx); if (prison_isvalid(cpr)) { tpr = cpr; - cpr->pr_ref++; + prison_hold(cpr); } else { /* Already removed - do not do it again. */ tpr = NULL; @@ -2351,18 +2352,19 @@ prison_remove_one(struct prison *pr) /* If the prison was persistent, it is not anymore. */ if (pr->pr_flags & PR_PERSIST) { - pr->pr_ref--; + refcount_release(&pr->pr_ref); drflags |= PD_DEUREF; pr->pr_flags &= ~PR_PERSIST; } /* * jail_remove added a reference. If that's the only one, remove - * the prison now. + * the prison now. refcount(9) doesn't guarantee the cache coherence + * of non-zero counters, so force it here. */ - KASSERT(pr->pr_ref > 0, + KASSERT(refcount_load(&pr->pr_ref) > 0, ("prison_remove_one removing a dead prison (jid=%d)", pr->pr_id)); - if (pr->pr_ref == 1) { + if (atomic_load_acq_int(&pr->pr_ref) == 1) { prison_deref(pr, drflags); return; } @@ -2440,8 +2442,8 @@ do_jail_attach(struct thread *td, struct prison *pr) * a process root from one prison, but attached to the jail * of another. */ - pr->pr_ref++; - pr->pr_uref++; + refcount_acquire(&pr->pr_ref); + refcount_acquire(&pr->pr_uref); mtx_unlock(&pr->pr_mtx); /* Let modules do whatever they need to prepare for attaching. */ @@ -2614,19 +2616,21 @@ void prison_hold_locked(struct prison *pr) { - mtx_assert(&pr->pr_mtx, MA_OWNED); - KASSERT(pr->pr_ref > 0, - ("Trying to hold dead prison %p (jid=%d).", pr, pr->pr_id)); - pr->pr_ref++; + /* Locking is no longer required. */ + prison_hold(pr); } void prison_hold(struct prison *pr) { +#ifdef INVARIANTS + int was_valid = refcount_acquire_if_not_zero(&pr->pr_ref); - mtx_lock(&pr->pr_mtx); - prison_hold_locked(pr); - mtx_unlock(&pr->pr_mtx); + KASSERT(was_valid, + ("Trying to hold dead prison %p (jid=%d).", pr, pr->pr_id)); +#else + refcount_acquire(&pr->pr_ref); +#endif } /* @@ -2637,14 +2641,17 @@ prison_hold(struct prison *pr) void prison_free_locked(struct prison *pr) { - int ref; + int lastref; mtx_assert(&pr->pr_mtx, MA_OWNED); - ref = --pr->pr_ref; + KASSERT(refcount_load(&pr->pr_ref) > 0, + ("Trying to free dead prison %p (jid=%d).", + pr, pr->pr_id)); + lastref = refcount_release(&pr->pr_ref); mtx_unlock(&pr->pr_mtx); - if (ref == 0) { + if (lastref) { /* - * Don't remove the last reference in this context, + * Don't remove the prison itself in this context, * in case there are locks held. */ taskqueue_enqueue(taskqueue_thread, &pr->pr_task); @@ -2655,6 +2662,16 @@ void prison_free(struct prison *pr) { + /* + * Locking is only required when releasing the last reference. + * This allows assurance that a locked prison will remain valid + * until it is unlocked. + */ + KASSERT(refcount_load(&pr->pr_ref) > 0, + ("Trying to free dead prison %p (jid=%d).", + pr, pr->pr_id)); + if (refcount_release_if_not_last(&pr->pr_ref)) + return; mtx_lock(&pr->pr_mtx); prison_free_locked(pr); } @@ -2670,12 +2687,14 @@ prison_free(struct prison *pr) void prison_proc_hold(struct prison *pr) { +#ifdef INVARIANTS + int was_alive = refcount_acquire_if_not_zero(&pr->pr_uref); - mtx_lock(&pr->pr_mtx); - KASSERT(pr->pr_uref > 0, + KASSERT(was_alive, ("Cannot add a process to a non-alive prison (jid=%d)", pr->pr_id)); - pr->pr_uref++; - mtx_unlock(&pr->pr_mtx); +#else + refcount_acquire(&pr->pr_uref); +#endif } /* @@ -2686,20 +2705,27 @@ prison_proc_hold(struct prison *pr) void prison_proc_free(struct prison *pr) { + int lasturef; - mtx_lock(&pr->pr_mtx); - KASSERT(pr->pr_uref > 0, + /* + * Locking is only required when releasing the last reference. + * This allows assurance that a locked prison will remain alive + * until it is unlocked. + */ + KASSERT(refcount_load(&pr->pr_uref) > 0, ("Trying to kill a process in a dead prison (jid=%d)", pr->pr_id)); - if (pr->pr_uref > 1) - pr->pr_uref--; - else { + if (refcount_release_if_not_last(&pr->pr_uref)) + return; + mtx_lock(&pr->pr_mtx); + lasturef = refcount_release(&pr->pr_uref); + if (lasturef) { /* * Don't remove the last user reference in this context, * which is expected to be a process that is not only locked, * but also half dead. Add a reference so any calls to * prison_free() won't re-submit the task. */ - pr->pr_ref++; + refcount_acquire(&pr->pr_ref); mtx_unlock(&pr->pr_mtx); taskqueue_enqueue(taskqueue_thread, &pr->pr_task); return; @@ -2723,7 +2749,7 @@ prison_complete(void *context, int pending) * was added. No references are expected if this is completing a call * to prison_free, but prison_deref is still called for the cleanup. */ - prison_deref(pr, pr->pr_uref > 0 + prison_deref(pr, refcount_load(&pr->pr_uref) > 0 ? PD_DEREF | PD_DEUREF | PD_LOCKED | PD_LIST_XLOCKED : PD_LOCKED | PD_LIST_XLOCKED); } @@ -2740,29 +2766,30 @@ static void prison_deref(struct prison *pr, int flags) { struct prison *ppr, *tpr; - int ref, lasturef; + int lastref, lasturef; if (!(flags & PD_LOCKED)) mtx_lock(&pr->pr_mtx); for (;;) { if (flags & PD_DEUREF) { - KASSERT(pr->pr_uref > 0, + KASSERT(refcount_load(&pr->pr_uref) > 0, ("prison_deref PD_DEUREF on a dead prison (jid=%d)", pr->pr_id)); - pr->pr_uref--; - lasturef = pr->pr_uref == 0; + lasturef = refcount_release(&pr->pr_uref); if (lasturef) - pr->pr_ref++; - KASSERT(prison0.pr_uref != 0, ("prison0 pr_uref=0")); + refcount_acquire(&pr->pr_ref); + KASSERT(refcount_load(&prison0.pr_uref) > 0, + ("prison0 pr_uref=0")); } else lasturef = 0; if (flags & PD_DEREF) { - KASSERT(pr->pr_ref > 0, + KASSERT(refcount_load(&pr->pr_ref) > 0, ("prison_deref PD_DEREF on a dead prison (jid=%d)", pr->pr_id)); - pr->pr_ref--; + lastref = refcount_release(&pr->pr_ref); } - ref = pr->pr_ref; + else + lastref = refcount_load(&pr->pr_ref) == 0; mtx_unlock(&pr->pr_mtx); /* @@ -2771,7 +2798,7 @@ prison_deref(struct prison *pr, int flags) */ if (lasturef) { if (!(flags & (PD_LIST_SLOCKED | PD_LIST_XLOCKED))) { - if (ref > 1) { + if (atomic_load_acq_int(&pr->pr_ref) > 1) { sx_slock(&allprison_lock); flags |= PD_LIST_SLOCKED; } else { @@ -2781,12 +2808,12 @@ prison_deref(struct prison *pr, int flags) } (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); mtx_lock(&pr->pr_mtx); - ref = --pr->pr_ref; + lastref = refcount_release(&pr->pr_ref); mtx_unlock(&pr->pr_mtx); } /* If the prison still has references, nothing else to do. */ - if (ref > 0) { + if (!lastref) { if (flags & PD_LIST_SLOCKED) sx_sunlock(&allprison_lock); else if (flags & PD_LIST_XLOCKED) @@ -3008,9 +3035,9 @@ prison_isalive(struct prison *pr) { mtx_assert(&pr->pr_mtx, MA_OWNED); - if (__predict_false(pr->pr_ref == 0)) + if (__predict_false(refcount_load(&pr->pr_ref) == 0)) return (false); - if (__predict_false(pr->pr_uref == 0)) + if (__predict_false(refcount_load(&pr->pr_uref) == 0)) return (false); return (true); } @@ -3025,7 +3052,7 @@ prison_isvalid(struct prison *pr) { mtx_assert(&pr->pr_mtx, MA_OWNED); - if (__predict_false(pr->pr_ref == 0)) + if (__predict_false(refcount_load(&pr->pr_ref) == 0)) return (false); return (true); } diff --git a/sys/sys/jail.h b/sys/sys/jail.h index 67ef9347d093..2d1a26787b99 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -150,17 +150,18 @@ struct prison_racct; * * Lock key: * (a) allprison_lock + * (c) set only during creation before the structure is shared, no mutex + * required to read * (m) locked by pr_mtx * (p) locked by pr_mtx, and also at least shared allprison_lock required * to update - * (c) set only during creation before the structure is shared, no mutex - * required to read + * (r) atomic via refcount(9), pr_mtx required to decrement to zero */ struct prison { TAILQ_ENTRY(prison) pr_list; /* (a) all prisons */ int pr_id; /* (c) prison id */ - int pr_ref; /* (m) refcount */ - int pr_uref; /* (m) user (alive) refcount */ + volatile u_int pr_ref; /* (r) refcount */ + volatile u_int pr_uref; /* (r) user (alive) refcount */ unsigned pr_flags; /* (p) PR_* flags */ LIST_HEAD(, prison) pr_children; /* (a) list of child jails */ LIST_ENTRY(prison) pr_sibling; /* (a) next in parent's list */ From owner-dev-commits-src-main@freebsd.org Thu Jan 21 00:35:15 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2213A4DEB87; Thu, 21 Jan 2021 00:35:15 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLk1t74DSz4WGk; Thu, 21 Jan 2021 00:35:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E588B22924; Thu, 21 Jan 2021 00:35:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L0ZELf087390; Thu, 21 Jan 2021 00:35:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L0ZEMi087389; Thu, 21 Jan 2021 00:35:14 GMT (envelope-from git) Date: Thu, 21 Jan 2021 00:35:14 GMT Message-Id: <202101210035.10L0ZEMi087389@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d86d3194955c - main - Simplify dynamic ipfilter sysctls. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d86d3194955c3063baeed27de4bc84dfe7a7187d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 00:35:15 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d86d3194955c3063baeed27de4bc84dfe7a7187d commit d86d3194955c3063baeed27de4bc84dfe7a7187d Author: John Baldwin AuthorDate: 2021-01-21 00:33:34 +0000 Commit: John Baldwin CommitDate: 2021-01-21 00:34:25 +0000 Simplify dynamic ipfilter sysctls. Pass the structure offset in arg2 instead of arg1. This avoids having to undo the pointer arithmetic on arg1. Instead arg2 can be used directly as an offset relative to the desired structure. Reviewed by: cy Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27961 --- sys/contrib/ipfilter/netinet/mlfk_ipl.c | 86 ++++++++++++--------------------- 1 file changed, 30 insertions(+), 56 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/mlfk_ipl.c b/sys/contrib/ipfilter/netinet/mlfk_ipl.c index e593eafd500f..f6f6d2ce6d64 100644 --- a/sys/contrib/ipfilter/netinet/mlfk_ipl.c +++ b/sys/contrib/ipfilter/netinet/mlfk_ipl.c @@ -367,77 +367,51 @@ sysctl_error: } /* - * In the VIMAGE case kern_sysctl.c already adds the vnet base address given - * we set CTLFLAG_VNET to get proper access checks. Have to undo this. - * Then we add the given offset to the specific malloced struct hanging off - * virtualized ipmain struct. + * arg2 holds the offset of the relevant member in the virtualized + * ipfmain structure. */ static int sysctl_ipf_int_nat ( SYSCTL_HANDLER_ARGS ) { + ipf_nat_softc_t *nat_softc; - if (arg1) { - ipf_nat_softc_t *nat_softc; + nat_softc = V_ipfmain.ipf_nat_soft; + arg1 = (void *)((uintptr_t)nat_softc + arg2); - nat_softc = V_ipfmain.ipf_nat_soft; -#ifdef VIMAGE - arg1 = (void *)((uintptr_t)arg1 - curvnet->vnet_data_base); -#endif - arg1 = (void *)((uintptr_t)nat_softc + (uintptr_t)arg1); - } - - return (sysctl_ipf_int(oidp, arg1, arg2, req)); + return (sysctl_ipf_int(oidp, arg1, 0, req)); } static int sysctl_ipf_int_state ( SYSCTL_HANDLER_ARGS ) { + ipf_state_softc_t *state_softc; - if (arg1) { - ipf_state_softc_t *state_softc; - - state_softc = V_ipfmain.ipf_state_soft; -#ifdef VIMAGE - arg1 = (void *)((uintptr_t)arg1 - curvnet->vnet_data_base); -#endif - arg1 = (void *)((uintptr_t)state_softc + (uintptr_t)arg1); - } + state_softc = V_ipfmain.ipf_state_soft; + arg1 = (void *)((uintptr_t)state_softc + arg2); - return (sysctl_ipf_int(oidp, arg1, arg2, req)); + return (sysctl_ipf_int(oidp, arg1, 0, req)); } static int sysctl_ipf_int_auth ( SYSCTL_HANDLER_ARGS ) { + ipf_auth_softc_t *auth_softc; - if (arg1) { - ipf_auth_softc_t *auth_softc; + auth_softc = V_ipfmain.ipf_auth_soft; + arg1 = (void *)((uintptr_t)auth_softc + arg2); - auth_softc = V_ipfmain.ipf_auth_soft; -#ifdef VIMAGE - arg1 = (void *)((uintptr_t)arg1 - curvnet->vnet_data_base); -#endif - arg1 = (void *)((uintptr_t)auth_softc + (uintptr_t)arg1); - } - - return (sysctl_ipf_int(oidp, arg1, arg2, req)); + return (sysctl_ipf_int(oidp, arg1, 0, req)); } static int sysctl_ipf_int_frag ( SYSCTL_HANDLER_ARGS ) { + ipf_frag_softc_t *frag_softc; - if (arg1) { - ipf_frag_softc_t *frag_softc; - - frag_softc = V_ipfmain.ipf_frag_soft; -#ifdef VIMAGE - arg1 = (void *)((uintptr_t)arg1 - curvnet->vnet_data_base); -#endif - arg1 = (void *)((uintptr_t)frag_softc + (uintptr_t)arg1); - } + frag_softc = V_ipfmain.ipf_frag_soft; + arg1 = (void *)((uintptr_t)frag_softc + arg2); - return (sysctl_ipf_int(oidp, arg1, arg2, req)); + return (sysctl_ipf_int(oidp, arg1, 0, req)); } #endif @@ -645,29 +619,29 @@ ipf_fbsd_sysctl_create(void) sysctl_ctx_init(&ipf_clist); SYSCTL_DYN_IPF_NAT(_net_inet_ipf, OID_AUTO, "fr_defnatage", CTLFLAG_RWO, - (void *)offsetof(ipf_nat_softc_t, ipf_nat_defage), 0, ""); + NULL, offsetof(ipf_nat_softc_t, ipf_nat_defage), ""); SYSCTL_DYN_IPF_STATE(_net_inet_ipf, OID_AUTO, "fr_statesize", CTLFLAG_RWO, - (void *)offsetof(ipf_state_softc_t, ipf_state_size), 0, ""); + NULL, offsetof(ipf_state_softc_t, ipf_state_size), ""); SYSCTL_DYN_IPF_STATE(_net_inet_ipf, OID_AUTO, "fr_statemax", CTLFLAG_RWO, - (void *)offsetof(ipf_state_softc_t, ipf_state_max), 0, ""); + NULL, offsetof(ipf_state_softc_t, ipf_state_max), ""); SYSCTL_DYN_IPF_NAT(_net_inet_ipf, OID_AUTO, "ipf_nattable_max", CTLFLAG_RWO, - (void *)offsetof(ipf_nat_softc_t, ipf_nat_table_max), 0, ""); + NULL, offsetof(ipf_nat_softc_t, ipf_nat_table_max), ""); SYSCTL_DYN_IPF_NAT(_net_inet_ipf, OID_AUTO, "ipf_nattable_sz", CTLFLAG_RWO, - (void *)offsetof(ipf_nat_softc_t, ipf_nat_table_sz), 0, ""); + NULL, offsetof(ipf_nat_softc_t, ipf_nat_table_sz), ""); SYSCTL_DYN_IPF_NAT(_net_inet_ipf, OID_AUTO, "ipf_natrules_sz", CTLFLAG_RWO, - (void *)offsetof(ipf_nat_softc_t, ipf_nat_maprules_sz), 0, ""); + NULL, offsetof(ipf_nat_softc_t, ipf_nat_maprules_sz), ""); SYSCTL_DYN_IPF_NAT(_net_inet_ipf, OID_AUTO, "ipf_rdrrules_sz", CTLFLAG_RWO, - (void *)offsetof(ipf_nat_softc_t, ipf_nat_rdrrules_sz), 0, ""); + NULL, offsetof(ipf_nat_softc_t, ipf_nat_rdrrules_sz), ""); SYSCTL_DYN_IPF_NAT(_net_inet_ipf, OID_AUTO, "ipf_hostmap_sz", CTLFLAG_RWO, - (void *)offsetof(ipf_nat_softc_t, ipf_nat_hostmap_sz), 0, ""); + NULL, offsetof(ipf_nat_softc_t, ipf_nat_hostmap_sz), ""); SYSCTL_DYN_IPF_AUTH(_net_inet_ipf, OID_AUTO, "fr_authsize", CTLFLAG_RWO, - (void *)offsetof(ipf_auth_softc_t, ipf_auth_size), 0, ""); + NULL, offsetof(ipf_auth_softc_t, ipf_auth_size), ""); SYSCTL_DYN_IPF_AUTH(_net_inet_ipf, OID_AUTO, "fr_authused", CTLFLAG_RD, - (void *)offsetof(ipf_auth_softc_t, ipf_auth_used), 0, ""); + NULL, offsetof(ipf_auth_softc_t, ipf_auth_used), ""); SYSCTL_DYN_IPF_AUTH(_net_inet_ipf, OID_AUTO, "fr_defaultauthage", CTLFLAG_RW, - (void *)offsetof(ipf_auth_softc_t, ipf_auth_defaultage), 0, ""); + NULL, offsetof(ipf_auth_softc_t, ipf_auth_defaultage), ""); SYSCTL_DYN_IPF_FRAG(_net_inet_ipf, OID_AUTO, "fr_ipfrttl", CTLFLAG_RW, - (void *)offsetof(ipf_frag_softc_t, ipfr_ttl), 0, ""); + NULL, offsetof(ipf_frag_softc_t, ipfr_ttl), ""); return 0; } From owner-dev-commits-src-main@freebsd.org Thu Jan 21 00:40:21 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0C4634DED95; Thu, 21 Jan 2021 00:40:21 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLk7m6znsz4WhT; Thu, 21 Jan 2021 00:40:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEC4022B1A; Thu, 21 Jan 2021 00:40:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L0eKee095272; Thu, 21 Jan 2021 00:40:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L0eKS6095266; Thu, 21 Jan 2021 00:40:20 GMT (envelope-from git) Date: Thu, 21 Jan 2021 00:40:20 GMT Message-Id: <202101210040.10L0eKS6095266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 4a6cd37b755c - main - Restructure the crypto(7) manpage and add authentication algorithms. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a6cd37b755c404122453a82263f15323ecce56b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 00:40:21 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4a6cd37b755c404122453a82263f15323ecce56b commit 4a6cd37b755c404122453a82263f15323ecce56b Author: John Baldwin AuthorDate: 2021-01-21 00:37:55 +0000 Commit: John Baldwin CommitDate: 2021-01-21 00:40:03 +0000 Restructure the crypto(7) manpage and add authentication algorithms. Add separate sections for authentication algorithms, block ciphers, stream ciphers, and AEAD algorithms. Describe properties commmon to algorithms in each section to avoid duplication. Use flat tables to list algorithm properties rather than nested tables. List implemented authentication algorithms. Reviewed by: gbe (manpages) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27833 --- share/man/man7/crypto.7 | 230 +++++++++++++++++++++++------------------------- 1 file changed, 112 insertions(+), 118 deletions(-) diff --git a/share/man/man7/crypto.7 b/share/man/man7/crypto.7 index 609eb574995e..d6cae1e39819 100644 --- a/share/man/man7/crypto.7 +++ b/share/man/man7/crypto.7 @@ -27,144 +27,140 @@ .\" .\" $FreeBSD$ .\" -.Dd June 4, 2020 +.Dd January 20, 2021 .Dt CRYPTO 7 .Os .Sh NAME .Nm crypto .Nd OpenCrypto algorithms -.Sh SYNOPSIS -In the kernel configuration file: -.Cd "device crypto" -.Pp -Or load the crypto.ko module. .Sh DESCRIPTION -The following cryptographic algorithms that are part of the OpenCrypto -framework have the following requirements. -.Pp -Cipher algorithms: -.Bl -tag -width "CRYPTO_AES_NIST_GCM_16" -.It Dv CRYPTO_AES_CBC -.Bl -tag -width "Block size :" -compact -offset indent -.It IV size : -16 -.It Block size : -16 -.It Key size : -16, 24 or 32 +The in-kernel OpenCrypto framework supports several different encryption +and authentication algorithms. +This document describes the parameters and requirements of these algorithms. +Unless otherwise noted, all sizes listed below are in bytes. +.Ss Authenticators +Authenticators compute a value (also known as a digest, hash, or tag) +over an input of bytes. +In-kernel requests can either compute the value for a given input, +or verify if a given tag matches the computed tag for a given input. +The following authentication algorithms are supported: +.Bl -column "CRYPTO_AES_CCM_CBC_MAC" "XXX" "16, 24, 32" "Digest" +.It Sy Name Ta Sy Nonce Ta Sy Key Sizes Ta Sy Digest Ta Sy Description +.It Dv CRYPTO_AES_CCM_CBC_MAC Ta 12 Ta 16, 24, 32 Ta 16 Ta +Authentication-only mode of AES-CCM +.It Dv CRYPTO_AES_NIST_GMAC Ta 12 Ta 16, 24, 32 Ta 16 Ta +Galois message authentication code +.It Dv CRYPTO_BLAKE2B Ta Ta 0, 64 Ta 64 Ta +Blake2b +.It Dv CRYPTO_BLAKE2S Ta Ta 0, 32 Ta 32 Ta +Blake2s +.It Dv CRYPTO_NULL_HMAC Ta Ta Ta 12 Ta +IPsec NULL HMAC +.It Dv CRYPTO_POLY1305 Ta Ta 32 Ta 16 Ta +Poly1305 authenticator +.It Dv CRYPTO_RIPEMD160 Ta Ta Ta 20 Ta +RIPE Message Digest-160 +.It Dv CRYPTO_RIPEMD160_HMAC Ta Ta 64 Ta 20 Ta +RIPE Message Digest-160 HMAC +.It Dv CRYPTO_SHA1 Ta Ta Ta 20 Ta +SHA-1 +.It Dv CRYPTO_SHA1_HMAC Ta Ta 64 Ta 20 Ta +SHA-1 HMAC +.It Dv CRYPTO_SHA2_224 Ta Ta Ta 28 Ta +SHA-2 224 +.It Dv CRYPTO_SHA2_224_HMAC Ta Ta 64 Ta 28 Ta +SHA-2 224 HMAC +.It Dv CRYPTO_SHA2_256 Ta Ta Ta 32 Ta +SHA-2 256 +.It Dv CRYPTO_SHA2_256_HMAC Ta Ta 64 Ta 32 Ta +SHA-2 256 HMAC +.It Dv CRYPTO_SHA2_384 Ta Ta Ta 48 Ta +SHA-2 384 +.It Dv CRYPTO_SHA2_384_HMAC Ta Ta 128 Ta 48 Ta +SHA-2 384 HMAC +.It Dv CRYPTO_SHA2_512 Ta Ta Ta 64 Ta +SHA-2 512 +.It Dv CRYPTO_SHA2_512_HMAC Ta Ta 128 Ta 64 Ta +SHA-2 512 HMAC .El -.Pp -This algorithm implements Cipher Block Chaining. -.It Dv CRYPTO_AES_CCM_16 -.Bl -tag -width "Block size :" -compact -offset indent -.It IV size : -12 -.It Block size : -16 -.It Key size : -16, 24 or 32 -.It Digest size : -16 +.Ss Block Ciphers +Block ciphers in OCF can only operate on messages whose length is an +exact multiple of the cipher's block size. +OCF supports the following block ciphers: +.Bl -column "CRYPTO_CAMELLIA_CBC" "IV Size" "Block Size" "16, 24, 32" +.It Sy Name Ta Sy IV Size Ta Sy Block Size Ta Sy Key Sizes Ta Sy Description +.It Dv CRYPTO_AES_CBC Ta 16 Ta 16 Ta 16, 24, 32 Ta +AES-CBC +.It Dv CRYPTO_AES_XTS Ta 8 Ta 16 Ta 32, 64 Ta +AES-XTS +.It Dv CRYPTO_CAMELLIA_CBC Ta 16 Ta 16 Ta 16, 24, 32 Ta +Camellia CBC +.It Dv CRYPTO_NULL_CBC Ta 0 Ta 4 Ta 0-256 Ta +IPsec NULL cipher .El .Pp -This algorithm implements Counter with CBC-MAC Mode. -This cipher uses AEAD -.Pq Authenticated Encryption with Associated Data -mode. -.Pp -The authentication tag will be read from or written to the offset -.Va crp_digest_start -specified in the request. +.Dv CRYPTO_AES_XTS +implements XEX Tweakable Block Cipher with Ciphertext Stealing +as defined in NIST SP 800-38E. +OCF consumers provide the first 8 bytes of the IV. +The remaining 8 bytes are defined to be a block counter beginning at 0. .Pp -Note: The nonce for each request must be provided in -.Fa crp_iv -via the -.Dv CRYPTO_F_IV_SEPARATE -flag. -.It Dv CRYPTO_AES_NIST_GCM_16 -.Bl -tag -width "Block size :" -compact -offset indent -.It IV size : -12 -.It Block size : -1 -.It Key size : -16, 24 or 32 -.It Digest size : -16 +NOTE: The ciphertext stealing part is not implemented in all backends +which is why this cipher requires input that is a multiple of the block +size. +.Ss Stream Ciphers +Stream ciphers can operate on messages with arbitrary lengths. +OCF supports the following stream ciphers: +.Bl -column "CRYPTO_CHACHA20" "IV Size" "16, 24, 32" +.It Sy Name Ta Sy IV Size Ta Sy Key Sizes Ta Sy Description +.It Dv CRYPTO_AES_ICM Ta 16 Ta 16, 24, 32 Ta +AES Counter Mode +.It Dv CRYPTO_CHACHA20 Ta 16 Ta 16, 32 Ta +ChaCha20 .El .Pp -This algorithm implements Galois/Counter Mode. -This cipher uses AEAD -.Pq Authenticated Encryption with Associated Data -mode. -.Pp -The authentication tag will be read from or written to the offset -.Va crp_digest_start -specified in the request. -.Pp -Note: The nonce for each request must be provided in +The IV for each request must be provided in .Fa crp_iv via the .Dv CRYPTO_F_IV_SEPARATE flag. -.It Dv CRYPTO_AES_ICM -.Bl -tag -width "Block size :" -compact -offset indent -.It IV size : -16 -.It Block size : -1 -.It Key size : -16, 24 or 32 -.El .Pp -This algorithm implements Integer Counter Mode. -This is similar to what most people call counter mode, but instead of the -counter being split into a nonce and a counter part, then entire nonce is -used as the initial counter. -This does mean that if a counter is required that rolls over at 32 bits, -the transaction need to be split into two parts where the counter rolls over. -The counter incremented as a 128-bit big endian number. +.Dv CRYPTO_AES_ICM +uses the entire IV as a 128-bit big endian block counter. +The IV sets the initial counter value for a message. +If a consumer wishes to use an IV whose value is split into +separate nonce and counter fields (e.g., IPsec), +the consumer is responsible for splitting requests to handle +counter rollover. +.Pp +.Dv CRYPTO_CHACHA20 +accepts a 16 byte IV. +The first 8 bytes are used as a nonce. +The last 8 bytes are used as 64-bit big-endian block counter. +.Ss Authenticated Encryption with Associated Data Algorithms +AEAD algorithms in OCF combine a stream cipher with an authentication +algorithm to provide both secrecy and authentication. +AEAD algorithms accept additional authentication data (AAD) +in addition to the ciphertext or plaintext. +AAD is passed to the authentication algorithm as input in a method +defined by the specific AEAD algorithm. .Pp -Note: The counter for each request must be provided in +AEAD algorithms in OCF accept a nonce that is combined with an +algorithm-defined counter to construct the IV for the underlying +stream cipher. +This nonce must be provided in .Fa crp_iv via the .Dv CRYPTO_F_IV_SEPARATE flag. -.It Dv CRYPTO_AES_XTS -.Bl -tag -width "Block size :" -compact -offset indent -.It IV size : -8 -.It Block size : -16 -.It Key size : -32 or 64 -.El .Pp -This algorithm implements XEX Tweakable Block Cipher with Ciphertext Stealing -as defined in NIST SP 800-38E. -.Pp -NOTE: The ciphertext stealing part is not implemented which is why this cipher -is listed as having a block size of 16 instead of 1. -.It Dv CRYPTO_CAMELLIA_CBC -.Bl -tag -width "Block size :" -compact -offset indent -.It IV size : -16 -.It Block size : -16 -.It Key size : -16, 24 or 32 -.El -.Pp -This algorithm implements Cipher Block Chaining. -.It Dv CRYPTO_CHACHA20 -.Bl -tag -width "Block size :" -compact -offset indent -.It IV size : -16 -.It Block size : -1 -.It Key size : -16 or 32 -.El +The following AEAD algorithms are supported: +.Bl -column "CRYPTO_AES_NIST_GCM_16" "Nonce" "16, 24, 32" "Tag" +.It Sy Name Ta Sy Nonce Ta Sy Key Sizes Ta Sy Tag Ta Sy Description +.It Dv CRYPTO_AES_NIST_GCM_16 Ta 12 Ta 16, 24, 32 Ta 16 Ta +AES Galois/Counter Mode +.It Dv CRYPTO_AES_CCM_16 Ta 12 Ta 16, 24, 32 Ta 16 Ta +AES Counter with CBC-MAC .El .Sh SEE ALSO .Xr crypto 4 , @@ -172,7 +168,5 @@ This algorithm implements Cipher Block Chaining. .Sh HISTORY The .Nm -manpage first appeared in +manual page first appeared in .Fx 10.1 . -.Sh BUGS -Not all the implemented algorithms are listed. From owner-dev-commits-src-main@freebsd.org Thu Jan 21 00:40:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1E11C4DEBF3; Thu, 21 Jan 2021 00:40:22 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLk7p0BqZz4Wt3; Thu, 21 Jan 2021 00:40:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECCEE229ED; Thu, 21 Jan 2021 00:40:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L0eLnA095613; Thu, 21 Jan 2021 00:40:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L0eLXH095612; Thu, 21 Jan 2021 00:40:21 GMT (envelope-from git) Date: Thu, 21 Jan 2021 00:40:21 GMT Message-Id: <202101210040.10L0eLXH095612@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 5bd565855a92 - main - Tidy some crypto-related lines in sys/conf/files. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bd565855a92eff19883143be986a8045ca13cf9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 00:40:22 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5bd565855a92eff19883143be986a8045ca13cf9 commit 5bd565855a92eff19883143be986a8045ca13cf9 Author: John Baldwin AuthorDate: 2021-01-21 00:39:04 +0000 Commit: John Baldwin CommitDate: 2021-01-21 00:40:05 +0000 Tidy some crypto-related lines in sys/conf/files. Reviewed by: cem (earlier version) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27835 --- sys/conf/files | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index fe017a2537b7..552c496e922a 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4908,6 +4908,7 @@ dev/mlx5/mlx5_en/mlx5_en_port_buffer.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" # crypto support +opencrypto/cbc_mac.c optional crypto opencrypto/criov.c optional crypto | ipsec | ipsec_support opencrypto/crypto.c optional crypto | ipsec | ipsec_support opencrypto/cryptodev.c optional cryptodev @@ -4918,6 +4919,7 @@ opencrypto/gmac.c optional crypto | ipsec | ipsec_support opencrypto/gfmult.c optional crypto | ipsec | ipsec_support opencrypto/rmd160.c optional crypto | ipsec | ipsec_support opencrypto/xform.c optional crypto | ipsec | ipsec_support +opencrypto/xform_cbc_mac.c optional crypto opencrypto/xform_poly1305.c optional crypto \ compile-with "${NORMAL_C} -I$S/contrib/libsodium/src/libsodium/include -I$S/crypto/libsodium" contrib/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ @@ -4949,9 +4951,6 @@ contrib/libsodium/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchach optional crypto \ compile-with "${NORMAL_C} -I$S/contrib/libsodium/src/libsodium/include/sodium -I$S/crypto/libsodium" - -opencrypto/cbc_mac.c optional crypto -opencrypto/xform_cbc_mac.c optional crypto rpc/auth_none.c optional krpc | nfslockd | nfscl | nfsd rpc/auth_unix.c optional krpc | nfslockd | nfscl | nfsd rpc/authunix_prot.c optional krpc | nfslockd | nfscl | nfsd From owner-dev-commits-src-main@freebsd.org Thu Jan 21 01:14:05 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7377C4DFF28; Thu, 21 Jan 2021 01:14:05 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLktj2vQnz4ZFl; Thu, 21 Jan 2021 01:14:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5687722EDE; Thu, 21 Jan 2021 01:14:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L1E5RE039455; Thu, 21 Jan 2021 01:14:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L1E5S8039454; Thu, 21 Jan 2021 01:14:05 GMT (envelope-from git) Date: Thu, 21 Jan 2021 01:14:05 GMT Message-Id: <202101210114.10L1E5S8039454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 0e72f2c54186 - main - virtio_mmio: Fix a style(9) issue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e72f2c54186aaf2f36d96a64f36d9a94627a03f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 01:14:05 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=0e72f2c54186aaf2f36d96a64f36d9a94627a03f commit 0e72f2c54186aaf2f36d96a64f36d9a94627a03f Author: Jessica Clarke AuthorDate: 2021-01-21 01:02:30 +0000 Commit: Jessica Clarke CommitDate: 2021-01-21 01:05:20 +0000 virtio_mmio: Fix a style(9) issue --- sys/dev/virtio/mmio/virtio_mmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/virtio/mmio/virtio_mmio.c b/sys/dev/virtio/mmio/virtio_mmio.c index 694d2a232fdd..c16ecd40a250 100644 --- a/sys/dev/virtio/mmio/virtio_mmio.c +++ b/sys/dev/virtio/mmio/virtio_mmio.c @@ -219,7 +219,7 @@ vtmmio_attach(device_t dev) rid = 0; sc->res[0] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (!sc->res[0]) { + if (sc->res[0] == NULL) { device_printf(dev, "Cannot allocate memory window.\n"); return (ENXIO); } From owner-dev-commits-src-main@freebsd.org Thu Jan 21 01:14:06 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9817B4DFED6; Thu, 21 Jan 2021 01:14:06 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLktk3wGsz4ZJ6; Thu, 21 Jan 2021 01:14:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79DAC22E6F; Thu, 21 Jan 2021 01:14:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L1E6ID039477; Thu, 21 Jan 2021 01:14:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L1E6YI039476; Thu, 21 Jan 2021 01:14:06 GMT (envelope-from git) Date: Thu, 21 Jan 2021 01:14:06 GMT Message-Id: <202101210114.10L1E6YI039476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: be79a2c60fec - main - virtio_mmio: Fix V1 device probing spec conformance (section 4.2.3.1.1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be79a2c60fec0b4ead6369e6ce420a664a0dfa9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 01:14:06 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=be79a2c60fec0b4ead6369e6ce420a664a0dfa9d commit be79a2c60fec0b4ead6369e6ce420a664a0dfa9d Author: Jessica Clarke AuthorDate: 2021-01-21 01:03:44 +0000 Commit: Jessica Clarke CommitDate: 2021-01-21 01:05:21 +0000 virtio_mmio: Fix V1 device probing spec conformance (section 4.2.3.1.1) We must check MagicValue not just Version before anything else, and then we must check DeviceID and immediately abort if zero (and this must not be an error). Do all this when probing rather than at the start of attaching as that's where this belongs, and provides a clear boundary between the device detection and device initialisation parts of the specified driver initialisation process. This also means we don't create empty device instances for placeholder devices, reducing clutter on systems that pre-allocate a large number, such as QEMU's AArch64 virt machine (which provides 32). Reviewed by: bryanv Differential Revision: https://reviews.freebsd.org/D28070 --- sys/dev/virtio/mmio/virtio_mmio.c | 50 ++++++++++++++++++++++++++++------ sys/dev/virtio/mmio/virtio_mmio.h | 2 ++ sys/dev/virtio/mmio/virtio_mmio_acpi.c | 3 +- sys/dev/virtio/mmio/virtio_mmio_fdt.c | 3 +- 4 files changed, 46 insertions(+), 12 deletions(-) diff --git a/sys/dev/virtio/mmio/virtio_mmio.c b/sys/dev/virtio/mmio/virtio_mmio.c index c16ecd40a250..862272b917df 100644 --- a/sys/dev/virtio/mmio/virtio_mmio.c +++ b/sys/dev/virtio/mmio/virtio_mmio.c @@ -171,6 +171,48 @@ DEFINE_CLASS_0(virtio_mmio, vtmmio_driver, vtmmio_methods, MODULE_VERSION(virtio_mmio, 1); +int +vtmmio_probe(device_t dev) +{ + struct vtmmio_softc *sc; + int rid; + uint32_t magic, version; + + sc = device_get_softc(dev); + + rid = 0; + sc->res[0] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->res[0] == NULL) { + device_printf(dev, "Cannot allocate memory window.\n"); + return (ENXIO); + } + + magic = vtmmio_read_config_4(sc, VIRTIO_MMIO_MAGIC_VALUE); + if (magic != VIRTIO_MMIO_MAGIC_VIRT) { + device_printf(dev, "Bad magic value %#x\n", magic); + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->res[0]); + return (ENXIO); + } + + version = vtmmio_read_config_4(sc, VIRTIO_MMIO_VERSION); + if (version < 1 || version > 2) { + device_printf(dev, "Unsupported version: %#x\n", version); + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->res[0]); + return (ENXIO); + } + + if (vtmmio_read_config_4(sc, VIRTIO_MMIO_DEVICE_ID) == 0) { + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->res[0]); + return (ENXIO); + } + + bus_release_resource(dev, SYS_RES_MEMORY, rid, sc->res[0]); + + device_set_desc(dev, "VirtIO MMIO adapter"); + return (BUS_PROBE_DEFAULT); +} + static int vtmmio_setup_intr(device_t dev, enum intr_type type) { @@ -225,14 +267,6 @@ vtmmio_attach(device_t dev) } sc->vtmmio_version = vtmmio_read_config_4(sc, VIRTIO_MMIO_VERSION); - if (sc->vtmmio_version < 1 || sc->vtmmio_version > 2) { - device_printf(dev, "Unsupported version: %x\n", - sc->vtmmio_version); - bus_release_resource(dev, SYS_RES_MEMORY, 0, - sc->res[0]); - sc->res[0] = NULL; - return (ENXIO); - } vtmmio_reset(sc); diff --git a/sys/dev/virtio/mmio/virtio_mmio.h b/sys/dev/virtio/mmio/virtio_mmio.h index ce60cd4fa173..5eb56d860780 100644 --- a/sys/dev/virtio/mmio/virtio_mmio.h +++ b/sys/dev/virtio/mmio/virtio_mmio.h @@ -55,6 +55,7 @@ struct vtmmio_softc { void *ih; }; +int vtmmio_probe(device_t); int vtmmio_attach(device_t); #define VIRTIO_MMIO_MAGIC_VALUE 0x000 @@ -84,6 +85,7 @@ int vtmmio_attach(device_t); #define VIRTIO_MMIO_QUEUE_USED_HIGH 0x0a4 /* requires version 2 */ #define VIRTIO_MMIO_CONFIG_GENERATION 0x100 /* requires version 2 */ #define VIRTIO_MMIO_CONFIG 0x100 +#define VIRTIO_MMIO_MAGIC_VIRT 0x74726976 #define VIRTIO_MMIO_INT_VRING (1 << 0) #define VIRTIO_MMIO_INT_CONFIG (1 << 1) #define VIRTIO_MMIO_VRING_ALIGN 4096 diff --git a/sys/dev/virtio/mmio/virtio_mmio_acpi.c b/sys/dev/virtio/mmio/virtio_mmio_acpi.c index bd737a6e53db..0cb34f5aa873 100644 --- a/sys/dev/virtio/mmio/virtio_mmio_acpi.c +++ b/sys/dev/virtio/mmio/virtio_mmio_acpi.c @@ -81,6 +81,5 @@ vtmmio_acpi_probe(device_t dev) if (!acpi_MatchHid(h, "LNRO0005")) return (ENXIO); - device_set_desc(dev, "VirtIO MMIO adapter"); - return (BUS_PROBE_DEFAULT); + return (vtmmio_probe(dev)); } diff --git a/sys/dev/virtio/mmio/virtio_mmio_fdt.c b/sys/dev/virtio/mmio/virtio_mmio_fdt.c index a6867176a07c..a188df707946 100644 --- a/sys/dev/virtio/mmio/virtio_mmio_fdt.c +++ b/sys/dev/virtio/mmio/virtio_mmio_fdt.c @@ -97,8 +97,7 @@ vtmmio_fdt_probe(device_t dev) if (!ofw_bus_is_compatible(dev, "virtio,mmio")) return (ENXIO); - device_set_desc(dev, "VirtIO MMIO adapter"); - return (BUS_PROBE_DEFAULT); + return (vtmmio_probe(dev)); } static int From owner-dev-commits-src-main@freebsd.org Thu Jan 21 01:14:07 2021 Return-Path: Delivered-To: dev-commits-src-main@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 CFFC24DFF37; Thu, 21 Jan 2021 01:14:07 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLktl5K7Nz4Z9h; Thu, 21 Jan 2021 01:14:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FF7C230E6; Thu, 21 Jan 2021 01:14:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L1E74E039496; Thu, 21 Jan 2021 01:14:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L1E7dV039495; Thu, 21 Jan 2021 01:14:07 GMT (envelope-from git) Date: Thu, 21 Jan 2021 01:14:07 GMT Message-Id: <202101210114.10L1E7dV039495@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 633218ee4615 - main - virtio: Reduce boilerplate for device driver module definitions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 633218ee4615854702fea05ba6e17c2a1876bb6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 01:14:07 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=633218ee4615854702fea05ba6e17c2a1876bb6b commit 633218ee4615854702fea05ba6e17c2a1876bb6b Author: Jessica Clarke AuthorDate: 2021-01-21 01:07:23 +0000 Commit: Jessica Clarke CommitDate: 2021-01-21 01:07:23 +0000 virtio: Reduce boilerplate for device driver module definitions Rather than have every device register itself for both virtio_pci and virtio_mmio, provide a VIRTIO_DRIVER_MODULE wrapper to declare both, merge VIRTIO_SIMPLE_PNPTABLE with VIRTIO_SIMPLE_PNPINFO and make the latter register for both buses. This also has the benefit of abstracting away the available transports and their names. Reviewed by: bryanv Differential Revision: https://reviews.freebsd.org/D28073 --- sys/dev/virtio/balloon/virtio_balloon.c | 8 ++------ sys/dev/virtio/block/virtio_blk.c | 8 ++------ sys/dev/virtio/console/virtio_console.c | 8 ++------ sys/dev/virtio/network/if_vtnet.c | 8 ++------ sys/dev/virtio/random/virtio_random.c | 8 ++------ sys/dev/virtio/scsi/virtio_scsi.c | 8 ++------ sys/dev/virtio/virtio.h | 13 +++++++++---- 7 files changed, 21 insertions(+), 40 deletions(-) diff --git a/sys/dev/virtio/balloon/virtio_balloon.c b/sys/dev/virtio/balloon/virtio_balloon.c index 848dd4e9a7f5..3e2d967dd9af 100644 --- a/sys/dev/virtio/balloon/virtio_balloon.c +++ b/sys/dev/virtio/balloon/virtio_balloon.c @@ -158,17 +158,13 @@ static driver_t vtballoon_driver = { }; static devclass_t vtballoon_devclass; -DRIVER_MODULE(virtio_balloon, virtio_mmio, vtballoon_driver, - vtballoon_devclass, 0, 0); -DRIVER_MODULE(virtio_balloon, virtio_pci, vtballoon_driver, +VIRTIO_DRIVER_MODULE(virtio_balloon, vtballoon_driver, vtballoon_devclass, 0, 0); MODULE_VERSION(virtio_balloon, 1); MODULE_DEPEND(virtio_balloon, virtio, 1, 1, 1); -VIRTIO_SIMPLE_PNPTABLE(virtio_balloon, VIRTIO_ID_BALLOON, +VIRTIO_SIMPLE_PNPINFO(virtio_balloon, VIRTIO_ID_BALLOON, "VirtIO Balloon Adapter"); -VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_balloon); -VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_balloon); static int vtballoon_probe(device_t dev) diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c index 6056771e3735..50642fb0b009 100644 --- a/sys/dev/virtio/block/virtio_blk.c +++ b/sys/dev/virtio/block/virtio_blk.c @@ -267,16 +267,12 @@ static driver_t vtblk_driver = { }; static devclass_t vtblk_devclass; -DRIVER_MODULE(virtio_blk, virtio_mmio, vtblk_driver, vtblk_devclass, - vtblk_modevent, 0); -DRIVER_MODULE(virtio_blk, virtio_pci, vtblk_driver, vtblk_devclass, +VIRTIO_DRIVER_MODULE(virtio_blk, vtblk_driver, vtblk_devclass, vtblk_modevent, 0); MODULE_VERSION(virtio_blk, 1); MODULE_DEPEND(virtio_blk, virtio, 1, 1, 1); -VIRTIO_SIMPLE_PNPTABLE(virtio_blk, VIRTIO_ID_BLOCK, "VirtIO Block Adapter"); -VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_blk); -VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_blk); +VIRTIO_SIMPLE_PNPINFO(virtio_blk, VIRTIO_ID_BLOCK, "VirtIO Block Adapter"); static int vtblk_modevent(module_t mod, int type, void *unused) diff --git a/sys/dev/virtio/console/virtio_console.c b/sys/dev/virtio/console/virtio_console.c index 315eb59716b4..b65935303b21 100644 --- a/sys/dev/virtio/console/virtio_console.c +++ b/sys/dev/virtio/console/virtio_console.c @@ -263,17 +263,13 @@ static driver_t vtcon_driver = { }; static devclass_t vtcon_devclass; -DRIVER_MODULE(virtio_console, virtio_mmio, vtcon_driver, vtcon_devclass, - vtcon_modevent, 0); -DRIVER_MODULE(virtio_console, virtio_pci, vtcon_driver, vtcon_devclass, +VIRTIO_DRIVER_MODULE(virtio_console, vtcon_driver, vtcon_devclass, vtcon_modevent, 0); MODULE_VERSION(virtio_console, 1); MODULE_DEPEND(virtio_console, virtio, 1, 1, 1); -VIRTIO_SIMPLE_PNPTABLE(virtio_console, VIRTIO_ID_CONSOLE, +VIRTIO_SIMPLE_PNPINFO(virtio_console, VIRTIO_ID_CONSOLE, "VirtIO Console Adapter"); -VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_console); -VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_console); static int vtcon_modevent(module_t mod, int type, void *unused) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 8d0770f5ac2d..e64b7de113c8 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -362,9 +362,7 @@ static driver_t vtnet_driver = { }; static devclass_t vtnet_devclass; -DRIVER_MODULE(vtnet, virtio_mmio, vtnet_driver, vtnet_devclass, - vtnet_modevent, 0); -DRIVER_MODULE(vtnet, virtio_pci, vtnet_driver, vtnet_devclass, +VIRTIO_DRIVER_MODULE(vtnet, vtnet_driver, vtnet_devclass, vtnet_modevent, 0); MODULE_VERSION(vtnet, 1); MODULE_DEPEND(vtnet, virtio, 1, 1, 1); @@ -372,9 +370,7 @@ MODULE_DEPEND(vtnet, virtio, 1, 1, 1); MODULE_DEPEND(vtnet, netmap, 1, 1, 1); #endif -VIRTIO_SIMPLE_PNPTABLE(vtnet, VIRTIO_ID_NETWORK, "VirtIO Networking Adapter"); -VIRTIO_SIMPLE_PNPINFO(virtio_mmio, vtnet); -VIRTIO_SIMPLE_PNPINFO(virtio_pci, vtnet); +VIRTIO_SIMPLE_PNPINFO(vtnet, VIRTIO_ID_NETWORK, "VirtIO Networking Adapter"); static int vtnet_modevent(module_t mod, int type, void *unused) diff --git a/sys/dev/virtio/random/virtio_random.c b/sys/dev/virtio/random/virtio_random.c index ee3a24bb5513..a8553ecab287 100644 --- a/sys/dev/virtio/random/virtio_random.c +++ b/sys/dev/virtio/random/virtio_random.c @@ -97,18 +97,14 @@ static driver_t vtrnd_driver = { }; static devclass_t vtrnd_devclass; -DRIVER_MODULE(virtio_random, virtio_mmio, vtrnd_driver, vtrnd_devclass, - vtrnd_modevent, 0); -DRIVER_MODULE(virtio_random, virtio_pci, vtrnd_driver, vtrnd_devclass, +VIRTIO_DRIVER_MODULE(virtio_random, vtrnd_driver, vtrnd_devclass, vtrnd_modevent, 0); MODULE_VERSION(virtio_random, 1); MODULE_DEPEND(virtio_random, virtio, 1, 1, 1); MODULE_DEPEND(virtio_random, random_device, 1, 1, 1); -VIRTIO_SIMPLE_PNPTABLE(virtio_random, VIRTIO_ID_ENTROPY, +VIRTIO_SIMPLE_PNPINFO(virtio_random, VIRTIO_ID_ENTROPY, "VirtIO Entropy Adapter"); -VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_random); -VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_random); static int vtrnd_modevent(module_t mod, int type, void *unused) diff --git a/sys/dev/virtio/scsi/virtio_scsi.c b/sys/dev/virtio/scsi/virtio_scsi.c index 737b6d0a7a42..51d9e5f532f7 100644 --- a/sys/dev/virtio/scsi/virtio_scsi.c +++ b/sys/dev/virtio/scsi/virtio_scsi.c @@ -239,17 +239,13 @@ static driver_t vtscsi_driver = { }; static devclass_t vtscsi_devclass; -DRIVER_MODULE(virtio_scsi, virtio_mmio, vtscsi_driver, vtscsi_devclass, - vtscsi_modevent, 0); -DRIVER_MODULE(virtio_scsi, virtio_pci, vtscsi_driver, vtscsi_devclass, +VIRTIO_DRIVER_MODULE(virtio_scsi, vtscsi_driver, vtscsi_devclass, vtscsi_modevent, 0); MODULE_VERSION(virtio_scsi, 1); MODULE_DEPEND(virtio_scsi, virtio, 1, 1, 1); MODULE_DEPEND(virtio_scsi, cam, 1, 1, 1); -VIRTIO_SIMPLE_PNPTABLE(virtio_scsi, VIRTIO_ID_SCSI, "VirtIO SCSI Adapter"); -VIRTIO_SIMPLE_PNPINFO(virtio_mmio, virtio_scsi); -VIRTIO_SIMPLE_PNPINFO(virtio_pci, virtio_scsi); +VIRTIO_SIMPLE_PNPINFO(virtio_scsi, VIRTIO_ID_SCSI, "VirtIO SCSI Adapter"); static int vtscsi_modevent(module_t mod, int type, void *unused) diff --git a/sys/dev/virtio/virtio.h b/sys/dev/virtio/virtio.h index ccac57a5ad96..b22327351b43 100644 --- a/sys/dev/virtio/virtio.h +++ b/sys/dev/virtio/virtio.h @@ -66,17 +66,22 @@ struct virtio_feature_desc { const char *vfd_str; }; +#define VIRTIO_DRIVER_MODULE(name, driver, devclass, evh, arg) \ + DRIVER_MODULE(name, virtio_mmio, driver, devclass, evh, arg); \ + DRIVER_MODULE(name, virtio_pci, driver, devclass, evh, arg) + struct virtio_pnp_match { uint32_t device_type; const char *description; }; -#define VIRTIO_SIMPLE_PNPTABLE(driver, devtype, desc) \ +#define VIRTIO_SIMPLE_PNPINFO(driver, devtype, desc) \ static const struct virtio_pnp_match driver ## _match = { \ .device_type = devtype, \ .description = desc, \ - } -#define VIRTIO_SIMPLE_PNPINFO(bus, driver) \ - MODULE_PNP_INFO("U32:device_type;D:#", bus, driver, \ + }; \ + MODULE_PNP_INFO("U32:device_type;D:#", virtio_mmio, driver, \ + &driver ## _match, 1); \ + MODULE_PNP_INFO("U32:device_type;D:#", virtio_pci, driver, \ &driver ## _match, 1) #define VIRTIO_SIMPLE_PROBE(dev, driver) \ (virtio_simple_probe(dev, &driver ## _match)) From owner-dev-commits-src-main@freebsd.org Thu Jan 21 01:36:13 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C12344E0F8F; Thu, 21 Jan 2021 01:36:13 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLlNF56lvz4bdR; Thu, 21 Jan 2021 01:36:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2A6323529; Thu, 21 Jan 2021 01:36:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L1aDYx066087; Thu, 21 Jan 2021 01:36:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L1aDoG066086; Thu, 21 Jan 2021 01:36:13 GMT (envelope-from git) Date: Thu, 21 Jan 2021 01:36:13 GMT Message-Id: <202101210136.10L1aDoG066086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 32cb85d0f1e8 - main - Build VirtIO modules on all architectures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 32cb85d0f1e806ac2147fefff6b6e3bd107ba4c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 01:36:13 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=32cb85d0f1e806ac2147fefff6b6e3bd107ba4c1 commit 32cb85d0f1e806ac2147fefff6b6e3bd107ba4c1 Author: Jessica Clarke AuthorDate: 2021-01-21 01:21:35 +0000 Commit: Jessica Clarke CommitDate: 2021-01-21 01:21:35 +0000 Build VirtIO modules on all architectures Currently only amd64, i386 and powerpc build VirtIO modules, yet all other architectures have at least one kernel configuration that includes the transport drivers, and so they lack drivers for all the devices they don't statically compile into the kernel. Instead, enable the build everywhere so all architectures have the full set of device drivers available. Reviewed by: bryanv (earlier version), imp (earlier version) Differential Revision: https://reviews.freebsd.org/D28058 --- share/man/man4/Makefile | 32 ++++++++------------------------ sys/modules/Makefile | 4 +--- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index fa2af9d32aea..ffc7a08292e9 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -564,12 +564,12 @@ MAN= aac.4 \ vge.4 \ viapm.4 \ ${_viawd.4} \ - ${_virtio.4} \ - ${_virtio_balloon.4} \ - ${_virtio_blk.4} \ - ${_virtio_console.4} \ - ${_virtio_random.4} \ - ${_virtio_scsi.4} \ + virtio.4 \ + virtio_balloon.4 \ + virtio_blk.4 \ + virtio_console.4 \ + virtio_random.4 \ + virtio_scsi.4 \ ${_vmci.4} \ vkbd.4 \ vlan.4 \ @@ -580,7 +580,7 @@ MAN= aac.4 \ vr.4 \ vt.4 \ vte.4 \ - ${_vtnet.4} \ + vtnet.4 \ watchdog.4 \ ${_wbwd.4} \ witness.4 \ @@ -764,7 +764,7 @@ MLINKS+=vxlan.4 if_vxlan.4 MLINKS+=${_vmx.4} ${_if_vmx.4} MLINKS+=vr.4 if_vr.4 MLINKS+=vte.4 if_vte.4 -MLINKS+=${_vtnet.4} ${_if_vtnet.4} +MLINKS+=vtnet.4 if_vtnet.4 MLINKS+=watchdog.4 SW_WATCHDOG.4 MLINKS+=${_wpi.4} ${_if_wpi.4} MLINKS+=xl.4 if_xl.4 @@ -818,7 +818,6 @@ _if_ndis.4= if_ndis.4 _if_nfe.4= if_nfe.4 _if_urtw.4= if_urtw.4 _if_vmx.4= if_vmx.4 -_if_vtnet.4= if_vtnet.4 _if_wpi.4= if_wpi.4 _imcsmb.4= imcsmb.4 _ipmi.4= ipmi.4 @@ -849,15 +848,8 @@ _superio.4= superio.4 _tpm.4= tpm.4 _urtw.4= urtw.4 _viawd.4= viawd.4 -_virtio.4= virtio.4 -_virtio_balloon.4=virtio_balloon.4 -_virtio_blk.4= virtio_blk.4 -_virtio_console.4=virtio_console.4 -_virtio_random.4= virtio_random.4 -_virtio_scsi.4= virtio_scsi.4 _vmci.4= vmci.4 _vmx.4= vmx.4 -_vtnet.4= vtnet.4 _wbwd.4= wbwd.4 _wpi.4= wpi.4 _xen.4= xen.4 @@ -895,16 +887,8 @@ _nvram2env.4= nvram2env.4 .endif .if ${MACHINE_CPUARCH} == "powerpc" -_if_vtnet.4= if_vtnet.4 _nvd.4= nvd.4 _nvme.4= nvme.4 -_virtio.4= virtio.4 -_virtio_balloon.4=virtio_balloon.4 -_virtio_blk.4= virtio_blk.4 -_virtio_console.4=virtio_console.4 -_virtio_random.4= virtio_random.4 -_virtio_scsi.4= virtio_scsi.4 -_vtnet.4= vtnet.4 .endif .if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "aarch64" || \ diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 320f4002f817..f5dd13527f08 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -376,7 +376,7 @@ SUBDIR= \ unionfs \ usb \ ${_vesa} \ - ${_virtio} \ + virtio \ vge \ ${_viawd} \ videomode \ @@ -722,7 +722,6 @@ _tpm= tpm _twa= twa _vesa= vesa _viawd= viawd -_virtio= virtio _wpi= wpi .if ${MK_SOURCELESS_UCODE} != "no" _wpifw= wpifw @@ -794,7 +793,6 @@ _ffec= ffec _nvd= nvd _nvme= nvme _pccard= pccard -_virtio= virtio .endif .if ${MACHINE_ARCH:Mpowerpc64*} != "" From owner-dev-commits-src-main@freebsd.org Thu Jan 21 01:56:13 2021 Return-Path: Delivered-To: dev-commits-src-main@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 DC9BC4E2353; Thu, 21 Jan 2021 01:56:13 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLlqK5tzgz4dLp; Thu, 21 Jan 2021 01:56:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCE31238C4; Thu, 21 Jan 2021 01:56:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L1uDfv091850; Thu, 21 Jan 2021 01:56:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L1uDxM091849; Thu, 21 Jan 2021 01:56:13 GMT (envelope-from git) Date: Thu, 21 Jan 2021 01:56:13 GMT Message-Id: <202101210156.10L1uDxM091849@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 5faeda903753 - main - Rename i386's Linux ELF to Linux ELF32 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5faeda903753d20a7a857167a68713d1659474e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 01:56:13 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=5faeda903753d20a7a857167a68713d1659474e1 commit 5faeda903753d20a7a857167a68713d1659474e1 Author: Jessica Clarke AuthorDate: 2021-01-21 01:54:12 +0000 Commit: Jessica Clarke CommitDate: 2021-01-21 01:54:12 +0000 Rename i386's Linux ELF to Linux ELF32 This is what amd64 calls the i386 Linux ABI in order to distinguish it from the amd64 Linux ABI, and matches the nomenclature used for the FreeBSD ABIs where they always have the size suffix in the name. Reviewed by: trasz Differential Revision: https://reviews.freebsd.org/D27647 --- sys/i386/linux/linux_sysvec.c | 2 +- usr.bin/truss/setup.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 7bd1102e48a0..10229d8af57e 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -882,7 +882,7 @@ struct sysentvec elf_linux_sysvec = { .sv_sendsig = linux_sendsig, .sv_sigcode = &_binary_linux_locore_o_start, .sv_szsigcode = &linux_szsigcode, - .sv_name = "Linux ELF", + .sv_name = "Linux ELF32", .sv_coredump = elf32_coredump, .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c index 172d7d5d366c..d21ec133f483 100644 --- a/usr.bin/truss/setup.c +++ b/usr.bin/truss/setup.c @@ -141,7 +141,7 @@ static struct procabi_table abis[] = { { "Linux ELF64", &linux }, { "Linux ELF32", &linux32 }, #else - { "Linux ELF", &linux }, + { "Linux ELF32", &linux }, #endif }; From owner-dev-commits-src-main@freebsd.org Thu Jan 21 01:56:15 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6470B4E22C7; Thu, 21 Jan 2021 01:56:15 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLlqL6NtSz4dB4; Thu, 21 Jan 2021 01:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD71523AB0; Thu, 21 Jan 2021 01:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L1uEah091870; Thu, 21 Jan 2021 01:56:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L1uEI4091869; Thu, 21 Jan 2021 01:56:14 GMT (envelope-from git) Date: Thu, 21 Jan 2021 01:56:14 GMT Message-Id: <202101210156.10L1uEI4091869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 513c5cd8276c - main - linux64: Don't pass unnecessary -S and -g to objcopy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 513c5cd8276c262e4f81e5d3a717f3725a835d56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 01:56:15 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=513c5cd8276c262e4f81e5d3a717f3725a835d56 commit 513c5cd8276c262e4f81e5d3a717f3725a835d56 Author: Jessica Clarke AuthorDate: 2021-01-21 01:54:52 +0000 Commit: Jessica Clarke CommitDate: 2021-01-21 01:54:52 +0000 linux64: Don't pass unnecessary -S and -g to objcopy Since we use --input-type binary these options are rather meaningless. Both binutils and elftoolchain ignore the option in this case, but LLVM does not, and instead strips all symbols from the output file, causing missing symbols at run time if building with llvm-objcopy. Thus simply remove the options; the linux module has never included them for building its VDSO (added in r283407), but for some reason the original commit of linux64 (r283424) added them. These should however eventually be changed to use template assembly files as is now done for firmware and MFS_IMAGE. Reviewed by: emaste, trasz Differential Revision: https://reviews.freebsd.org/D27740 --- sys/modules/linux64/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile index 91b419558d82..ebc69168bd4a 100644 --- a/sys/modules/linux64/Makefile +++ b/sys/modules/linux64/Makefile @@ -50,7 +50,7 @@ OBJCOPY_TARGET=--output-target elf64-x86-64 --binary-architecture i386:x86-64 .error ${MACHINE_CPUARCH} not yet supported by linux64 .endif ${VDSO}.so: linux_locore.o - ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} -S -g \ + ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} \ linux_locore.o ${.TARGET} ${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET} From owner-dev-commits-src-main@freebsd.org Thu Jan 21 02:18:31 2021 Return-Path: Delivered-To: dev-commits-src-main@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 701084E30AF; Thu, 21 Jan 2021 02:18:31 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLmK32nrbz4fl8; Thu, 21 Jan 2021 02:18:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 534C823C5D; Thu, 21 Jan 2021 02:18:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L2IVUN018613; Thu, 21 Jan 2021 02:18:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L2IVEE018612; Thu, 21 Jan 2021 02:18:31 GMT (envelope-from git) Date: Thu, 21 Jan 2021 02:18:31 GMT Message-Id: <202101210218.10L2IVEE018612@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 85ad7f8da19f - main - virtio_mmio: Delete a stale #if 0'ed debug print MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 85ad7f8da19fbd5985690d4ccfcc45952713dd1b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 02:18:31 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=85ad7f8da19fbd5985690d4ccfcc45952713dd1b commit 85ad7f8da19fbd5985690d4ccfcc45952713dd1b Author: Jessica Clarke AuthorDate: 2021-01-21 02:14:41 +0000 Commit: Jessica Clarke CommitDate: 2021-01-21 02:14:41 +0000 virtio_mmio: Delete a stale #if 0'ed debug print This was blindly moved in r360722 but the variable being printed is not yet initialised. It's of little use and can easily be added back in the right place if needed by someone debugging, so just delete it. Reported by: bryanv --- sys/dev/virtio/mmio/virtio_mmio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/dev/virtio/mmio/virtio_mmio.c b/sys/dev/virtio/mmio/virtio_mmio.c index 862272b917df..5672a6f0f69c 100644 --- a/sys/dev/virtio/mmio/virtio_mmio.c +++ b/sys/dev/virtio/mmio/virtio_mmio.c @@ -478,10 +478,7 @@ vtmmio_set_virtqueue(struct vtmmio_softc *sc, struct virtqueue *vq, vm_paddr_t paddr; vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_NUM, size); -#if 0 - device_printf(dev, "virtqueue paddr 0x%08lx\n", - (uint64_t)paddr); -#endif + if (sc->vtmmio_version == 1) { vtmmio_write_config_4(sc, VIRTIO_MMIO_QUEUE_ALIGN, VIRTIO_MMIO_VRING_ALIGN); From owner-dev-commits-src-main@freebsd.org Thu Jan 21 03:58:40 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6297D4E7C72; Thu, 21 Jan 2021 03:58:40 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLpXc1s4Mz4pQX; Thu, 21 Jan 2021 03:58:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28481254A5; Thu, 21 Jan 2021 03:58:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L3weGn048955; Thu, 21 Jan 2021 03:58:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L3weTH048954; Thu, 21 Jan 2021 03:58:40 GMT (envelope-from git) Date: Thu, 21 Jan 2021 03:58:40 GMT Message-Id: <202101210358.10L3weTH048954@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 26490d9b74f0 - main - pkgbase: allow update-packages for first-run of packaging MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 26490d9b74f0bdefbb9df74dcd285ecd08e0a961 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 03:58:40 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=26490d9b74f0bdefbb9df74dcd285ecd08e0a961 commit 26490d9b74f0bdefbb9df74dcd285ecd08e0a961 Author: Kyle Evans AuthorDate: 2021-01-18 20:11:58 +0000 Commit: Kyle Evans CommitDate: 2021-01-21 03:58:30 +0000 pkgbase: allow update-packages for first-run of packaging If ${REPODIR}/${PKG_ABI} does not exist when we begin real-update-packages, skip the comparison with the non-existent previous repository and just finish the repo off. This allows external scripts to just assume they can run `update-packages` rather than figuring out if they'd previously run `packages` for this Version/Arch combo. PKG_VERSION_FROM_DIR was added so that we could perhaps detect the three distinct cases: 1.) If the repo has not yet been created, PKG_VERSION_FROM_DIR will be empty. 2.) If the repo is in some intermediate state between created and fully initialized, PKG_VERSION_FROM_DIR may point to the ABI directory. 3.) If the repo is fully initialized, then PKG_VERSION_FROM_DIR points to the latest build to compare to. Option #2 is explicitly unhandled at the moment, but this is no different than it was before. Reviewed-by: manu Differential-Revision: https://reviews.freebsd.org/D28229 --- Makefile.inc1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 969e3d67cd05..d9ef01eefde5 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1876,7 +1876,13 @@ PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI .if !defined(PKG_VERSION_FROM) && make(real-update-packages) .if defined(PKG_ABI) +.if exists(${REPODIR}/${PKG_ABI}) PKG_VERSION_FROM!=/usr/bin/readlink ${REPODIR}/${PKG_ABI}/latest +PKG_VERSION_FROM_DIR= ${REPODIR}/${PKG_ABI}/${PKG_VERSION_FROM} +.else +PKG_VERSION_FROM= +PKG_VERSION_FROM_DIR= +.endif .endif .endif @@ -1900,8 +1906,11 @@ real-packages: stage-packages create-packages sign-packages .PHONY real-update-packages: stage-packages .PHONY ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} create-packages +.if empty(PKG_VERSION_FROM_DIR) + @echo "==> Bootstrapping repository, not checking for new packages" +.else @echo "==> Checking for new packages (comparing ${PKG_VERSION} to ${PKG_VERSION_FROM})" - @for pkg in ${REPODIR}/${PKG_ABI}/${PKG_VERSION_FROM}/${PKG_NAME_PREFIX}-*; do \ + @for pkg in ${PKG_VERSION_FROM_DIR}/${PKG_NAME_PREFIX}-*; do \ pkgname=$$(pkg query -F $${pkg} '%n' | sed 's/${PKG_NAME_PREFIX}-\(.*\)/\1/') ; \ newpkgname=${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION}.${PKG_FORMAT} ; \ oldsum=$$(pkg query -F $${pkg} '%X') ; \ @@ -1917,6 +1926,7 @@ real-update-packages: stage-packages .PHONY echo "==> New package $${newpkgname}" ; \ fi ; \ done +.endif ${_+_}@cd ${.CURDIR}; \ ${MAKE} -f Makefile.inc1 PKG_VERSION=${PKG_VERSION} sign-packages From owner-dev-commits-src-main@freebsd.org Thu Jan 21 04:19:00 2021 Return-Path: Delivered-To: dev-commits-src-main@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 46A544E8873; Thu, 21 Jan 2021 04:19:00 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DLq041XwDz4qSg; Thu, 21 Jan 2021 04:19:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27F67257E1; Thu, 21 Jan 2021 04:19:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10L4J0Ml075353; Thu, 21 Jan 2021 04:19:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10L4J0oT075352; Thu, 21 Jan 2021 04:19:00 GMT (envelope-from git) Date: Thu, 21 Jan 2021 04:19:00 GMT Message-Id: <202101210419.10L4J0oT075352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: ff751ee05c93 - main - Remove FirstBurstLength limit for software iSCSI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff751ee05c939eceab25c26ad60b1d56f989aec9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 04:19:00 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ff751ee05c939eceab25c26ad60b1d56f989aec9 commit ff751ee05c939eceab25c26ad60b1d56f989aec9 Author: Alexander Motin AuthorDate: 2021-01-21 02:33:14 +0000 Commit: Alexander Motin CommitDate: 2021-01-21 04:17:12 +0000 Remove FirstBurstLength limit for software iSCSI. For hardware offload solicited data may potentially be handled more efficiently than unsolicited due to direct data placement. Or there can be some unsolicited write buffering limitations. It may create situations where FirstBurstLength limit is really useful. Software driver though has no those factors, having to do memcopy() any way and having no so hard limit on the temporary storage. Same time more active use of unsolicited transfers allows to avoid some of Ready To Transfer (R2T) PDU round-trip times and processing. This change effectively doubles from 64KB to 128KB the maximum size of write command that can be transferred within one link RTT. Tests of (64KB, 128KB] QD1 writes mixed with simultaneous QD8 reads over the same connection, increasing RTT, shows almost double write speed and half latency, while we should be able to afford few megabytes of RAM for additional buffering on a target these days. MFC after: 2 weeks Sponsored by: iXsystems, Inc. --- sys/dev/iscsi/icl_soft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index bd4d9db81bb0..41d20b4abf69 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -1523,7 +1523,7 @@ icl_soft_limits(struct icl_drv_limits *idl) idl->idl_max_recv_data_segment_length = 128 * 1024; idl->idl_max_send_data_segment_length = 128 * 1024; idl->idl_max_burst_length = 262144; - idl->idl_first_burst_length = 65536; + idl->idl_first_burst_length = idl->idl_max_burst_length; return (0); } From owner-dev-commits-src-main@freebsd.org Thu Jan 21 10:36:48 2021 Return-Path: Delivered-To: dev-commits-src-main@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 DF1A84F1138; Thu, 21 Jan 2021 10:36:48 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DLzN01dwQz3k0v; Thu, 21 Jan 2021 10:36:47 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x333.google.com with SMTP id 190so1012778wmz.0; Thu, 21 Jan 2021 02:36:47 -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:content-transfer-encoding; bh=/GJe7RaNHEah7hbkvVFWl5abFxH1NvTN8kfo3RI8Rlo=; b=gh7ulUDTHlPZfdC8/rJY1qTXj0cOQS9PBTFBRLDBQ4rCHoOlRXMu0xM5LYozsfj5x3 DY+t2XWGjF5Vpi9zy873pUjwGqbl3s56d3SzwpvSRTUCoQB8T36PIzhP9FipUm77sqoM Um4lJ9GBPlu/L8Oe5IzIbiYv32d/v/csaQq2TIBVU1IqIHjpQTDIhsNLZzijCIn8IykM O21diinatc9saZMZ+75kf5vTLulDp0MDmlzmLcgA2IvY4aX5nA1lbEtZh/e6g9+YBygo 4gEqzqkfYW9QlYDPYt5eIj8Ygir7vl1a6zpbobQ6cQZIRW0Bm6Ha4Hcvx/UcAK3BHlpQ wJsA== 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:content-transfer-encoding; bh=/GJe7RaNHEah7hbkvVFWl5abFxH1NvTN8kfo3RI8Rlo=; b=N1fd5L4AmTSaftWnFUUb6qvhY8M2CQf6vN8ZOgA1qFkccLRnYWRCOY/baE1dvU+FRZ J3JnTHF7NSu+rFNxFYWRM1k7rReNBTpvtpes7U6WLyZaBE74dOj+zjUfhczhzD5E5oja Iq+1310zh/VVayi30MZ5q7NUH8NRHGG9tzktxH4JR7eLfeQ2dpxcxIL4Lk24CsUKqf9t FxlJdOlLmEBEmMupNCjmV9SJ3xaCHe/AlFKjWCcFW5TmJudk8NHfhSY2J/WQQIXXcRU6 u4tsPtO4f1YatJK0txjjZTQesBkQPCE1Q7XGM0ZDvavlktc066aqXbME+DzzpMwd6p/C 2lDw== X-Gm-Message-State: AOAM531PiHOYuVPXA7l5DfL91XqkiEsiQpI/8f7oZJakd9lGS+xb/YcJ iOhzqS9hjvHkiVNgSQanosYwNwf9K6V0vx4SSWRvPn/caOI= X-Google-Smtp-Source: ABdhPJyzpnzu3fplwXac8SJ5ZCCoy+EIFGNf3VaYuY8yu/sFskeoO7NCT9J0s402kZD/CGPyYe9H6qW6HAU20TXqiLk= X-Received: by 2002:a1c:bbc6:: with SMTP id l189mr1615906wmf.187.1611225405371; Thu, 21 Jan 2021 02:36:45 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:464c:0:0:0:0:0 with HTTP; Thu, 21 Jan 2021 02:36:43 -0800 (PST) In-Reply-To: <202101200949.10K9nmkZ029085@gitrepo.freebsd.org> References: <202101200949.10K9nmkZ029085@gitrepo.freebsd.org> From: Mateusz Guzik Date: Thu, 21 Jan 2021 11:36:43 +0100 Message-ID: Subject: Re: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) To: =?UTF-8?Q?Ulrich_Sp=C3=B6rlein?= Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4DLzN01dwQz3k0v X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=gh7ulUDT; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::333 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::333:from]; 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:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::333:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::333:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 10:36:48 -0000 I'm getting an error with this: $ make -s buildkernel MODULES_OVERRIDE=3D"" /tank/users/mjg/src/freebsd/sys/conf/newvers.sh: git: not found On 1/20/21, Ulrich Sp=C3=B6rlein wrote: > The branch main has been updated by uqs: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3Da9fc14fbf445cffd18f34f6a602bdba= 84bb5a867 > > commit a9fc14fbf445cffd18f34f6a602bdba84bb5a867 > Author: Michael Osipov > AuthorDate: 2021-01-05 10:48:39 +0000 > Commit: Ulrich Sp=C3=B6rlein > CommitDate: 2021-01-20 09:48:27 +0000 > > newvers.sh: add support for gitup(1) > > gitup writes a .gituprevision file into the shallow clone directory. > Read that > file and print commit information only. > > Submitted by: Michael Osipov > Pull Request: https://github.com/freebsd/freebsd-src/pull/449 > > While here, drop the redundant branch name from the git output and do= n't > count commits in shallow clones. > > Reported by: Michael Osipov > MFC after: 2 weeks > --- > sys/conf/newvers.sh | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > > diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh > index 2a0ace45f2f6..92c275d19fb9 100644 > --- a/sys/conf/newvers.sh > +++ b/sys/conf/newvers.sh > @@ -221,6 +221,10 @@ if findvcs .git; then > done > fi > > +if findvcs .gituprevision; then > + gituprevision=3D"${VCSTOP}/.gituprevision" > +fi > + > if findvcs .hg; then > for dir in /usr/bin /usr/local/bin; do > if [ -x "${dir}/hg" ] ; then > @@ -248,13 +252,11 @@ fi > > if [ -n "$git_cmd" ] ; then > git=3D$($git_cmd rev-parse --verify --short HEAD 2>/dev/null) > - git_cnt=3D$($git_cmd rev-list --count HEAD 2>/dev/null) > - if [ -n "$git_cnt" ] ; then > - git=3D"c${git_cnt}-g${git}" > - fi > - git_b=3D$($git_cmd rev-parse --abbrev-ref HEAD) > - if [ -n "$git_b" -a "$git_b" !=3D "HEAD" ] ; then > - git=3D"${git_b}-${git}" > + if [ "$(git rev-parse --is-shallow-repository)" =3D false ] ; then > + git_cnt=3D$($git_cmd rev-list --count HEAD 2>/dev/null) > + if [ -n "$git_cnt" ] ; then > + git=3D"c${git_cnt}-g${git}" > + fi > fi > if git_tree_modified; then > git=3D"${git}-dirty" > @@ -263,6 +265,10 @@ if [ -n "$git_cmd" ] ; then > git=3D" ${git}" > fi > > +if [ -n "$gituprevision" ] ; then > + gitup=3D" $(awk -F: '{print $2}' $gituprevision)" > +fi > + > if [ -n "$hg_cmd" ] ; then > hg=3D$($hg_cmd id 2>/dev/null) > hgsvn=3D$($hg_cmd svn info 2>/dev/null | \ > @@ -277,10 +283,10 @@ fi > > [ ${include_metadata} =3D "if-modified" -a ${modified} =3D "yes" ] && > include_metadata=3Dyes > if [ ${include_metadata} !=3D "yes" ]; then > - VERINFO=3D"${VERSION}${svn}${git}${hg} ${i}" > + VERINFO=3D"${VERSION}${svn}${git}${gitup}${hg} ${i}" > VERSTR=3D"${VERINFO}\\n" > else > - VERINFO=3D"${VERSION} #${v}${svn}${git}${hg}: ${t}" > + VERINFO=3D"${VERSION} #${v}${svn}${git}${gitup}${hg}: ${t}" > VERSTR=3D"${VERINFO}\\n ${u}@${h}:${d}\\n" > fi > > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to > "dev-commits-src-all-unsubscribe@freebsd.org" > --=20 Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Thu Jan 21 12:56:31 2021 Return-Path: Delivered-To: dev-commits-src-main@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 DAF134F454B; Thu, 21 Jan 2021 12:56:31 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DM2TC5tZNz3s9S; Thu, 21 Jan 2021 12:56:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE4B94535; Thu, 21 Jan 2021 12:56:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LCuVGb053219; Thu, 21 Jan 2021 12:56:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LCuV9f053218; Thu, 21 Jan 2021 12:56:31 GMT (envelope-from git) Date: Thu, 21 Jan 2021 12:56:31 GMT Message-Id: <202101211256.10LCuV9f053218@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f7d181543fd9 - main - elf: add some definitions for i386 and amd64 relocations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7d181543fd96a89b84878ddb2d5ac010fadd9b8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 12:56:31 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f7d181543fd96a89b84878ddb2d5ac010fadd9b8 commit f7d181543fd96a89b84878ddb2d5ac010fadd9b8 Author: Konstantin Belousov AuthorDate: 2021-01-17 07:03:31 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-21 12:55:31 +0000 elf: add some definitions for i386 and amd64 relocations I believe that rtld does not need to implement them, they are mostly for the static linker. 'Mostly' because for amd64 our kernel linker loads object files, and amd64 relocation types could be observed. Defines were taken from glibc sources. MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28205 --- sys/sys/elf_common.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/sys/elf_common.h b/sys/sys/elf_common.h index 5724397754e7..76bda8f71f3b 100644 --- a/sys/sys/elf_common.h +++ b/sys/sys/elf_common.h @@ -990,12 +990,17 @@ typedef struct { #define R_386_RELATIVE 8 /* Add load address of shared object. */ #define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */ #define R_386_GOTPC 10 /* Add PC-relative GOT table address. */ +#define R_386_32PLT 11 #define R_386_TLS_TPOFF 14 /* Negative offset in static TLS block */ #define R_386_TLS_IE 15 /* Absolute address of GOT for -ve static TLS */ #define R_386_TLS_GOTIE 16 /* GOT entry for negative static TLS block */ #define R_386_TLS_LE 17 /* Negative offset relative to static TLS */ #define R_386_TLS_GD 18 /* 32 bit offset to GOT (index,off) pair */ #define R_386_TLS_LDM 19 /* 32 bit offset to GOT (index,zero) pair */ +#define R_386_16 20 +#define R_386_PC16 21 +#define R_386_8 22 +#define R_386_PC8 23 #define R_386_TLS_GD_32 24 /* 32 bit offset to GOT (index,off) pair */ #define R_386_TLS_GD_PUSH 25 /* pushl instruction for Sun ABI GD sequence */ #define R_386_TLS_GD_CALL 26 /* call instruction for Sun ABI GD sequence */ @@ -1010,7 +1015,12 @@ typedef struct { #define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */ #define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */ #define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */ +#define R_386_SIZE32 38 +#define R_386_TLS_GOTDESC 39 +#define R_386_TLS_DESC_CALL 40 +#define R_386_TLS_DESC 41 #define R_386_IRELATIVE 42 /* PLT entry resolved indirectly at runtime */ +#define R_386_GOT32X 43 #define R_AARCH64_NONE 0 /* No relocation */ #define R_AARCH64_ABS64 257 /* Absolute offset */ @@ -1472,6 +1482,10 @@ typedef struct { #define R_X86_64_TLSDESC_CALL 35 #define R_X86_64_TLSDESC 36 #define R_X86_64_IRELATIVE 37 +#define R_X86_64_RELATIVE64 38 +/* 39 and 40 were BND-related, already decomissioned */ +#define R_X86_64_GOTPCRELX 41 +#define R_X86_64_REX_GOTPCRELX 42 #define ELF_BSDF_SIGFASTBLK 0x0001 /* Kernel supports fast sigblock */ From owner-dev-commits-src-main@freebsd.org Thu Jan 21 12:58:09 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0AC294F4994; Thu, 21 Jan 2021 12:58:09 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DM2W46wjnz3sFV; Thu, 21 Jan 2021 12:58:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0D5D41F8; Thu, 21 Jan 2021 12:58:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LCw89Q053594; Thu, 21 Jan 2021 12:58:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LCw8PA053593; Thu, 21 Jan 2021 12:58:08 GMT (envelope-from git) Date: Thu, 21 Jan 2021 12:58:08 GMT Message-Id: <202101211258.10LCw8PA053593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9f47eeffa3cf - main - x86: switch kernel TSC timecounter to RDTSCP on AMD Zen CPUs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9f47eeffa3cfdcb512e2011fb00fc23c7c1a7d75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 12:58:09 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9f47eeffa3cfdcb512e2011fb00fc23c7c1a7d75 commit 9f47eeffa3cfdcb512e2011fb00fc23c7c1a7d75 Author: Konstantin Belousov AuthorDate: 2021-01-21 12:53:15 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-21 12:55:31 +0000 x86: switch kernel TSC timecounter to RDTSCP on AMD Zen CPUs Reported by: many Tested by: gallatin, mikael, rhurlin MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/x86/x86/tsc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index 85924df98312..de0a1505c2f6 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -633,19 +633,12 @@ init: /* * Timecounter implementation selection, top to bottom: - * - For AMD Zens and newer, use LFENCE;RDTSC. * - If RDTSCP is available, use RDTSCP. * - If fence instructions are provided (SSE2), use LFENCE;RDTSC * on Intel, and MFENCE;RDTSC on AMD. * - For really old CPUs, just use RDTSC. */ - if ((cpu_vendor_id == CPU_VENDOR_AMD || - cpu_vendor_id == CPU_VENDOR_HYGON) && - CPUID_TO_FAMILY(cpu_id) >= 0x17) { - tsc_timecounter.tc_get_timecount = shift > 0 ? - tsc_get_timecount_low_lfence : - tsc_get_timecount_lfence; - } else if ((amd_feature & AMDID_RDTSCP) != 0) { + if ((amd_feature & AMDID_RDTSCP) != 0) { tsc_timecounter.tc_get_timecount = shift > 0 ? tscp_get_timecount_low : tscp_get_timecount; } else if ((cpu_feature & CPUID_SSE2) != 0 && mp_ncpus > 1) { From owner-dev-commits-src-main@freebsd.org Thu Jan 21 12:58:10 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2BCDC4F4747; Thu, 21 Jan 2021 12:58:10 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DM2W60qzWz3sBl; Thu, 21 Jan 2021 12:58:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 100A5470F; Thu, 21 Jan 2021 12:58:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LCw9Qw053615; Thu, 21 Jan 2021 12:58:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LCw9wA053614; Thu, 21 Jan 2021 12:58:09 GMT (envelope-from git) Date: Thu, 21 Jan 2021 12:58:09 GMT Message-Id: <202101211258.10LCw9wA053614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 523d94dbeab5 - main - x86: switch vdso TSC timecounter to RDTSCP on AMD Zen CPUs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 523d94dbeab5ccb1cce21b8cad350b700c3d01b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 12:58:10 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=523d94dbeab5ccb1cce21b8cad350b700c3d01b2 commit 523d94dbeab5ccb1cce21b8cad350b700c3d01b2 Author: Konstantin Belousov AuthorDate: 2021-01-21 12:54:28 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-21 12:55:31 +0000 x86: switch vdso TSC timecounter to RDTSCP on AMD Zen CPUs Reported by: many Tested by: gallatin, mikael, rhurlin MFC after: 1 week Sponsored by: The FreeBSD Foundation --- lib/libc/x86/sys/__vdso_gettc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index 7f224f8758cb..7a64f2a0b556 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -125,7 +125,7 @@ struct tsc_selector_tag { }; static const struct tsc_selector_tag tsc_selector[] = { - [0] = { /* Intel or AMD Zen+, LFENCE */ + [0] = { /* Intel, LFENCE */ .ts_rdtsc32 = rdtsc32_mb_lfence, .ts_rdtsc_low = rdtsc_low_mb_lfence, }, @@ -164,9 +164,6 @@ tsc_selector_idx(u_int cpu_feature) do_cpuid(1, p); cpu_id = p[0]; - if (amd_cpu && CPUID_TO_FAMILY(cpu_id) >= 0x17) - return (0); - if (cpu_feature != 0) { do_cpuid(0x80000000, p); cpu_exthigh = p[0]; From owner-dev-commits-src-main@freebsd.org Thu Jan 21 14:21:39 2021 Return-Path: Delivered-To: dev-commits-src-main@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 CCC3D4F5AFA; Thu, 21 Jan 2021 14:21:39 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DM4MR5QKsz4S0J; Thu, 21 Jan 2021 14:21:39 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f49.google.com with SMTP id q129so4307626iod.0; Thu, 21 Jan 2021 06:21:39 -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=u6YgNO3CpkVRmLJnK936VOcFPDKUIhszwwXawDKhtBk=; b=tLzxPUc0fOAnQxj6/qPeOC4aM42Knpkaq4Kdk8vcLHjWv2WGWi3E/VKAE5D3WQ90x3 gNPakDFqQJr3GOC43yjk+zfituqcc/+CN4Ocu7R9luLz+vkebB+ZVSAxTHHA8c5RvJZT 5dDVcnXDNIJXN2uiOhJTtlhN5mIWmPejkhNclwPrxvZIOxE8JSlr9gCBkK7x2RvfFpHd igz0vGphlucv4WEhgsETOzEDGP6NI5994mnh9HLo8Xqk8LKCFDQAA99e4TY5G56KvhvO sQEsC3k8I4QhQXdEBzuSyCSoEB7w7OEwgBlTY/yHB7wqQHNjoANrqTgcY5a5/k/jN3to 7tEw== X-Gm-Message-State: AOAM530bpN3QSqgD3NZdovytQYeKmiMePDtSUfIhDG7k+zb9y7xPI6uy ILarQzR25GVIKpe29tDlYBu3nGpRc9D1sWJADog= X-Google-Smtp-Source: ABdhPJwF5+0RNgF7Gg6MBt40BAytQ62xOAY3ONmrQXZ0zgzRqrVgQXW/mXXG+DQdZFahWV8qdcvNXIfHAF6TKB5mpsU= X-Received: by 2002:a05:6602:2e14:: with SMTP id o20mr10779732iow.179.1611238898824; Thu, 21 Jan 2021 06:21:38 -0800 (PST) MIME-Version: 1.0 References: <202101200949.10K9nmkZ029085@gitrepo.freebsd.org> In-Reply-To: From: Ed Maste Date: Thu, 21 Jan 2021 09:21:14 -0500 Message-ID: Subject: Re: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) To: Mateusz Guzik Cc: =?UTF-8?Q?Ulrich_Sp=C3=B6rlein?= , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DM4MR5QKsz4S0J X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 14:21:39 -0000 On Thu, 21 Jan 2021 at 05:37, Mateusz Guzik wrote: > > I'm getting an error with this: > > $ make -s buildkernel MODULES_OVERRIDE="" > > /tank/users/mjg/src/freebsd/sys/conf/newvers.sh: git: not found > > > + if [ "$(git rev-parse --is-shallow-repository)" = false ] ; then ^^^ Looks like this bare git should be $git_cmd, can you confirm that change fixes it? From owner-dev-commits-src-main@freebsd.org Thu Jan 21 14:32:46 2021 Return-Path: Delivered-To: dev-commits-src-main@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 CE5D24F6362; Thu, 21 Jan 2021 14:32:46 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DM4cG5FgPz4SPG; Thu, 21 Jan 2021 14:32:46 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x42c.google.com with SMTP id m4so1950559wrx.9; Thu, 21 Jan 2021 06:32:46 -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=2Q960Aad5NuVvnrg0WsVlSkutmUP2x7KhUPEyQNIi9U=; b=BUm5t0aUtqU2t+oAFaVJyVCs0m2vZGktBeizfbpIrlXxO6iWl7XKY/jXG2iHj6WlmX 3DpSRJMhD5ins/tMXHOuqlRQoAnUWv6symBqPo09/3iqbkOGfLMn4mCHf8eX4kr647+R LBmX52dfPhkLLliESc8eqpzta0TnunhcnqewBohpdih4lcb77xqCYl+H+DEsh3jYLpFB V0IOh73cweNZgtW5iwVD86anMXzMLcxRUyLceXjh/aLH6LHSxQx0e40oZDEAua3XKABz oF0sVfI8fKkXWDkngRKtl27yZhCwiXBy7x232JhMOrmzt4Dy0yBvghRou/3X6sznA3hA 2Ljg== 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=2Q960Aad5NuVvnrg0WsVlSkutmUP2x7KhUPEyQNIi9U=; b=dF8rmy+prO78uggZJnSN9GGTf08AI5Lb0JawFn+wPi6wtEjaqEHzJlrqJJngvuRYmL 7x4HENl1lxATY99govslJG6PEp7c7C5KmBE8QsPloDzgPIL5Awtfq0/lz0AIRZ9shril l9Ckur1K7pE/eZYoCcCsGJftpxbLbS/JRp0PsTQruUBoSwGq6vm0VA4XcU62fxs75m0Z MP4PrhbnUkJhuDvR1URiUC+GG1OcDmErSaPBuKV4jHZraCo8imxyfUmOR4PW1X8A5Thg +oeIH8flNMvj0BzEdl/Y1rn+6TIcGkkN3HtxawSv80Dc1pfxy1qZpF3i5zlc8XkIfX7B d1Sg== X-Gm-Message-State: AOAM531mHDcdRDW4XOB8uq9EBblwmtfuOSPI93khawmINfcrOd1O+XtS BqpUeFGdCxuQ4nxn0u2xzN9QBi2M2EPFjjqd4brqvhQXa+Y= X-Google-Smtp-Source: ABdhPJxqB0HF9YyAvJiaOg1Gb/ttt5feq4YmDNccnCV6koFajDhMix9AGxIhkkCLb51ZhhFcwzTmf26ABfFAbh8DAsA= X-Received: by 2002:a05:6000:1565:: with SMTP id 5mr14875649wrz.109.1611239564571; Thu, 21 Jan 2021 06:32:44 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:464c:0:0:0:0:0 with HTTP; Thu, 21 Jan 2021 06:32:42 -0800 (PST) In-Reply-To: References: <202101200949.10K9nmkZ029085@gitrepo.freebsd.org> From: Mateusz Guzik Date: Thu, 21 Jan 2021 15:32:42 +0100 Message-ID: Subject: Re: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) To: Ed Maste Cc: =?UTF-8?Q?Ulrich_Sp=C3=B6rlein?= , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DM4cG5FgPz4SPG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 14:32:46 -0000 This fixes the problem at hand, but a new regression is shown: $ strings kernel | grep 'FreeBSD 13.0-ALPHA1' FreeBSD 13.0-ALPHA1 #47 c256181-gb06e91d1b700: Thu Jan 21 14:31:35 UTC 2021 branch name is no longer present. On 1/21/21, Ed Maste wrote: > On Thu, 21 Jan 2021 at 05:37, Mateusz Guzik wrote: >> >> I'm getting an error with this: >> >> $ make -s buildkernel MODULES_OVERRIDE="" >> >> /tank/users/mjg/src/freebsd/sys/conf/newvers.sh: git: not found >> >> > + if [ "$(git rev-parse --is-shallow-repository)" = false ] ; then > ^^^ > Looks like this bare git should be $git_cmd, can you confirm that > change fixes it? > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Thu Jan 21 14:41:28 2021 Return-Path: Delivered-To: dev-commits-src-main@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 03DA14F63DB for ; Thu, 21 Jan 2021 14:41:28 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DM4pH6Pmmz4TFR for ; Thu, 21 Jan 2021 14:41:27 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f47.google.com with SMTP id m2so1654892wmm.1 for ; Thu, 21 Jan 2021 06:41:27 -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:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=xi2cczPiYLKleoLOPrYNHSrBtY58sHT/r4WOc52/eBs=; b=eQPLPMcM7iPdBndqZM+ycs3Yhlg3I+IWDDwCQWp4oQZUtkoppJ8QporQNiTG9Ipqxy 1Iyj9XeLJr0Nn5/FinasSiT8YFX5Z6RuNBfhCDAD168/b9WyAD5QHXCcQTq9WA9YcKCg bhYWX3enhr/uVblL4LAMs3A7/BcDUWmLtaEus+B1ai2wO0cBpw42DHirw6U4j5nSti3y rLdrnJHnc2zP6/zMaXf8D1+W7xwzqPW7oUKD5jO9EduxWEgu91lMuRAcK9dpKeypT7g5 QhoPtR4Yhc8Bf3/F+ssQeS10aTSjgU2xECUC/dty6pALmzGbJu7dKh65LnQ/ymD2KnoG 6+AQ== X-Gm-Message-State: AOAM531122fvPNbo6zeRvXp4pTu/ZfgNucc+Pnbe/zinpjyf8IPEgsgT 1zKzOj63bpUAYROQyasR/M100A== X-Google-Smtp-Source: ABdhPJx1LqOhQs9kvNP6Zf7F9FEAgXb3WJuoLH2M54PGV/fiqqSyu77DSLA87zDssvUOKbMWQeZpkQ== X-Received: by 2002:a1c:9609:: with SMTP id y9mr9171829wmd.75.1611240086344; Thu, 21 Jan 2021 06:41:26 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id b11sm3163178wrp.60.2021.01.21.06.41.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 06:41:25 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) From: Jessica Clarke In-Reply-To: Date: Thu, 21 Jan 2021 14:41:24 +0000 Cc: Ed Maste , =?utf-8?Q?Ulrich_Sp=C3=B6rlein?= , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <49353415-D1B2-43D5-AC39-EF64F03EE512@freebsd.org> References: <202101200949.10K9nmkZ029085@gitrepo.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DM4pH6Pmmz4TFR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 14:41:28 -0000 On 21 Jan 2021, at 14:32, Mateusz Guzik wrote: > On 1/21/21, Ed Maste wrote: >> On Thu, 21 Jan 2021 at 05:37, Mateusz Guzik wrote: >>> >>> I'm getting an error with this: >>> >>> $ make -s buildkernel MODULES_OVERRIDE="" >>> >>> /tank/users/mjg/src/freebsd/sys/conf/newvers.sh: git: not found >>> >>>> + if [ "$(git rev-parse --is-shallow-repository)" = false ] ; then >> ^^^ >> Looks like this bare git should be $git_cmd, can you confirm that >> change fixes it? > > This fixes the problem at hand, but a new regression is shown: > > $ strings kernel | grep 'FreeBSD 13.0-ALPHA1' > FreeBSD 13.0-ALPHA1 #47 c256181-gb06e91d1b700: Thu Jan 21 14:31:35 UTC 2021 > > branch name is no longer present. See the commit message, though I'd argue it's not redundant in a lot of local development cases (i.e. anything other than main, stable/*, etc), and is actually rather useful. Jess From owner-dev-commits-src-main@freebsd.org Thu Jan 21 14:48:08 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1D1F74F674E; Thu, 21 Jan 2021 14:48:08 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DM4y00L9Pz4TXg; Thu, 21 Jan 2021 14:48:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F27235DA9; Thu, 21 Jan 2021 14:48:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LEm7hl096515; Thu, 21 Jan 2021 14:48:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LEm79w096514; Thu, 21 Jan 2021 14:48:07 GMT (envelope-from git) Date: Thu, 21 Jan 2021 14:48:07 GMT Message-Id: <202101211448.10LEm79w096514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Gallatin Subject: git: 0c864213ef1e - main - iflib: Fix a NULL pointer deref MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gallatin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c864213ef1ee440411e3bb6437ecc04273db86b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 14:48:08 -0000 The branch main has been updated by gallatin: URL: https://cgit.FreeBSD.org/src/commit/?id=0c864213ef1ee440411e3bb6437ecc04273db86b commit 0c864213ef1ee440411e3bb6437ecc04273db86b Author: Andrew Gallatin AuthorDate: 2021-01-21 14:45:15 +0000 Commit: Andrew Gallatin CommitDate: 2021-01-21 14:47:06 +0000 iflib: Fix a NULL pointer deref rxd_frag_to_sd() have pf_rv parameter as NULL with the current code. This patch fixes the NULL pointer dereference in that case thus avoiding a possible panic. Submitted by: rajesh1.kumar at amd.com Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D28115 --- sys/net/iflib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 4b4952122d1e..ea2c5789a7b5 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2654,7 +2654,8 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, bool unload, if_rxsd_t sd, } } else { fl->ifl_sds.ifsd_m[cidx] = NULL; - *pf_rv = PFIL_PASS; + if (pf_rv != NULL) + *pf_rv = PFIL_PASS; } if (unload && irf->irf_len != 0) From owner-dev-commits-src-main@freebsd.org Thu Jan 21 15:03:55 2021 Return-Path: Delivered-To: dev-commits-src-main@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 9E2F94F6AC9; Thu, 21 Jan 2021 15:03:55 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DM5JC43L2z4VQZ; Thu, 21 Jan 2021 15:03:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D8FC5CC2; Thu, 21 Jan 2021 15:03:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LF3tig021707; Thu, 21 Jan 2021 15:03:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LF3tK6021706; Thu, 21 Jan 2021 15:03:55 GMT (envelope-from git) Date: Thu, 21 Jan 2021 15:03:55 GMT Message-Id: <202101211503.10LF3tK6021706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 9e98065cf17d - main - newvers.sh: avoid bare git invocation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9e98065cf17d0e4831928a5acbd7bc75a351c7f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 15:03:55 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9e98065cf17d0e4831928a5acbd7bc75a351c7f6 commit 9e98065cf17d0e4831928a5acbd7bc75a351c7f6 Author: Ed Maste AuthorDate: 2021-01-21 15:00:20 +0000 Commit: Ed Maste CommitDate: 2021-01-21 15:03:39 +0000 newvers.sh: avoid bare git invocation git may not be in the path, and $git_cmd includes some commandline arguments. Reported by: mjg Tested by: mjg --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 92c275d19fb9..7d2ac14223b6 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -252,7 +252,7 @@ fi if [ -n "$git_cmd" ] ; then git=$($git_cmd rev-parse --verify --short HEAD 2>/dev/null) - if [ "$(git rev-parse --is-shallow-repository)" = false ] ; then + if [ "$($git_cmd rev-parse --is-shallow-repository)" = false ] ; then git_cnt=$($git_cmd rev-list --count HEAD 2>/dev/null) if [ -n "$git_cnt" ] ; then git="c${git_cnt}-g${git}" From owner-dev-commits-src-main@freebsd.org Thu Jan 21 15:16:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 670CA4F6E43; Thu, 21 Jan 2021 15:16:38 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DM5Zt2CMcz4WFj; Thu, 21 Jan 2021 15:16:38 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x32d.google.com with SMTP id m187so1766609wme.2; Thu, 21 Jan 2021 07:16:38 -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=b4DvCpHcXWa0906Mze3WjQNCpfAwGxOsS8G59j5B5LY=; b=Y17b/0rvIwtVK8jJ3dbDYzfq++x506GzpSyxgEPlTYJiJ6j9M+RHajYYvGuEQetYJ0 nmE0jh4Bh8OM4zxNgM/quXwCHVjYgH2rbnIaQT97oGkx8VZWkQcJtgcD+k4d5Jk7dFpi E1KBLKaHZB/9LsrP3en0rM8s6c7IueUIktA/NwA54yjCshDj/irbafO7by7ivoXOr0E1 YfpbvmrmzzifJboy2jE49PIqlQAMp8xSW1PhbNW86qYrZ/1izvazzw1KyCfuMqbs1CWK hcwp3syE2NOI+hfAziApyCUCgSjkMGqnEB9KYItz258OWtrzgrpzGeTwOXNKsUkEZGSL rhGA== 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=b4DvCpHcXWa0906Mze3WjQNCpfAwGxOsS8G59j5B5LY=; b=O6yEE5DWNK8M1TLwGqH4iR8LfI2Fb2Ps3BmOynJKUl2LcoONhBkjBs3myQG4YtRUNC Jzlp70ZeZkJ1gB6yn8AMMwAu7JDfkjlVN1i5jPnwgcQVQoZRQ6F1FJZlEl3AY3Jt7wq3 AdAp5jqm9fzC4ewnT82hrQD0bzgbrtmGS8fFX8BJFcHrcDFGQW+Vf1MYmbmAOE0OVsau worVQLDzCM7Rd2r2bG2SMzCK3vjEeYbT5n5O1CXNiQQdJ12dY7VpVUCgZEAS2HV8t6pM Kavrt/305aLKlqjwAZanRRwO7GendHGH8znrix0THqaDx2jxKnOWLQtRII+ksSvqNqw1 AQdg== X-Gm-Message-State: AOAM533sinqojk4AWqx9sZEcRXdx8jjbQIhhLyeKJ61mnPr/1aQ9mENr CEj9rmRNYo+zBGHo1lUd5V5sxZs9My0bjroe/0ZphGgVsE4= X-Google-Smtp-Source: ABdhPJxy2Z+azr1tzWRdnFwUQLyJLNW8tKjph4ZnPZwp4SkmGkwEGkAlvy5jbiXNJ4N/0rFpc3G9C0ySuWRotey9Bss= X-Received: by 2002:a1c:68d5:: with SMTP id d204mr9413470wmc.178.1611242195809; Thu, 21 Jan 2021 07:16:35 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:464c:0:0:0:0:0 with HTTP; Thu, 21 Jan 2021 07:16:34 -0800 (PST) In-Reply-To: <49353415-D1B2-43D5-AC39-EF64F03EE512@freebsd.org> References: <202101200949.10K9nmkZ029085@gitrepo.freebsd.org> <49353415-D1B2-43D5-AC39-EF64F03EE512@freebsd.org> From: Mateusz Guzik Date: Thu, 21 Jan 2021 16:16:34 +0100 Message-ID: Subject: Re: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) To: Jessica Clarke Cc: Ed Maste , =?UTF-8?Q?Ulrich_Sp=C3=B6rlein?= , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DM5Zt2CMcz4WFj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 15:16:38 -0000 On 1/21/21, Jessica Clarke wrote: > On 21 Jan 2021, at 14:32, Mateusz Guzik wrote: >> On 1/21/21, Ed Maste wrote: >>> On Thu, 21 Jan 2021 at 05:37, Mateusz Guzik wrote: >>>> >>>> I'm getting an error with this: >>>> >>>> $ make -s buildkernel MODULES_OVERRIDE="" >>>> >>>> /tank/users/mjg/src/freebsd/sys/conf/newvers.sh: git: not found >>>> >>>>> + if [ "$(git rev-parse --is-shallow-repository)" = false ] ; then >>> ^^^ >>> Looks like this bare git should be $git_cmd, can you confirm that >>> change fixes it? >> >> This fixes the problem at hand, but a new regression is shown: >> >> $ strings kernel | grep 'FreeBSD 13.0-ALPHA1' >> FreeBSD 13.0-ALPHA1 #47 c256181-gb06e91d1b700: Thu Jan 21 14:31:35 UTC >> 2021 >> >> branch name is no longer present. > > See the commit message, though I'd argue it's not redundant in a lot of > local development cases (i.e. anything other than main, stable/*, etc), > and is actually rather useful. > right While here, drop the redundant branch name from the git output and don't count commits in shallow clones. That's definitely a regression. If the branch name is really seen a spurious (why?), then perhaps it can be only skipped if name == main -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Thu Jan 21 15:21:11 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C77774F7392; Thu, 21 Jan 2021 15:21:11 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DM5h75Cnrz4WZj; Thu, 21 Jan 2021 15:21:11 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f50.google.com with SMTP id d13so4672689ioy.4; Thu, 21 Jan 2021 07:21:11 -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=/1S0OXeVx2PFBkqRKXAzLkAs09EOdJEEz7kc0sjc0cQ=; b=sUAaVtDWojS+zCDqe44W+Ur9zjWmAO/kEH5D0Gf3HsFd2zbaLoVVHqCVTs2lcE33PP eWiZWGEuPDfaX2zeuspIdK+6TKsQEv0t80bC9BPfLcsrTr9iamf15NuH5PFx1hbD9MJ1 631+Soff95nn1m5u1nU/cbQki82xW8W5x9SGj4rRz6Vv6QRFrUDVnk4yJ0uuNiS2M9pU O3NboJ5LRyTbBu+PTSoX6YPGmDi1snvBNJAppC4ok5rtn6OAE9WZXf48XnfjtoJ83GHQ 7eT9p6JmecEoYaVUTPmpqRTxuEEc/gOuqoygHlQMwIavH1SlsljM5drGm8416i48zsIN k4kg== X-Gm-Message-State: AOAM532AzYp102dEY4mupCbS7Ggk1Qnxqec//n9scFaARl6MoiEIDamz xd+hY3xCFBYQnTzKzewE1Akq1Xb01nhi7ExTnARwGTp41vU= X-Google-Smtp-Source: ABdhPJxEurQORPIFzFTk6qKAC+axHqfcygDwDX3t73q6j+/xfCWkDLNPcMg2OpXEIlnpeCFV+Ob04uCAQbTVdT2fV/0= X-Received: by 2002:a92:ce41:: with SMTP id a1mr217530ilr.182.1611242469834; Thu, 21 Jan 2021 07:21:09 -0800 (PST) MIME-Version: 1.0 References: <202101200949.10K9nmkZ029085@gitrepo.freebsd.org> <49353415-D1B2-43D5-AC39-EF64F03EE512@freebsd.org> In-Reply-To: <49353415-D1B2-43D5-AC39-EF64F03EE512@freebsd.org> From: Ed Maste Date: Thu, 21 Jan 2021 10:20:45 -0500 Message-ID: Subject: Re: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) To: Jessica Clarke Cc: Mateusz Guzik , =?UTF-8?Q?Ulrich_Sp=C3=B6rlein?= , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DM5h75Cnrz4WZj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 15:21:11 -0000 > > This fixes the problem at hand, Thanks for confirming, I've fixed that part now. > > but a new regression is shown: > > > > $ strings kernel | grep 'FreeBSD 13.0-ALPHA1' > > FreeBSD 13.0-ALPHA1 #47 c256181-gb06e91d1b700: Thu Jan 21 14:31:35 UTC 2021 > > > > branch name is no longer present. > > See the commit message, though I'd argue it's not redundant in a lot of > local development cases (i.e. anything other than main, stable/*, etc), > and is actually rather useful. I agree, and my suggestion is that we restore it unconditionally. I think it's more confusing without a consistent format / set of components. From owner-dev-commits-src-main@freebsd.org Thu Jan 21 17:24:39 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2BCD34DA1D9 for ; Thu, 21 Jan 2021 17:24:39 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic305-20.consmr.mail.gq1.yahoo.com (sonic305-20.consmr.mail.gq1.yahoo.com [98.137.64.83]) (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 4DM8QZ19Hyz4f1P for ; Thu, 21 Jan 2021 17:24:37 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1611249875; bh=t8U2YDggl4TYI74DnshuTMgVLRKiM9BQCzYewDZFkYq=; h=From:Subject:Date:To:From:Subject:Reply-To; b=TTxPQZiAxQnqDQOc5YrAJFm+CDVDlWw8ofXbuYFtmRjahJaxumvmNwEKNxDhH/ipy3KxqesPKr0TN+7Ljqnuw/z/2jdZRrmnMBcZ+KE3mD9uXGeWCEPOvHRVRbMqWTdZHO9PvRhoPe4Xpb/UOVszW2qS5AtMGzsGXcoJ+sz/2mm03YuAg7yWWbY+40pyeN+NpgrztoAQHuAp/2ywbjIs1LUnV2Iz2mx693HDaPvvFXUn3OYphzDe5cNR/VjO1ZlTSO1iCAuK/ILD6A1wg6ayTkC3+1evw/Pmmdj1qM1pyDHdmZjLg2I/cdN6o4ktxWRv4jH59gRLQZHOx7frNmaiJQ== X-YMail-OSG: rSi56jQVM1nz64LrPN0Ngd7gbRv5hPtuEvaWlunImUw3xxuUJUifJ5X7I1rkppX Gc63.7n6b04oLwg_2WvjO5JodxPJAImux6n9Z7N..tfQBSYMRvluo5IZN9EWXX9zSE0QA2GFC4Hz bgeAEL5vQw5yC9cj7R3UDCM2j4TIcp_s9KUjiH6fxevxsVNmHN4VvBNo41LeOezPfpH.8T_e4zd. 6k_8Mizgee5F5KK3G3RNKHOb4MV3NhT2j9RdW.zhtan8IpGfVACSLnzCOWuGbo1X97Kmj0PLMTs2 kWL3RSzzZ9vErmgsR5XZjkjjViKyA6zduq8uyM8k1VtK3pVyL7VGITMQdFLsNWZxZppUkirEbURS Xu2CMbmu9O_WkIhDrCpEPOBKh87Vu9vdfju9w3BaP_z8zH.aQhNS77uRdHLBeACtu0yR204O.wm9 19HnDsx2DidOUjONGHpBN2PV4WFd7bKtPSGFhYMcVJ_F16WkLD3dRYKhM1qWhTw8KhrVndOUWVU0 MaDuHzxL8vgUhb1Oe1AIrgyO37UGP8djMtG.L4LegFhjEZsCrxpid9rltywlU6R3V4AQN_Zg4Nzl HqmL8280bw.t_8YQT5vs66M33Vx0CM.ffCkEQ0ttG2Ai1FwPWP.YPQ49R0ZH.SjU6oW8AyOKn.0V uQsCD8ydzUAh4KZWZNwsMh5vBQIz8IDEJA6j9yoGVv05OzhSUnQYY3DlqamRF1n7JwpKPgqBOgfd IA6HxzDLIsoLfsscQJyyvmxXeJCchz2f4QhuqIQ_VOaNYRCHuy9H4UG0SNXsWePpsULsYkvBNsfH Ji.M3bNGsXRO7mQmJSgG3MgWd90.hN5gvy3e13CNVvAAQXLaqkkjCB.ujFSFRSnSLvXg7yjZ7yb. Peb_2zvlAeHARf_9a8FWl7Mfwd8jHGPj_IJQtWsG1BAziiwwO7kxbMyQQ2V8Snb5SmSemm0Tl0fz eRCTTSVfbrUxQj17aFxMPdNOsm4pFuouFjlKebAZqqYiVMdx3T7sriFxw6Ez976NAlZ3_rVYVHRZ 5cIwmhGoixkwefW8rUykrhNP5gPDooTky5Gw0XV8WAhNvIdqZGyoQCqWHSwDAtC0optscJ4oWHnY XcpjcBXrgKJolEZpS9UzH2rh5XakF_PhkFUnrAq19uDbG0xUQHmIGGEdSYyMlgiFlhs1LNSidwuV ToOOmVQ160h1c_qEMMeXz6SQvhvsitK66Sgfgm4AXUppdI0EG6RGrRIRB7zP.gV6gb0x7_HKkgze al5FywiarsGTmbVll0rvWMMU8hVRM1IkvOCpQsOl7DmOr9d1nrzLcBytiClOe0sFkKDmbJXH_itr Zs6gz9Wxrgo.p3Iv.e7bzfMOmFHffEEiATZ2eM16oCT0TLact8y8z2wmmPRLb1apqf5HMy7ctMMZ Cj_Q.KACJHMwcXvu.SThi2N9VRWU3jseZYbfj05DvwrS8bqiDYTz3KRLUol7nVwdtNe5CbVR16oB p6Cw9bnfp17CYwWBrgZ3w7gz4GrgZA8Z7VYcVMq4M5juj6o7vPAbSzNqzHRbUO7SKwq5eog2V18k cMfZpPIKxpCsn.CwntyqKW91WgfH57H9EwfaNMOMvSkMz8sLaNZYeeAmC82Hq779gOtyxNi0PMUz HykUWlxm_tkMX7ESBYAprXT6g..Kxudc22h61rMQsR1VDjNRcN0ggCidnJG2hwTf.eTy3SbiPkAp Cfn1EQavDAsw1XKFOtcPa0EDRf8MeOIExX2YvzaGIBL3Ed.dRh_tE2PX6o0IFGdNlnugEkFLC.7X h_lq1613nkYwffJcgwkBfwK0VlQIqHveV.kBoIu67tYfELZFKF2.tpkPCLs_gse1cEJ6Nw5S6WMG yKMUL9ZuDHwO1YJet93htb.INCs.SMM0HY9xe71pNSaiPBo.4ErOQcQoj_7Ixlm6I7zPc.YVpChO 1suaNcSHHc.KkF29NP18a0dRoleFbCkeDquMFnClZaVkCZxXR_SEUqR190wtxGgMR.M7MepR3o_C Ty1dM5XIlMzR8yrzsKeVAn_6QI0Y13MPrcCq0JZrRWQUELifT.RFxGRL9lSc1gIQf1.CWpPIu4g3 UIPFpSw89yPbpt8_ry0LT2TR1Gau4pxKWx6Zt9.Kp4HBheVrJzo0cIvS_vFCWkscWWcpo2q4Dzmc GrbvFM61289hLhsGp6g3LDr7IjuRZCH8rVskVQPhfuBsxznufNj.7fIO4d5SrFwCo4ykyNHrq1su DPBio5j54kbwFgQ665IkuCRvSHnk.xpEY9jqQeRDfHZMMPRMW_BRfq.xSpPjMn6oAmMYxwsdm9w6 VkJTmU9oXKpTtFRODFt4nHo2E430BypsoB.gW9NuIE0gIwWCEIfQTx7LccQe3EaCvrzrgyKmwvyP MER8rSCIbdonaH_QxaL_g2x9O0HKY2eXBUCT5rzdatAjzEIiz6AKwFoN1sHTY6brdX7SYQKWdVXR z_PxkSMFVmVbjzuLEZJVJew1y4oxZc23vd3TQCvrO36TZq2gzk0s1Brr1n65MbbQIAJz0jg-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.gq1.yahoo.com with HTTP; Thu, 21 Jan 2021 17:24:35 +0000 Received: by smtp409.mail.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 22ff0c906c869eea85d581019b5bac4c; Thu, 21 Jan 2021 17:24:30 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) Message-Id: <38C7FD1F-4C7D-4EFC-8217-95CF4ECDB5A5@yahoo.com> Date: Thu, 21 Jan 2021 09:24:28 -0800 To: uqs@freebsd.org, dev-commits-src-main@freebsd.org X-Mailer: Apple Mail (2.3654.40.0.2.32) References: <38C7FD1F-4C7D-4EFC-8217-95CF4ECDB5A5.ref@yahoo.com> X-Rspamd-Queue-Id: 4DM8QZ19Hyz4f1P X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.50 / 15.00]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; RBL_DBL_DONT_QUERY_IPS(0.00)[98.137.64.83:from]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[98.137.64.83:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.64.83:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.64.83:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 17:24:39 -0000 Ulrich Sp=C3=83=C2=B6rlein uqs at FreeBSD.org wrote on Wed Jan 20 09:49:49 UTC 2021 : > While here, drop the redundant branch name from the git output and = don't > count commits in shallow clones. >=20 The branch name part of the patch breaks how I work with multiple branches and I will be locally "reverting" it in my branches unless FreeBSD itself reverts it. For my context it even breaks how I would work for main vs. stable/12 if I ever did something with stable/12 . (I'm not using shallow clones, it is the branch name removal that messes up my specific way of working.) In other words, for how I choose to work, the branch name is not redundant. Going in another direction: mixing gitup/clone-counting and the branch name removal in the same commit and in the code structure means that I'm unable to just skip a commit to deal with the branch name issue. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-dev-commits-src-main@freebsd.org Thu Jan 21 19:30:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4B13E4DD95B; Thu, 21 Jan 2021 19:30:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMCD51G5Jz4nLk; Thu, 21 Jan 2021 19:30:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19792118B2; Thu, 21 Jan 2021 19:30:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LJUj0Q068859; Thu, 21 Jan 2021 19:30:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LJUjp6068858; Thu, 21 Jan 2021 19:30:45 GMT (envelope-from git) Date: Thu, 21 Jan 2021 19:30:45 GMT Message-Id: <202101211930.10LJUjp6068858@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7abc10098b3d - main - libc/nss tests: Fix getpw and getgr single-pass tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7abc10098b3d9c23d611294714b3058e8048aec0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 19:30:45 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7abc10098b3d9c23d611294714b3058e8048aec0 commit 7abc10098b3d9c23d611294714b3058e8048aec0 Author: Mark Johnston AuthorDate: 2021-01-21 19:30:19 +0000 Commit: Mark Johnston CommitDate: 2021-01-21 19:30:19 +0000 libc/nss tests: Fix getpw and getgr single-pass tests Some NSS regression tests for getgrent(3) and getpwent(3) were not testing anything because the test incorrectly requested creation of a database snapshot. Sponsored by: The FreeBSD Foundation MFC after: 1 month --- lib/libc/tests/nss/getgr_test.c | 16 ++++------------ lib/libc/tests/nss/getpw_test.c | 24 ++++-------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/lib/libc/tests/nss/getgr_test.c b/lib/libc/tests/nss/getgr_test.c index ec06d5cf2f6c..568b7daece9c 100644 --- a/lib/libc/tests/nss/getgr_test.c +++ b/lib/libc/tests/nss/getgr_test.c @@ -480,14 +480,12 @@ fin: ATF_TC_WITHOUT_HEAD(getgrent); ATF_TC_BODY(getgrent, tc) { - - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRENT) == 0); + ATF_REQUIRE(run_tests(NULL, TEST_GETGRENT) == 0); } ATF_TC_WITHOUT_HEAD(getgrent_with_snapshot); ATF_TC_BODY(getgrent_with_snapshot, tc) { - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_BUILD_SNAPSHOT) == 0); ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRENT) == 0); } @@ -495,21 +493,18 @@ ATF_TC_BODY(getgrent_with_snapshot, tc) ATF_TC_WITHOUT_HEAD(getgrent_with_two_pass); ATF_TC_BODY(getgrent_with_two_pass, tc) { - - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRENT_2PASS) == 0); + ATF_REQUIRE(run_tests(NULL, TEST_GETGRENT_2PASS) == 0); } ATF_TC_WITHOUT_HEAD(getgrgid); ATF_TC_BODY(getgrgid, tc) { - - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRGID) == 0); + ATF_REQUIRE(run_tests(NULL, TEST_GETGRGID) == 0); } ATF_TC_WITHOUT_HEAD(getgrgid_with_snapshot); ATF_TC_BODY(getgrgid_with_snapshot, tc) { - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_BUILD_SNAPSHOT) == 0); ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRGID) == 0); } @@ -517,21 +512,18 @@ ATF_TC_BODY(getgrgid_with_snapshot, tc) ATF_TC_WITHOUT_HEAD(getgrnam); ATF_TC_BODY(getgrnam, tc) { - - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRNAM) == 0); + ATF_REQUIRE(run_tests(NULL, TEST_GETGRNAM) == 0); } ATF_TC_WITHOUT_HEAD(getgrnam_with_snapshot); ATF_TC_BODY(getgrnam_with_snapshot, tc) { - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_BUILD_SNAPSHOT) == 0); ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRNAM) == 0); } ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, getgrent); ATF_TP_ADD_TC(tp, getgrent_with_snapshot); ATF_TP_ADD_TC(tp, getgrent_with_two_pass); diff --git a/lib/libc/tests/nss/getpw_test.c b/lib/libc/tests/nss/getpw_test.c index e7c5304005ec..40b1820b95ed 100644 --- a/lib/libc/tests/nss/getpw_test.c +++ b/lib/libc/tests/nss/getpw_test.c @@ -458,24 +458,15 @@ fin: #define SNAPSHOT_FILE "snapshot_pwd" -ATF_TC_WITHOUT_HEAD(build_snapshot); -ATF_TC_BODY(build_snapshot, tc) -{ - - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_BUILD_SNAPSHOT) == 0); -} - ATF_TC_WITHOUT_HEAD(getpwent); ATF_TC_BODY(getpwent, tc) { - - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETPWENT) == 0); + ATF_REQUIRE(run_tests(NULL, TEST_GETPWENT) == 0); } ATF_TC_WITHOUT_HEAD(getpwent_with_snapshot); ATF_TC_BODY(getpwent_with_snapshot, tc) { - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_BUILD_SNAPSHOT) == 0); ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETPWENT) == 0); } @@ -483,21 +474,18 @@ ATF_TC_BODY(getpwent_with_snapshot, tc) ATF_TC_WITHOUT_HEAD(getpwent_with_two_pass); ATF_TC_BODY(getpwent_with_two_pass, tc) { - - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETPWENT_2PASS) == 0); + ATF_REQUIRE(run_tests(NULL, TEST_GETPWENT_2PASS) == 0); } ATF_TC_WITHOUT_HEAD(getpwnam); ATF_TC_BODY(getpwnam, tc) { - - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETPWNAM) == 0); + ATF_REQUIRE(run_tests(NULL, TEST_GETPWNAM) == 0); } ATF_TC_WITHOUT_HEAD(getpwnam_with_snapshot); ATF_TC_BODY(getpwnam_with_snapshot, tc) { - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_BUILD_SNAPSHOT) == 0); ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETPWNAM) == 0); } @@ -505,22 +493,18 @@ ATF_TC_BODY(getpwnam_with_snapshot, tc) ATF_TC_WITHOUT_HEAD(getpwuid); ATF_TC_BODY(getpwuid, tc) { - - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETPWUID) == 0); + ATF_REQUIRE(run_tests(NULL, TEST_GETPWUID) == 0); } ATF_TC_WITHOUT_HEAD(getpwuid_with_snapshot); ATF_TC_BODY(getpwuid_with_snapshot, tc) { - ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_BUILD_SNAPSHOT) == 0); ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETPWUID) == 0); } ATF_TP_ADD_TCS(tp) { - - ATF_TP_ADD_TC(tp, build_snapshot); ATF_TP_ADD_TC(tp, getpwent); ATF_TP_ADD_TC(tp, getpwent_with_snapshot); ATF_TP_ADD_TC(tp, getpwent_with_two_pass); From owner-dev-commits-src-main@freebsd.org Thu Jan 21 19:30:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2A0124DD8D2; Thu, 21 Jan 2021 19:30:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMCD432J3z4nLg; Thu, 21 Jan 2021 19:30:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 125F011A71; Thu, 21 Jan 2021 19:30:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LJUhlE068837; Thu, 21 Jan 2021 19:30:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LJUhZO068836; Thu, 21 Jan 2021 19:30:43 GMT (envelope-from git) Date: Thu, 21 Jan 2021 19:30:43 GMT Message-Id: <202101211930.10LJUhZO068836@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: ed14c69d5679 - main - libc/nss tests: Style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed14c69d5679b9a6b86722be698b3060d4b74946 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 19:30:45 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ed14c69d5679b9a6b86722be698b3060d4b74946 commit ed14c69d5679b9a6b86722be698b3060d4b74946 Author: Mark Johnston AuthorDate: 2021-01-21 19:30:18 +0000 Commit: Mark Johnston CommitDate: 2021-01-21 19:30:18 +0000 libc/nss tests: Style Sponsored by: The FreeBSD Foundation MFC after: 1 month --- lib/libc/tests/nss/getgr_test.c | 32 ++++++++++++++++---------------- lib/libc/tests/nss/getpw_test.c | 39 ++++++++++++++++++++------------------- lib/libc/tests/nss/testutil.h | 2 +- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/lib/libc/tests/nss/getgr_test.c b/lib/libc/tests/nss/getgr_test.c index 757382b02f39..ec06d5cf2f6c 100644 --- a/lib/libc/tests/nss/getgr_test.c +++ b/lib/libc/tests/nss/getgr_test.c @@ -62,8 +62,7 @@ static void free_group(struct group *); static void sdump_group(struct group *, char *, size_t); static int group_read_snapshot_func(struct group *, char *); -static int group_check_ambiguity(struct group_test_data *, - struct group *); +static int group_check_ambiguity(struct group_test_data *, struct group *); static int group_fill_test_data(struct group_test_data *); static int group_test_correctness(struct group *, void *); static int group_test_getgrnam(struct group *, void *); @@ -175,7 +174,7 @@ sdump_group(struct group *grp, char *buffer, size_t buflen) int written; written = snprintf(buffer, buflen, "%s:%s:%d:", - grp->gr_name, grp->gr_passwd, grp->gr_gid); + grp->gr_name, grp->gr_passwd, grp->gr_gid); buffer += written; if (written > (int)buflen) return; @@ -340,8 +339,8 @@ static int group_check_ambiguity(struct group_test_data *td, struct group *pwd) { - return (TEST_DATA_FIND(group, td, pwd, compare_group, - NULL) != NULL ? 0 : -1); + return (TEST_DATA_FIND(group, td, pwd, compare_group, NULL) != + NULL ? 0 : -1); } static int @@ -377,18 +376,19 @@ group_test_getgrgid(struct group *grp_model, void *mdata) grp = getgrgid(grp_model->gr_gid); if (group_test_correctness(grp, NULL) != 0 || (compare_group(grp, grp_model, NULL) != 0 && - group_check_ambiguity((struct group_test_data *)mdata, grp) != 0)) { + group_check_ambiguity((struct group_test_data *)mdata, grp) != 0)) return (-1); - } else { + else return (0); - } } static int group_test_getgrent(struct group *grp, void *mdata __unused) { - /* Only correctness can be checked when doing 1-pass test for - * getgrent(). */ + /* + * Only correctness can be checked when doing 1-pass test for + * getgrent(). + */ return (group_test_correctness(grp, NULL)); } @@ -451,12 +451,12 @@ run_tests(const char *snapshot_file, enum test_methods method) compare_group, NULL); break; case TEST_GETGRENT_2PASS: - TEST_DATA_INIT(group, &td_2pass, clone_group, free_group); - rv = group_fill_test_data(&td_2pass); - if (rv != -1) - rv = DO_2PASS_TEST(group, &td, &td_2pass, - compare_group, NULL); - TEST_DATA_DESTROY(group, &td_2pass); + TEST_DATA_INIT(group, &td_2pass, clone_group, free_group); + rv = group_fill_test_data(&td_2pass); + if (rv != -1) + rv = DO_2PASS_TEST(group, &td, &td_2pass, + compare_group, NULL); + TEST_DATA_DESTROY(group, &td_2pass); break; case TEST_BUILD_SNAPSHOT: if (snapshot_file != NULL) diff --git a/lib/libc/tests/nss/getpw_test.c b/lib/libc/tests/nss/getpw_test.c index c7ad2e5a4889..e7c5304005ec 100644 --- a/lib/libc/tests/nss/getpw_test.c +++ b/lib/libc/tests/nss/getpw_test.c @@ -302,8 +302,8 @@ static int passwd_check_ambiguity(struct passwd_test_data *td, struct passwd *pwd) { - return (TEST_DATA_FIND(passwd, td, pwd, compare_passwd, - NULL) != NULL ? 0 : -1); + return (TEST_DATA_FIND(passwd, td, pwd, compare_passwd, NULL) != + NULL ? 0 : -1); } static int @@ -320,10 +320,9 @@ passwd_test_getpwnam(struct passwd *pwd_model, void *mdata) if (passwd_test_correctness(pwd, NULL) != 0) goto errfin; - if ((compare_passwd(pwd, pwd_model, NULL) != 0) && - (passwd_check_ambiguity((struct passwd_test_data *)mdata, pwd) - !=0)) - goto errfin; + if (compare_passwd(pwd, pwd_model, NULL) != 0 && + passwd_check_ambiguity((struct passwd_test_data *)mdata, pwd) != 0) + goto errfin; #ifdef DEBUG printf("ok\n"); @@ -348,10 +347,10 @@ passwd_test_getpwuid(struct passwd *pwd_model, void *mdata) #endif pwd = getpwuid(pwd_model->pw_uid); - if ((passwd_test_correctness(pwd, NULL) != 0) || - ((compare_passwd(pwd, pwd_model, NULL) != 0) && - (passwd_check_ambiguity((struct passwd_test_data *)mdata, pwd) - != 0))) { + if (passwd_test_correctness(pwd, NULL) != 0 || + (compare_passwd(pwd, pwd_model, NULL) != 0 && + passwd_check_ambiguity((struct passwd_test_data *)mdata, + pwd) != 0)) { #ifdef DEBUG printf("not ok\n"); #endif @@ -367,8 +366,10 @@ passwd_test_getpwuid(struct passwd *pwd_model, void *mdata) static int passwd_test_getpwent(struct passwd *pwd, void *mdata __unused) { - /* Only correctness can be checked when doing 1-pass test for - * getpwent(). */ + /* + * Only correctness can be checked when doing 1-pass test for + * getpwent(). + */ return (passwd_test_correctness(pwd, NULL)); } @@ -397,7 +398,7 @@ run_tests(const char *snapshot_file, enum test_methods method) } TEST_SNAPSHOT_FILE_READ(passwd, snapshot_file, - &td_snap, passwd_read_snapshot_func); + &td_snap, passwd_read_snapshot_func); } } @@ -409,26 +410,26 @@ run_tests(const char *snapshot_file, enum test_methods method) case TEST_GETPWNAM: if (snapshot_file == NULL) rv = DO_1PASS_TEST(passwd, &td, - passwd_test_getpwnam, (void *)&td); + passwd_test_getpwnam, (void *)&td); else rv = DO_1PASS_TEST(passwd, &td_snap, - passwd_test_getpwnam, (void *)&td_snap); + passwd_test_getpwnam, (void *)&td_snap); break; case TEST_GETPWUID: if (snapshot_file == NULL) rv = DO_1PASS_TEST(passwd, &td, - passwd_test_getpwuid, (void *)&td); + passwd_test_getpwuid, (void *)&td); else rv = DO_1PASS_TEST(passwd, &td_snap, - passwd_test_getpwuid, (void *)&td_snap); + passwd_test_getpwuid, (void *)&td_snap); break; case TEST_GETPWENT: if (snapshot_file == NULL) rv = DO_1PASS_TEST(passwd, &td, passwd_test_getpwent, - (void *)&td); + (void *)&td); else rv = DO_2PASS_TEST(passwd, &td, &td_snap, - compare_passwd, NULL); + compare_passwd, NULL); break; case TEST_GETPWENT_2PASS: TEST_DATA_INIT(passwd, &td_2pass, clone_passwd, free_passwd); diff --git a/lib/libc/tests/nss/testutil.h b/lib/libc/tests/nss/testutil.h index ff9e8f0a9304..7b55e16580d1 100644 --- a/lib/libc/tests/nss/testutil.h +++ b/lib/libc/tests/nss/testutil.h @@ -325,6 +325,6 @@ __##ent##_2pass_test(struct ent##_test_data *td1, \ { \ int rv; \ \ - rv = __##ent##_test_data_compare(td1, td2, cmp_func, cmp_mdata); \ + rv = __##ent##_test_data_compare(td1, td2, cmp_func, cmp_mdata);\ return (rv); \ } From owner-dev-commits-src-main@freebsd.org Thu Jan 21 19:30:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1B7674DD8D1; Thu, 21 Jan 2021 19:30:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMCD432ylz4nSt; Thu, 21 Jan 2021 19:30:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD6DA11A70; Thu, 21 Jan 2021 19:30:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LJUgu4068819; Thu, 21 Jan 2021 19:30:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LJUg2o068818; Thu, 21 Jan 2021 19:30:42 GMT (envelope-from git) Date: Thu, 21 Jan 2021 19:30:42 GMT Message-Id: <202101211930.10LJUg2o068818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: aa37baf3d7cf - main - Define PNP info after defining driver modules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa37baf3d7cf51da92fd367476182802e71838ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 19:30:45 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=aa37baf3d7cf51da92fd367476182802e71838ae commit aa37baf3d7cf51da92fd367476182802e71838ae Author: Mark Johnston AuthorDate: 2021-01-21 19:30:18 +0000 Commit: Mark Johnston CommitDate: 2021-01-21 19:30:18 +0000 Define PNP info after defining driver modules PNP info definitions currently have an unfortunate requirement in that they must follow the associated module definition in the module metadata linker set. Otherwise devmatch can segfault while processing the linker hints file since kldxref maintains the order in the linker set. A number of drivers violate this requirement. In some cases this can cause devmatch(8) to segfault when processing the linker hints file. Work around the problem for now simply by adjusting the drivers. Reviewed by: imp MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D28260 --- sys/arm/ti/am335x/am335x_dmtpps.c | 2 +- sys/arm/ti/am335x/am335x_ehrpwm.c | 2 +- sys/dev/gpio/gpioiic.c | 8 ++++++-- sys/dev/gpio/gpiopps.c | 2 +- sys/dev/gpio/gpioths.c | 6 ++++-- sys/dev/iicbus/ads111x.c | 4 +++- sys/dev/iicbus/mux/iic_gpiomux.c | 8 ++++++-- sys/dev/iicbus/mux/ltc430x.c | 4 +--- sys/dev/iicbus/mux/pca9547.c | 2 +- sys/dev/ow/owc_gpiobus.c | 6 ++++-- sys/dev/pwm/pwmc.c | 6 +++--- 11 files changed, 31 insertions(+), 19 deletions(-) diff --git a/sys/arm/ti/am335x/am335x_dmtpps.c b/sys/arm/ti/am335x/am335x_dmtpps.c index 24d83f248eef..414800fd011e 100644 --- a/sys/arm/ti/am335x/am335x_dmtpps.c +++ b/sys/arm/ti/am335x/am335x_dmtpps.c @@ -96,7 +96,6 @@ static struct ofw_compat_data compat_data[] = { {"ti,am335x-timer-1ms", 1}, {NULL, 0}, }; -SIMPLEBUS_PNP_INFO(compat_data); /* * A table relating pad names to the hardware timer number they can be mux'd to. @@ -618,4 +617,5 @@ static driver_t dmtpps_driver = { static devclass_t dmtpps_devclass; DRIVER_MODULE(am335x_dmtpps, simplebus, dmtpps_driver, dmtpps_devclass, 0, 0); +SIMPLEBUS_PNP_INFO(compat_data); MODULE_DEPEND(am335x_dmtpps, ti_sysc, 1, 1, 1); diff --git a/sys/arm/ti/am335x/am335x_ehrpwm.c b/sys/arm/ti/am335x/am335x_ehrpwm.c index 619fdae2bcdb..6fd709d120e6 100644 --- a/sys/arm/ti/am335x/am335x_ehrpwm.c +++ b/sys/arm/ti/am335x/am335x_ehrpwm.c @@ -199,7 +199,6 @@ static struct ofw_compat_data compat_data[] = { {"ti,am33xx-ehrpwm", true}, {NULL, false}, }; -SIMPLEBUS_PNP_INFO(compat_data); static void am335x_ehrpwm_cfg_duty(struct am335x_ehrpwm_softc *sc, u_int chan, u_int duty) @@ -713,6 +712,7 @@ static driver_t am335x_ehrpwm_driver = { static devclass_t am335x_ehrpwm_devclass; DRIVER_MODULE(am335x_ehrpwm, am335x_pwmss, am335x_ehrpwm_driver, am335x_ehrpwm_devclass, 0, 0); +SIMPLEBUS_PNP_INFO(compat_data); MODULE_VERSION(am335x_ehrpwm, 1); MODULE_DEPEND(am335x_ehrpwm, am335x_pwmss, 1, 1, 1); MODULE_DEPEND(am335x_ehrpwm, pwmbus, 1, 1, 1); diff --git a/sys/dev/gpio/gpioiic.c b/sys/dev/gpio/gpioiic.c index 6d62a6d04d95..f387252098e2 100644 --- a/sys/dev/gpio/gpioiic.c +++ b/sys/dev/gpio/gpioiic.c @@ -65,8 +65,6 @@ static struct ofw_compat_data compat_data[] = { {"gpioiic", true}, /* Deprecated old freebsd compat string */ {NULL, false} }; -OFWBUS_PNP_INFO(compat_data); -SIMPLEBUS_PNP_INFO(compat_data); static phandle_t gpioiic_get_node(device_t bus, device_t dev) @@ -370,7 +368,13 @@ static driver_t gpioiic_driver = { }; DRIVER_MODULE(gpioiic, gpiobus, gpioiic_driver, gpioiic_devclass, 0, 0); +#ifdef FDT +OFWBUS_PNP_INFO(compat_data); +#endif DRIVER_MODULE(gpioiic, simplebus, gpioiic_driver, gpioiic_devclass, 0, 0); +#ifdef FDT +SIMPLEBUS_PNP_INFO(compat_data); +#endif DRIVER_MODULE(iicbb, gpioiic, iicbb_driver, iicbb_devclass, 0, 0); MODULE_DEPEND(gpioiic, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER); MODULE_DEPEND(gpioiic, gpiobus, 1, 1, 1); diff --git a/sys/dev/gpio/gpiopps.c b/sys/dev/gpio/gpiopps.c index 8a6f1a6a3f6b..ea2644088c5d 100644 --- a/sys/dev/gpio/gpiopps.c +++ b/sys/dev/gpio/gpiopps.c @@ -47,7 +47,6 @@ static struct ofw_compat_data compat_data[] = { {"pps-gpio", 1}, {NULL, 0} }; -SIMPLEBUS_PNP_INFO(compat_data); #endif /* FDT */ static devclass_t pps_devclass; @@ -291,5 +290,6 @@ static driver_t pps_fdt_driver = { }; DRIVER_MODULE(gpiopps, simplebus, pps_fdt_driver, pps_devclass, 0, 0); +SIMPLEBUS_PNP_INFO(compat_data); #endif /* FDT */ diff --git a/sys/dev/gpio/gpioths.c b/sys/dev/gpio/gpioths.c index c08d772ddb9b..97831db881ae 100644 --- a/sys/dev/gpio/gpioths.c +++ b/sys/dev/gpio/gpioths.c @@ -72,8 +72,6 @@ static struct ofw_compat_data compat_data[] = { {"dht11", true}, {NULL, false} }; -OFWBUS_PNP_INFO(compat_data); -SIMPLEBUS_PNP_INFO(compat_data); #endif /* FDT */ #define PIN_IDX 0 /* Use the first/only configured pin. */ @@ -411,7 +409,11 @@ DEFINE_CLASS_0(gpioths, gpioths_driver, gpioths_methods, sizeof(struct gpioths_s #ifdef FDT DRIVER_MODULE(gpioths, simplebus, gpioths_driver, gpioths_devclass, 0, 0); +SIMPLEBUS_PNP_INFO(compat_data); #endif DRIVER_MODULE(gpioths, gpiobus, gpioths_driver, gpioths_devclass, 0, 0); +#ifdef FDT +OFWBUS_PNP_INFO(compat_data); +#endif MODULE_DEPEND(gpioths, gpiobus, 1, 1, 1); diff --git a/sys/dev/iicbus/ads111x.c b/sys/dev/iicbus/ads111x.c index 5d7057d99b91..0464de1800c0 100644 --- a/sys/dev/iicbus/ads111x.c +++ b/sys/dev/iicbus/ads111x.c @@ -152,7 +152,6 @@ static struct ofw_compat_data compat_data[] = { {"ti,ads1115", (uintptr_t)&ads111x_chip_infos[5]}, {NULL, (uintptr_t)NULL}, }; -IICBUS_FDT_PNP_INFO(compat_data); #endif struct ads111x_softc { @@ -609,5 +608,8 @@ static driver_t ads111x_driver = { static devclass_t ads111x_devclass; DRIVER_MODULE(ads111x, iicbus, ads111x_driver, ads111x_devclass, NULL, NULL); +#ifdef FDT +IICBUS_FDT_PNP_INFO(compat_data); +#endif MODULE_VERSION(ads111x, 1); MODULE_DEPEND(ads111x, iicbus, 1, 1, 1); diff --git a/sys/dev/iicbus/mux/iic_gpiomux.c b/sys/dev/iicbus/mux/iic_gpiomux.c index 8e064d84619d..9d34d21c6572 100644 --- a/sys/dev/iicbus/mux/iic_gpiomux.c +++ b/sys/dev/iicbus/mux/iic_gpiomux.c @@ -58,8 +58,6 @@ 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 @@ -255,7 +253,13 @@ 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); +#ifdef FDT +SIMPLEBUS_PNP_INFO(compat_data); +#endif DRIVER_MODULE(iic_gpiomux, ofw_simplebus, iic_gpiomux_driver, gpiomux_devclass, 0, 0); +#ifdef FDT +OFWBUS_PNP_INFO(compat_data); +#endif #ifdef FDT DRIVER_MODULE(ofw_iicbus, iic_gpiomux, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); diff --git a/sys/dev/iicbus/mux/ltc430x.c b/sys/dev/iicbus/mux/ltc430x.c index fab791ed3174..77f1fafe6fe1 100644 --- a/sys/dev/iicbus/mux/ltc430x.c +++ b/sys/dev/iicbus/mux/ltc430x.c @@ -63,7 +63,6 @@ static struct ofw_compat_data compat_data[] = { {"lltc,ltc4306", CHIP_LTC4306}, {NULL, CHIP_NONE} }; -IICBUS_FDT_PNP_INFO(compat_data); #endif #include @@ -246,8 +245,8 @@ static devclass_t ltc430x_devclass; DEFINE_CLASS_1(ltc430x, ltc430x_driver, ltc430x_methods, sizeof(struct ltc430x_softc), iicmux_driver); DRIVER_MODULE(ltc430x, iicbus, ltc430x_driver, ltc430x_devclass, 0, 0); - #ifdef FDT +IICBUS_FDT_PNP_INFO(compat_data); DRIVER_MODULE(ofw_iicbus, ltc430x, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); #else DRIVER_MODULE(iicbus, ltc430x, iicbus_driver, iicbus_devclass, 0, 0); @@ -255,4 +254,3 @@ DRIVER_MODULE(iicbus, ltc430x, iicbus_driver, iicbus_devclass, 0, 0); MODULE_DEPEND(ltc430x, iicmux, 1, 1, 1); MODULE_DEPEND(ltc430x, iicbus, 1, 1, 1); - diff --git a/sys/dev/iicbus/mux/pca9547.c b/sys/dev/iicbus/mux/pca9547.c index ac57f26dbb04..2bdc6cb2e867 100644 --- a/sys/dev/iicbus/mux/pca9547.c +++ b/sys/dev/iicbus/mux/pca9547.c @@ -50,7 +50,6 @@ static struct ofw_compat_data compat_data[] = { {"nxp,pca9547", 1}, {NULL, 0} }; -IICBUS_FDT_PNP_INFO(compat_data); #include @@ -155,6 +154,7 @@ static devclass_t pca9547_devclass; DEFINE_CLASS_1(iicmux, pca9547_driver, pca9547_methods, sizeof(struct pca9547_softc), iicmux_driver); DRIVER_MODULE(pca_iicmux, iicbus, pca9547_driver, pca9547_devclass, 0, 0); +IICBUS_FDT_PNP_INFO(compat_data); DRIVER_MODULE(iicbus, iicmux, iicbus_driver, iicbus_devclass, 0, 0); DRIVER_MODULE(ofw_iicbus, iicmux, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); diff --git a/sys/dev/ow/owc_gpiobus.c b/sys/dev/ow/owc_gpiobus.c index 4b8b2ab6f99e..8ed73e10862b 100644 --- a/sys/dev/ow/owc_gpiobus.c +++ b/sys/dev/ow/owc_gpiobus.c @@ -49,8 +49,6 @@ static struct ofw_compat_data compat_data[] = { {"w1-gpio", true}, {NULL, false} }; -OFWBUS_PNP_INFO(compat_data); -SIMPLEBUS_PNP_INFO(compat_data); #endif /* FDT */ #define OW_PIN 0 @@ -394,9 +392,13 @@ static driver_t owc_gpiobus_driver = { #ifdef FDT DRIVER_MODULE(owc_gpiobus, simplebus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0); +SIMPLEBUS_PNP_INFO(compat_data); #endif DRIVER_MODULE(owc_gpiobus, gpiobus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0); +#ifdef FDT +OFWBUS_PNP_INFO(compat_data); +#endif MODULE_DEPEND(owc_gpiobus, ow, 1, 1, 1); MODULE_DEPEND(owc_gpiobus, gpiobus, 1, 1, 1); MODULE_VERSION(owc_gpiobus, 1); diff --git a/sys/dev/pwm/pwmc.c b/sys/dev/pwm/pwmc.c index c49d1e894488..b39460edc9c9 100644 --- a/sys/dev/pwm/pwmc.c +++ b/sys/dev/pwm/pwmc.c @@ -52,9 +52,6 @@ static struct ofw_compat_data compat_data[] = { {"freebsd,pwmc", true}, {NULL, false}, }; - -PWMBUS_FDT_PNP_INFO(compat_data); - #endif struct pwmc_softc { @@ -206,5 +203,8 @@ static driver_t pwmc_driver = { static devclass_t pwmc_devclass; DRIVER_MODULE(pwmc, pwmbus, pwmc_driver, pwmc_devclass, 0, 0); +#ifdef FDT +PWMBUS_FDT_PNP_INFO(compat_data); +#endif MODULE_DEPEND(pwmc, pwmbus, 1, 1, 1); MODULE_VERSION(pwmc, 1); From owner-dev-commits-src-main@freebsd.org Thu Jan 21 19:30:51 2021 Return-Path: Delivered-To: dev-commits-src-main@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 142EE4DD7EF; Thu, 21 Jan 2021 19:30:51 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMCDB2l5qz4nhf; Thu, 21 Jan 2021 19:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6803011944; Thu, 21 Jan 2021 19:30:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LJUlDO068896; Thu, 21 Jan 2021 19:30:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LJUlBs068895; Thu, 21 Jan 2021 19:30:47 GMT (envelope-from git) Date: Thu, 21 Jan 2021 19:30:47 GMT Message-Id: <202101211930.10LJUlBs068895@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6e411d8b14ec - main - libc/nss tests: Add regression tests for commit 55444c823e1f MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e411d8b14ec5402b7551073e2f9edc4d680dd49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 19:30:51 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6e411d8b14ec5402b7551073e2f9edc4d680dd49 commit 6e411d8b14ec5402b7551073e2f9edc4d680dd49 Author: Mark Johnston AuthorDate: 2021-01-21 19:30:19 +0000 Commit: Mark Johnston CommitDate: 2021-01-21 19:30:19 +0000 libc/nss tests: Add regression tests for commit 55444c823e1f PR: 252094 Sponsored by: The FreeBSD Foundation MFC after: 1 month --- lib/libc/tests/nss/getgr_test.c | 61 +++++++++++++++++++++++++++++++++-------- lib/libc/tests/nss/getpw_test.c | 51 +++++++++++++++++++++++++++++----- 2 files changed, 93 insertions(+), 19 deletions(-) diff --git a/lib/libc/tests/nss/getgr_test.c b/lib/libc/tests/nss/getgr_test.c index 568b7daece9c..63dfea085095 100644 --- a/lib/libc/tests/nss/getgr_test.c +++ b/lib/libc/tests/nss/getgr_test.c @@ -42,11 +42,13 @@ __FBSDID("$FreeBSD$"); #include "testutil.h" enum test_methods { - TEST_GETGRENT = 1, - TEST_GETGRNAM = 2, - TEST_GETGRGID = 4, - TEST_GETGRENT_2PASS = 8, - TEST_BUILD_SNAPSHOT = 16, + TEST_GETGRENT, + TEST_GETGRNAM, + TEST_GETGRGID, + TEST_GETGRENT_2PASS, + TEST_GETGRENT_INTERLEAVED_GETGRNAM, + TEST_GETGRENT_INTERLEAVED_GETGRGID, + TEST_BUILD_SNAPSHOT, }; DECLARE_TEST_DATA(group) @@ -63,7 +65,8 @@ static void sdump_group(struct group *, char *, size_t); static int group_read_snapshot_func(struct group *, char *); static int group_check_ambiguity(struct group_test_data *, struct group *); -static int group_fill_test_data(struct group_test_data *); +static int group_fill_test_data(struct group_test_data *, + int (*cb)(struct group *, void *)); static int group_test_correctness(struct group *, void *); static int group_test_getgrnam(struct group *, void *); static int group_test_getgrgid(struct group *, void *); @@ -289,16 +292,20 @@ dump_group(struct group *result) } static int -group_fill_test_data(struct group_test_data *td) +group_fill_test_data(struct group_test_data *td, + int (*cb)(struct group *, void *)) { struct group *grp; setgroupent(1); while ((grp = getgrent()) != NULL) { - if (group_test_correctness(grp, NULL) == 0) + if (group_test_correctness(grp, NULL) == 0) { TEST_DATA_APPEND(group, td, grp); - else + if (cb != NULL && cb(grp, td) != 0) + return (-1); + } else { return (-1); + } } endgrent(); @@ -395,7 +402,7 @@ group_test_getgrent(struct group *grp, void *mdata __unused) static int run_tests(const char *snapshot_file, enum test_methods method) { - struct group_test_data td, td_snap, td_2pass; + struct group_test_data td, td_snap, td_2pass, td_interleaved; int rv; TEST_DATA_INIT(group, &td, clone_group, free_group); @@ -422,7 +429,7 @@ run_tests(const char *snapshot_file, enum test_methods method) } } - rv = group_fill_test_data(&td); + rv = group_fill_test_data(&td, NULL); if (rv == -1) return (-1); switch (method) { @@ -452,12 +459,28 @@ run_tests(const char *snapshot_file, enum test_methods method) break; case TEST_GETGRENT_2PASS: TEST_DATA_INIT(group, &td_2pass, clone_group, free_group); - rv = group_fill_test_data(&td_2pass); + rv = group_fill_test_data(&td_2pass, NULL); if (rv != -1) rv = DO_2PASS_TEST(group, &td, &td_2pass, compare_group, NULL); TEST_DATA_DESTROY(group, &td_2pass); break; + case TEST_GETGRENT_INTERLEAVED_GETGRNAM: + TEST_DATA_INIT(group, &td_interleaved, clone_group, free_group); + rv = group_fill_test_data(&td_interleaved, group_test_getgrnam); + if (rv != -1) + rv = DO_2PASS_TEST(group, &td, &td_interleaved, + compare_group, NULL); + TEST_DATA_DESTROY(group, &td_interleaved); + break; + case TEST_GETGRENT_INTERLEAVED_GETGRGID: + TEST_DATA_INIT(group, &td_interleaved, clone_group, free_group); + rv = group_fill_test_data(&td_interleaved, group_test_getgrgid); + if (rv != -1) + rv = DO_2PASS_TEST(group, &td, &td_interleaved, + compare_group, NULL); + TEST_DATA_DESTROY(group, &td_interleaved); + break; case TEST_BUILD_SNAPSHOT: if (snapshot_file != NULL) rv = TEST_SNAPSHOT_FILE_WRITE(group, snapshot_file, &td, @@ -522,6 +545,18 @@ ATF_TC_BODY(getgrnam_with_snapshot, tc) ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRNAM) == 0); } +ATF_TC_WITHOUT_HEAD(getgrent_interleaved_getgrnam); +ATF_TC_BODY(getgrent_interleaved_getgrnam, tc) +{ + ATF_REQUIRE(run_tests(NULL, TEST_GETGRENT_INTERLEAVED_GETGRNAM) == 0); +} + +ATF_TC_WITHOUT_HEAD(getgrent_interleaved_getgrgid); +ATF_TC_BODY(getgrent_interleaved_getgrgid, tc) +{ + ATF_REQUIRE(run_tests(NULL, TEST_GETGRENT_INTERLEAVED_GETGRGID) == 0); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, getgrent); @@ -531,6 +566,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, getgrgid_with_snapshot); ATF_TP_ADD_TC(tp, getgrnam); ATF_TP_ADD_TC(tp, getgrnam_with_snapshot); + ATF_TP_ADD_TC(tp, getgrent_interleaved_getgrnam); + ATF_TP_ADD_TC(tp, getgrent_interleaved_getgrgid); return (atf_no_error()); } diff --git a/lib/libc/tests/nss/getpw_test.c b/lib/libc/tests/nss/getpw_test.c index 40b1820b95ed..1d9ae6c1a5db 100644 --- a/lib/libc/tests/nss/getpw_test.c +++ b/lib/libc/tests/nss/getpw_test.c @@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$"); enum test_methods { TEST_GETPWENT, + TEST_GETPWENT_INTERLEAVED_GETPWNAM, + TEST_GETPWENT_INTERLEAVED_GETPWUID, TEST_GETPWNAM, TEST_GETPWUID, TEST_GETPWENT_2PASS, @@ -64,7 +66,8 @@ static void dump_passwd(struct passwd *); static int passwd_read_snapshot_func(struct passwd *, char *); static int passwd_check_ambiguity(struct passwd_test_data *, struct passwd *); -static int passwd_fill_test_data(struct passwd_test_data *); +static int passwd_fill_test_data(struct passwd_test_data *, + int (*cb)(struct passwd *, void *)); static int passwd_test_correctness(struct passwd *, void *); static int passwd_test_getpwnam(struct passwd *, void *); static int passwd_test_getpwuid(struct passwd *, void *); @@ -236,16 +239,20 @@ fin: } static int -passwd_fill_test_data(struct passwd_test_data *td) +passwd_fill_test_data(struct passwd_test_data *td, + int (*cb)(struct passwd *, void *)) { struct passwd *pwd; setpassent(1); while ((pwd = getpwent()) != NULL) { - if (passwd_test_correctness(pwd, NULL) == 0) + if (passwd_test_correctness(pwd, NULL) == 0) { TEST_DATA_APPEND(passwd, td, pwd); - else + if (cb != NULL && cb(pwd, td) != 0) + return (-1); + } else { return (-1); + } } endpwent(); @@ -376,7 +383,7 @@ passwd_test_getpwent(struct passwd *pwd, void *mdata __unused) static int run_tests(const char *snapshot_file, enum test_methods method) { - struct passwd_test_data td, td_snap, td_2pass; + struct passwd_test_data td, td_snap, td_2pass, td_interleaved; int rv; TEST_DATA_INIT(passwd, &td, clone_passwd, free_passwd); @@ -402,7 +409,7 @@ run_tests(const char *snapshot_file, enum test_methods method) } } - rv = passwd_fill_test_data(&td); + rv = passwd_fill_test_data(&td, NULL); if (rv == -1) return (-1); @@ -433,12 +440,28 @@ run_tests(const char *snapshot_file, enum test_methods method) break; case TEST_GETPWENT_2PASS: TEST_DATA_INIT(passwd, &td_2pass, clone_passwd, free_passwd); - rv = passwd_fill_test_data(&td_2pass); + rv = passwd_fill_test_data(&td_2pass, NULL); if (rv != -1) rv = DO_2PASS_TEST(passwd, &td, &td_2pass, compare_passwd, NULL); TEST_DATA_DESTROY(passwd, &td_2pass); break; + case TEST_GETPWENT_INTERLEAVED_GETPWNAM: + TEST_DATA_INIT(passwd, &td_interleaved, clone_passwd, free_passwd); + rv = passwd_fill_test_data(&td_interleaved, passwd_test_getpwnam); + if (rv != -1) + rv = DO_2PASS_TEST(passwd, &td, &td_interleaved, + compare_passwd, NULL); + TEST_DATA_DESTROY(passwd, &td_interleaved); + break; + case TEST_GETPWENT_INTERLEAVED_GETPWUID: + TEST_DATA_INIT(passwd, &td_interleaved, clone_passwd, free_passwd); + rv = passwd_fill_test_data(&td_interleaved, passwd_test_getpwuid); + if (rv != -1) + rv = DO_2PASS_TEST(passwd, &td, &td_interleaved, + compare_passwd, NULL); + TEST_DATA_DESTROY(passwd, &td_interleaved); + break; case TEST_BUILD_SNAPSHOT: if (snapshot_file != NULL) rv = TEST_SNAPSHOT_FILE_WRITE(passwd, snapshot_file, @@ -503,6 +526,18 @@ ATF_TC_BODY(getpwuid_with_snapshot, tc) ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETPWUID) == 0); } +ATF_TC_WITHOUT_HEAD(getpwent_interleaved_getpwnam); +ATF_TC_BODY(getpwent_interleaved_getpwnam, tc) +{ + ATF_REQUIRE(run_tests(NULL, TEST_GETPWENT_INTERLEAVED_GETPWNAM) == 0); +} + +ATF_TC_WITHOUT_HEAD(getpwent_interleaved_getpwuid); +ATF_TC_BODY(getpwent_interleaved_getpwuid, tc) +{ + ATF_REQUIRE(run_tests(NULL, TEST_GETPWENT_INTERLEAVED_GETPWUID) == 0); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, getpwent); @@ -512,6 +547,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, getpwnam_with_snapshot); ATF_TP_ADD_TC(tp, getpwuid); ATF_TP_ADD_TC(tp, getpwuid_with_snapshot); + ATF_TP_ADD_TC(tp, getpwent_interleaved_getpwnam); + ATF_TP_ADD_TC(tp, getpwent_interleaved_getpwuid); return (atf_no_error()); } From owner-dev-commits-src-main@freebsd.org Thu Jan 21 19:30:53 2021 Return-Path: Delivered-To: dev-commits-src-main@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 845234DD857; Thu, 21 Jan 2021 19:30:53 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMCDC3zf0z4nhh; Thu, 21 Jan 2021 19:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D93711853; Thu, 21 Jan 2021 19:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LJUmff068918; Thu, 21 Jan 2021 19:30:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LJUmp7068917; Thu, 21 Jan 2021 19:30:48 GMT (envelope-from git) Date: Thu, 21 Jan 2021 19:30:48 GMT Message-Id: <202101211930.10LJUmp7068917@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 48a186863431 - main - libc/nss: Ensure that setgroupent(3) actually works as advertised MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48a186863431ec7a23c6174bc376cafa59dd5fbf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 19:30:54 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=48a186863431ec7a23c6174bc376cafa59dd5fbf commit 48a186863431ec7a23c6174bc376cafa59dd5fbf Author: Mark Johnston AuthorDate: 2021-01-21 19:30:19 +0000 Commit: Mark Johnston CommitDate: 2021-01-21 19:30:19 +0000 libc/nss: Ensure that setgroupent(3) actually works as advertised Because the "files" and "compat" implementations failed to set the "stayopen", keyed lookups would close the database handle, contrary to the purpose of setgroupent(3). setpassent(3)'s implementation does not have this bug. PR: 165527 Submitted by: Andrey Simonenko MFC after: 1 month --- lib/libc/gen/getgrent.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index 6abccea30c6b..afb89cab308b 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -824,6 +824,7 @@ files_setgrent(void *retval, void *mdata, va_list ap) rewind(st->fp); else if (stayopen) st->fp = fopen(_PATH_GROUP, "re"); + st->stayopen = stayopen; break; case ENDGRENT: if (st->fp != NULL) { @@ -1271,6 +1272,7 @@ compat_setgrent(void *retval, void *mdata, va_list ap) rewind(st->fp); else if (stayopen) st->fp = fopen(_PATH_GROUP, "re"); + st->stayopen = stayopen; set_setent(dtab, mdata); (void)_nsdispatch(NULL, dtab, NSDB_GROUP_COMPAT, "setgrent", compatsrc, 0); From owner-dev-commits-src-main@freebsd.org Thu Jan 21 19:30:47 2021 Return-Path: Delivered-To: dev-commits-src-main@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 F36D04DDA2D; Thu, 21 Jan 2021 19:30:46 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMCD62Hy5z4nf8; Thu, 21 Jan 2021 19:30:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 39BB311A98; Thu, 21 Jan 2021 19:30:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LJUkSY068878; Thu, 21 Jan 2021 19:30:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LJUkL2068877; Thu, 21 Jan 2021 19:30:46 GMT (envelope-from git) Date: Thu, 21 Jan 2021 19:30:46 GMT Message-Id: <202101211930.10LJUkL2068877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5619d49e07d3 - main - libc/nss: Restore iterator state when doing passwd/group lookups MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5619d49e07d3942e438f3d06269f3c1c466cf5b7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 19:30:48 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5619d49e07d3942e438f3d06269f3c1c466cf5b7 commit 5619d49e07d3942e438f3d06269f3c1c466cf5b7 Author: Mark Johnston AuthorDate: 2021-01-21 19:30:19 +0000 Commit: Mark Johnston CommitDate: 2021-01-21 19:30:19 +0000 libc/nss: Restore iterator state when doing passwd/group lookups The getpwent(3) and getgrent(3) implementations maintain some internal iterator state. Interleaved calls to functions which do passwd/group lookups using a key, such as getpwnam(3), would in some cases clobber this state, causing a subsequent getpwent() or getgrent() call to restart iteration from the beginning of the database or to terminate early. This is particularly troublesome in programming environments where execution of green threads is interleaved within a single OS thread. Take care to restore any iterator state following a keyed lookup. The "files" provider for the passwd database was already handling this correctly, but "compat" was not, and both providers had this problem when accessing the group database. PR: 252094 Submitted by: Viktor Dukhovni MFC after: 1 month --- lib/libc/gen/getgrent.c | 34 +++++++++++++++------------------- lib/libc/gen/getpwent.c | 18 +++++++++++------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index b3699cae3c45..6abccea30c6b 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -882,16 +882,12 @@ files_group(void *retval, void *mdata, va_list ap) } fresh = 1; } - if (how == nss_lt_all) - stayopen = 1; - else { - if (!fresh) - rewind(st->fp); - stayopen = st->stayopen; - } - rv = NS_NOTFOUND; + stayopen = (how == nss_lt_all || !fresh) ? 1 : st->stayopen; if (stayopen) pos = ftello(st->fp); + if (how != nss_lt_all && !fresh) + rewind(st->fp); + rv = NS_NOTFOUND; while ((line = fgetln(st->fp, &linesize)) != NULL) { if (line[linesize-1] == '\n') linesize--; @@ -913,13 +909,15 @@ files_group(void *retval, void *mdata, va_list ap) &buffer[linesize + 1], bufsize - linesize - 1, errnop); if (rv & NS_TERMINATE) break; - if (stayopen) + if (how == nss_lt_all) pos = ftello(st->fp); } if (st->fp != NULL && !stayopen) { fclose(st->fp); st->fp = NULL; } + if (st->fp != NULL && how != nss_lt_all) + fseeko(st->fp, pos, SEEK_SET); if (rv == NS_SUCCESS && retval != NULL) *(struct group **)retval = grp; else if (rv == NS_RETURN && *errnop == ERANGE && st->fp != NULL) @@ -1364,13 +1362,11 @@ compat_group(void *retval, void *mdata, va_list ap) } fresh = 1; } - if (how == nss_lt_all) - stayopen = 1; - else { - if (!fresh) - rewind(st->fp); - stayopen = st->stayopen; - } + stayopen = (how == nss_lt_all || !fresh) ? 1 : st->stayopen; + if (stayopen) + pos = ftello(st->fp); + if (how != nss_lt_all && !fresh) + rewind(st->fp); docompat: switch (st->compat) { case COMPAT_MODE_ALL: @@ -1431,8 +1427,6 @@ docompat: break; } rv = NS_NOTFOUND; - if (stayopen) - pos = ftello(st->fp); while ((line = fgetln(st->fp, &linesize)) != NULL) { if (line[linesize-1] == '\n') linesize--; @@ -1473,7 +1467,7 @@ docompat: &buffer[linesize + 1], bufsize - linesize - 1, errnop); if (rv & NS_TERMINATE) break; - if (stayopen) + if (how == nss_lt_all) pos = ftello(st->fp); } fin: @@ -1481,6 +1475,8 @@ fin: fclose(st->fp); st->fp = NULL; } + if (st->fp != NULL && how != nss_lt_all) + fseeko(st->fp, pos, SEEK_SET); if (rv == NS_SUCCESS && retval != NULL) *(struct group **)retval = grp; else if (rv == NS_RETURN && *errnop == ERANGE && st->fp != NULL) diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 09f84f9576ee..a07ee109e2df 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -1733,6 +1733,7 @@ compat_passwd(void *retval, void *mdata, va_list ap) { char keybuf[MAXLOGNAME + 1]; DBT key, entry; + pwkeynum keynum; struct compat_state *st; enum nss_lookup_type how; const char *name; @@ -1783,9 +1784,10 @@ compat_passwd(void *retval, void *mdata, va_list ap) rv = NS_NOTFOUND; goto fin; } + keynum = st->keynum; stayopen = 1; } else { - st->keynum = 0; + keynum = 0; stayopen = st->stayopen; } docompat: @@ -1829,13 +1831,13 @@ docompat: } key.data = keybuf; rv = NS_NOTFOUND; - while (st->keynum >= 0) { - st->keynum++; + while (keynum >= 0) { + keynum++; if (st->version < _PWD_CURRENT_VERSION) { - memcpy(&keybuf[1], &st->keynum, sizeof(st->keynum)); - key.size = sizeof(st->keynum) + 1; + memcpy(&keybuf[1], &keynum, sizeof(keynum)); + key.size = sizeof(keynum) + 1; } else { - store = htonl(st->keynum); + store = htonl(keynum); memcpy(&keybuf[1], &store, sizeof(store)); key.size = sizeof(store) + 1; } @@ -1846,7 +1848,7 @@ docompat: rv = NS_UNAVAIL; goto fin; } else if (rv == 1) { - st->keynum = -1; + keynum = -1; rv = NS_NOTFOUND; goto fin; } @@ -1931,6 +1933,8 @@ docompat: break; } fin: + if (how == nss_lt_all) + st->keynum = keynum; if (st->db != NULL && !stayopen) { (void)st->db->close(st->db); st->db = NULL; From owner-dev-commits-src-main@freebsd.org Thu Jan 21 19:30:56 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0CB904DD973; Thu, 21 Jan 2021 19:30:56 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMCDC4hyPz4nRH; Thu, 21 Jan 2021 19:30:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A979B1155C; Thu, 21 Jan 2021 19:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LJUnPQ068940; Thu, 21 Jan 2021 19:30:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LJUnWO068939; Thu, 21 Jan 2021 19:30:49 GMT (envelope-from git) Date: Thu, 21 Jan 2021 19:30:49 GMT Message-Id: <202101211930.10LJUnWO068939@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1a05d9519de6 - main - libcasper/cap_grp tests: Reset the group database handle MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a05d9519de62cc0f7719a995fded0926d8b2747 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 19:30:56 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1a05d9519de62cc0f7719a995fded0926d8b2747 commit 1a05d9519de62cc0f7719a995fded0926d8b2747 Author: Mark Johnston AuthorDate: 2021-01-21 19:30:19 +0000 Commit: Mark Johnston CommitDate: 2021-01-21 19:30:19 +0000 libcasper/cap_grp tests: Reset the group database handle Some tests verify that the capgrp capability does not permit calls to setgrent(3), but all tests need to ensure that they reset the capability's group database handle, otherwise the local process and casper process will be out of sync. The cap_pwd tests already handle this. Sponsored by: The FreeBSD Foundation MFC after: 1 month --- lib/libcasper/services/cap_grp/tests/grp_test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libcasper/services/cap_grp/tests/grp_test.c b/lib/libcasper/services/cap_grp/tests/grp_test.c index e2bb5e22eb1a..1e84e293e214 100644 --- a/lib/libcasper/services/cap_grp/tests/grp_test.c +++ b/lib/libcasper/services/cap_grp/tests/grp_test.c @@ -321,6 +321,8 @@ test_cmds(cap_channel_t *origcapgrp) capgrp = cap_clone(origcapgrp); CHECK(capgrp != NULL); + cap_setgrent(capgrp); + cmds[0] = "getgrent"; cmds[1] = "getgrent_r"; cmds[2] = "getgrnam"; @@ -361,6 +363,8 @@ test_cmds(cap_channel_t *origcapgrp) capgrp = cap_clone(origcapgrp); CHECK(capgrp != NULL); + cap_setgrent(capgrp); + cmds[0] = "getgrent"; cmds[1] = "getgrent_r"; cmds[2] = "getgrnam"; From owner-dev-commits-src-main@freebsd.org Thu Jan 21 20:31:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4CBC64DF1CC; Thu, 21 Jan 2021 20:31:02 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMDYf1mZqz4sD3; Thu, 21 Jan 2021 20:31:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 304E51278B; Thu, 21 Jan 2021 20:31:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LKV2TF050317; Thu, 21 Jan 2021 20:31:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LKV2vO050316; Thu, 21 Jan 2021 20:31:02 GMT (envelope-from git) Date: Thu, 21 Jan 2021 20:31:02 GMT Message-Id: <202101212031.10LKV2vO050316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 2c8bb126de56 - main - bhyve: Add missing man page section on the nodelete block-device-option MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c8bb126de56ce49637ad752e78957d9ebafba02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 20:31:02 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=2c8bb126de56ce49637ad752e78957d9ebafba02 commit 2c8bb126de56ce49637ad752e78957d9ebafba02 Author: Allan Jude AuthorDate: 2021-01-21 17:17:57 +0000 Commit: Allan Jude CommitDate: 2021-01-21 20:30:55 +0000 bhyve: Add missing man page section on the nodelete block-device-option Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D28272 --- usr.sbin/bhyve/bhyve.8 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 5d8f37813e7f..ef20763624e4 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -348,6 +348,8 @@ Force the file to be opened read-only. Specify the logical and physical sector sizes of the emulated disk. The physical sector size is optional and is equal to the logical sector size if not explicitly specified. +.It Li nodelete +Disable emulation of guest trim requests via DIOCGDELETE requests. .El .Pp SCSI devices: From owner-dev-commits-src-main@freebsd.org Thu Jan 21 20:32:30 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B154D4DF2C6; Thu, 21 Jan 2021 20:32:30 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMDbL4ddJz4scf; Thu, 21 Jan 2021 20:32:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92622125DC; Thu, 21 Jan 2021 20:32:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LKWU7W051473; Thu, 21 Jan 2021 20:32:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LKWUG7051472; Thu, 21 Jan 2021 20:32:30 GMT (envelope-from git) Date: Thu, 21 Jan 2021 20:32:30 GMT Message-Id: <202101212032.10LKWUG7051472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: e6d795d15469 - main - Fix manpage markup in 2c8bb126de56ce49637ad752e78957d9ebafba02 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e6d795d154699cd3ddadc0ea18f015cccb024464 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 20:32:30 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=e6d795d154699cd3ddadc0ea18f015cccb024464 commit e6d795d154699cd3ddadc0ea18f015cccb024464 Author: Allan Jude AuthorDate: 2021-01-21 20:32:15 +0000 Commit: Allan Jude CommitDate: 2021-01-21 20:32:15 +0000 Fix manpage markup in 2c8bb126de56ce49637ad752e78957d9ebafba02 --- usr.sbin/bhyve/bhyve.8 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index ef20763624e4..115727a136a7 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -349,7 +349,9 @@ Specify the logical and physical sector sizes of the emulated disk. The physical sector size is optional and is equal to the logical sector size if not explicitly specified. .It Li nodelete -Disable emulation of guest trim requests via DIOCGDELETE requests. +Disable emulation of guest trim requests via +.Dv DIOCGDELETE +requests. .El .Pp SCSI devices: From owner-dev-commits-src-main@freebsd.org Thu Jan 21 21:34:27 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6FD374E01D8; Thu, 21 Jan 2021 21:34:27 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMFyq2lK3z3CQm; Thu, 21 Jan 2021 21:34:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5143412F64; Thu, 21 Jan 2021 21:34:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LLYR5X030065; Thu, 21 Jan 2021 21:34:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LLYRqd030064; Thu, 21 Jan 2021 21:34:27 GMT (envelope-from git) Date: Thu, 21 Jan 2021 21:34:27 GMT Message-Id: <202101212134.10LLYRqd030064@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 0781c79d4872 - main - Restrict supported alignment for malloc_domainset_aligned(9) to PAGE_SIZE. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0781c79d4872a84a8ebeee3b5eb5520a682b8e7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 21:34:27 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0781c79d4872a84a8ebeee3b5eb5520a682b8e7b commit 0781c79d4872a84a8ebeee3b5eb5520a682b8e7b Author: Konstantin Belousov AuthorDate: 2021-01-18 09:01:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-21 21:34:10 +0000 Restrict supported alignment for malloc_domainset_aligned(9) to PAGE_SIZE. UMA page_alloc() does not take an alignment, so UMA can only handle alignment less then page size. Noted by: alc Reviewed by: alc, markj (previous version) Discussed with: jrtc27 Tested by: pho (previous version) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28219 --- sys/kern/kern_malloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 232472708b9b..d3a151ad14e2 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -772,7 +772,7 @@ malloc_domainset_aligned(size_t size, size_t align, KASSERT(align != 0 && powerof2(align), ("malloc_domainset_aligned: wrong align %#zx size %#zx", align, size)); - KASSERT(align <= kmemzones[nitems(kmemzones) - 2].kz_size, + KASSERT(align <= PAGE_SIZE, ("malloc_domainset_aligned: align %#zx (size %#zx) too large", align, size)); @@ -1173,7 +1173,7 @@ mallocinit(void *dummy) align = UMA_ALIGN_PTR; if (powerof2(size) && size > sizeof(void *)) - align = size - 1; + align = MIN(size, PAGE_SIZE) - 1; for (subzone = 0; subzone < numzones; subzone++) { kmemzones[indx].kz_zone[subzone] = uma_zcreate(name, size, From owner-dev-commits-src-main@freebsd.org Thu Jan 21 21:34:28 2021 Return-Path: Delivered-To: dev-commits-src-main@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 93BE64E05FD; Thu, 21 Jan 2021 21:34:28 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMFyr3hPWz3CPC; Thu, 21 Jan 2021 21:34:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 70DDB132FE; Thu, 21 Jan 2021 21:34:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LLYSFH030085; Thu, 21 Jan 2021 21:34:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LLYSL5030084; Thu, 21 Jan 2021 21:34:28 GMT (envelope-from git) Date: Thu, 21 Jan 2021 21:34:28 GMT Message-Id: <202101212134.10LLYSL5030084@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 1ac7c34486ab - main - malloc_aligned: roundup allocation size up to next power of two MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ac7c34486ab9177c2472278739568d4607e1acc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 21:34:28 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1ac7c34486ab9177c2472278739568d4607e1acc commit 1ac7c34486ab9177c2472278739568d4607e1acc Author: Konstantin Belousov AuthorDate: 2021-01-18 21:17:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-21 21:34:10 +0000 malloc_aligned: roundup allocation size up to next power of two to make it use the right aligned zone. Reported by: melifaro Reviewed by: alc, markj (previous version) Discussed with: jrtc27 Tested by: pho (previous version) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28219 --- sys/kern/kern_malloc.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index d3a151ad14e2..eff9e62c9a10 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -768,6 +768,7 @@ malloc_domainset_aligned(size_t size, size_t align, struct malloc_type *mtp, struct domainset *ds, int flags) { void *res; + size_t asize; KASSERT(align != 0 && powerof2(align), ("malloc_domainset_aligned: wrong align %#zx size %#zx", @@ -776,12 +777,20 @@ malloc_domainset_aligned(size_t size, size_t align, ("malloc_domainset_aligned: align %#zx (size %#zx) too large", align, size)); - if (size < align) - size = align; - res = malloc_domainset(size, mtp, ds, flags); + /* + * Round the allocation size up to the next power of 2, + * because we can only guarantee alignment for + * power-of-2-sized allocations. Further increase the + * allocation size to align if the rounded size is less than + * align, since malloc zones provide alignment equal to their + * size. + */ + asize = size <= align ? align : 1UL << flsl(size - 1); + + res = malloc_domainset(asize, mtp, ds, flags); KASSERT(res == NULL || ((uintptr_t)res & (align - 1)) == 0, ("malloc_domainset_aligned: result not aligned %p size %#zx " - "align %#zx", res, size, align)); + "allocsize %#zx align %#zx", res, size, asize, align)); return (res); } From owner-dev-commits-src-main@freebsd.org Thu Jan 21 21:36:42 2021 Return-Path: Delivered-To: dev-commits-src-main@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 745CC4E026F; Thu, 21 Jan 2021 21:36:42 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMG1Q2qVDz3CxW; Thu, 21 Jan 2021 21:36:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53B8C12E7E; Thu, 21 Jan 2021 21:36:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LLag2P030552; Thu, 21 Jan 2021 21:36:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LLag3F030551; Thu, 21 Jan 2021 21:36:42 GMT (envelope-from git) Date: Thu, 21 Jan 2021 21:36:42 GMT Message-Id: <202101212136.10LLag3F030551@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 5bdce6ff546e - main - Remove deadlock in rc caused by pwait waiting for itself. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bdce6ff546e00673f9f515d2165d02901e858aa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 21:36:42 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=5bdce6ff546e00673f9f515d2165d02901e858aa commit 5bdce6ff546e00673f9f515d2165d02901e858aa Author: Alexander V. Chernikov AuthorDate: 2021-01-21 21:26:15 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-01-21 21:36:37 +0000 Remove deadlock in rc caused by pwait waiting for itself. The following situation can trigger the deadlock: 1) Long time ago a_service was started through rc.d 2) We want to restart a_service and issue service a_service restart 3) rc.subr reads current process PID (via file or process), sends TERM signal and runs pwait with PID harvested 4) a_service process dies very quickly so it's PID becomes available. It is possible that while original process was running, PID counter overflowed and pwait got assigned a_service's PID. This patch ignores pid(s) to wait that are equal to pwait PID. Reported by: Dan McGregor, Boris Lytochkin Submitted by: Boris Lytochkin Reviewed By: 0mp MFC after: 2 weeks PR: 218598 Differential Revision: https://reviews.freebsd.org/D28240 --- bin/pwait/pwait.1 | 6 +++++- bin/pwait/pwait.c | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/pwait/pwait.1 b/bin/pwait/pwait.1 index 0452203eb4a1..b9b651bfc905 100644 --- a/bin/pwait/pwait.1 +++ b/bin/pwait/pwait.1 @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2020 +.Dd January 21, 2021 .Dt PWAIT 1 .Os .Sh NAME @@ -145,6 +145,10 @@ is not a substitute for the .Xr wait 1 builtin as it will not clean up any zombies or state in the parent process. +.Pp +To avoid deadlock, +.Nm +will ignore its own pid, if it is provided as a process id to wait for. .Sh HISTORY A .Nm diff --git a/bin/pwait/pwait.c b/bin/pwait/pwait.c index f39922b48eb9..85cc6b994acf 100644 --- a/bin/pwait/pwait.c +++ b/bin/pwait/pwait.c @@ -146,6 +146,10 @@ main(int argc, char *argv[]) warnx("%s: bad process id", s); continue; } + if (pid == getpid()) { + warnx("%s: skiping my own pid", s); + continue; + } for (i = 0; i < nleft; i++) { if (e[i].ident == (uintptr_t)pid) { break; From owner-dev-commits-src-main@freebsd.org Thu Jan 21 21:40:56 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D46E34E0B5D; Thu, 21 Jan 2021 21:40:56 +0000 (UTC) (envelope-from kevans@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMG6J5h9pz3Dbd; Thu, 21 Jan 2021 21:40:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id AFB2125A5A; Thu, 21 Jan 2021 21:40:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f170.google.com with SMTP id e17so2729591qto.3; Thu, 21 Jan 2021 13:40:56 -0800 (PST) X-Gm-Message-State: AOAM531zUhIhh4KRWpGuAq1S/43pY6jPrA7D96qHLjzT9W9exP6AMNdT McjVcP8B5FlweTtEs+f1e2hyw96CRkgXN3ZVQsk= X-Google-Smtp-Source: ABdhPJw4tmnf7tUo2hy4nhyg31Rnv/vDxoQvcolKcZEO1uqnUGfqF2zLrot7MKWhuMkoWJ6k0F7Q3/P9V2KtHE7n9xY= X-Received: by 2002:ac8:698a:: with SMTP id o10mr1649858qtq.242.1611265256158; Thu, 21 Jan 2021 13:40:56 -0800 (PST) MIME-Version: 1.0 References: <202101212136.10LLag3F030551@gitrepo.freebsd.org> In-Reply-To: <202101212136.10LLag3F030551@gitrepo.freebsd.org> From: Kyle Evans Date: Thu, 21 Jan 2021 15:40:42 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 5bdce6ff546e - main - Remove deadlock in rc caused by pwait waiting for itself. To: "Alexander V. Chernikov" Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 21:40:56 -0000 On Thu, Jan 21, 2021 at 3:36 PM Alexander V. Chernikov wrote: > > The branch main has been updated by melifaro: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5bdce6ff546e00673f9f515d2165d02901e858aa > > commit 5bdce6ff546e00673f9f515d2165d02901e858aa > Author: Alexander V. Chernikov > AuthorDate: 2021-01-21 21:26:15 +0000 > Commit: Alexander V. Chernikov > CommitDate: 2021-01-21 21:36:37 +0000 > > Remove deadlock in rc caused by pwait waiting for itself. > > The following situation can trigger the deadlock: > 1) Long time ago a_service was started through rc.d > 2) We want to restart a_service and issue service a_service restart > 3) rc.subr reads current process PID (via file or process), > sends TERM signal and runs pwait with PID harvested > 4) a_service process dies very quickly so it's PID becomes available. > It is possible that while original process was running, > PID counter overflowed and pwait got assigned a_service's PID. > > This patch ignores pid(s) to wait that are equal to pwait PID. > > Reported by: Dan McGregor, Boris Lytochkin > Submitted by: Boris Lytochkin > Reviewed By: 0mp > MFC after: 2 weeks > PR: 218598 > Differential Revision: https://reviews.freebsd.org/D28240 > --- > bin/pwait/pwait.1 | 6 +++++- > bin/pwait/pwait.c | 4 ++++ > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/bin/pwait/pwait.1 b/bin/pwait/pwait.1 > index 0452203eb4a1..b9b651bfc905 100644 > --- a/bin/pwait/pwait.1 > +++ b/bin/pwait/pwait.1 > @@ -32,7 +32,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd October 5, 2020 > +.Dd January 21, 2021 > .Dt PWAIT 1 > .Os > .Sh NAME > @@ -145,6 +145,10 @@ is not a substitute for the > .Xr wait 1 > builtin > as it will not clean up any zombies or state in the parent process. > +.Pp > +To avoid deadlock, > +.Nm > +will ignore its own pid, if it is provided as a process id to wait for. > .Sh HISTORY > A > .Nm > diff --git a/bin/pwait/pwait.c b/bin/pwait/pwait.c > index f39922b48eb9..85cc6b994acf 100644 > --- a/bin/pwait/pwait.c > +++ b/bin/pwait/pwait.c > @@ -146,6 +146,10 @@ main(int argc, char *argv[]) > warnx("%s: bad process id", s); > continue; > } > + if (pid == getpid()) { > + warnx("%s: skiping my own pid", s); > + continue; > + } nit: "skipping" From owner-dev-commits-src-main@freebsd.org Thu Jan 21 21:47:31 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8179B4E1102; Thu, 21 Jan 2021 21:47:31 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMGFv2n6zz3Dwm; Thu, 21 Jan 2021 21:47:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E0491372D; Thu, 21 Jan 2021 21:47:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LLlVrL043669; Thu, 21 Jan 2021 21:47:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LLlVp5043668; Thu, 21 Jan 2021 21:47:31 GMT (envelope-from git) Date: Thu, 21 Jan 2021 21:47:31 GMT Message-Id: <202101212147.10LLlVp5043668@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: bbff3a72b23a - main - Fix typo in pwait.c introduced in 5bdce6ff546e MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bbff3a72b23a389aebd492ad7c9db9a51166e907 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 21:47:31 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=bbff3a72b23a389aebd492ad7c9db9a51166e907 commit bbff3a72b23a389aebd492ad7c9db9a51166e907 Author: Alexander V. Chernikov AuthorDate: 2021-01-21 21:43:27 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-01-21 21:43:27 +0000 Fix typo in pwait.c introduced in 5bdce6ff546e Reported by: kevans --- bin/pwait/pwait.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pwait/pwait.c b/bin/pwait/pwait.c index 85cc6b994acf..66919ffa1c42 100644 --- a/bin/pwait/pwait.c +++ b/bin/pwait/pwait.c @@ -147,7 +147,7 @@ main(int argc, char *argv[]) continue; } if (pid == getpid()) { - warnx("%s: skiping my own pid", s); + warnx("%s: skipping my own pid", s); continue; } for (i = 0; i < nleft; i++) { From owner-dev-commits-src-main@freebsd.org Thu Jan 21 21:49:01 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8935A4E11A3; Thu, 21 Jan 2021 21:49:01 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMGHd3T38z3F1c; Thu, 21 Jan 2021 21:49:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69ECD136BD; Thu, 21 Jan 2021 21:49:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LLn1ii044005; Thu, 21 Jan 2021 21:49:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LLn1aC044004; Thu, 21 Jan 2021 21:49:01 GMT (envelope-from git) Date: Thu, 21 Jan 2021 21:49:01 GMT Message-Id: <202101212149.10LLn1aC044004@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 130aebbab0d3 - main - Further refactor IPv4 interface route creation. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 130aebbab0d38da85f7d32b6d4227f95a2cd9ec7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 21:49:01 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=130aebbab0d38da85f7d32b6d4227f95a2cd9ec7 commit 130aebbab0d38da85f7d32b6d4227f95a2cd9ec7 Author: Alexander V. Chernikov AuthorDate: 2021-01-19 23:50:34 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-01-21 21:48:49 +0000 Further refactor IPv4 interface route creation. * Fix bug with /32 aliases introduced in 81728a538d24. * Explicitly document business logic for IPv4 ifa routes. * Remove remnants of rtinit() * Deduplicate ifa->route prefix code by moving it into ia_getrtprefix() * Deduplicate conditional check for ifa_maintain_loopback_route() by moving into ia_need_loopback_route() * Remove now-unused flags argument from in_addprefix(). Reviewed by: donner PR: 252883 Differential Revision: https://reviews.freebsd.org/D28246 --- sys/netinet/in.c | 239 +++++++++++++++++++++++++++----------------------- sys/netinet/in_var.h | 2 +- sys/netinet/ip_carp.c | 2 +- 3 files changed, 130 insertions(+), 113 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index d6c0c350dec5..eb58c3453cfc 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -79,6 +79,8 @@ static int in_gifaddr_ioctl(u_long, caddr_t, struct ifnet *, struct thread *); static void in_socktrim(struct sockaddr_in *); static void in_purgemaddrs(struct ifnet *); +static bool ia_need_loopback_route(const struct in_ifaddr *); + VNET_DEFINE_STATIC(int, nosameprefix); #define V_nosameprefix VNET(nosameprefix) SYSCTL_INT(_net_inet_ip, OID_AUTO, no_same_prefix, CTLFLAG_VNET | CTLFLAG_RW, @@ -445,10 +447,6 @@ in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) if (ifp->if_flags & IFF_POINTOPOINT) ia->ia_dstaddr = *dstaddr; - /* XXXGL: rtinit() needs this strange assignment. */ - if (ifp->if_flags & IFF_LOOPBACK) - ia->ia_dstaddr = ia->ia_addr; - if (vhid != 0) { error = (*carp_attach_p)(&ia->ia_ifa, vhid); if (error) @@ -481,12 +479,7 @@ in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) * Add route for the network. */ if (vhid == 0) { - int flags = RTF_UP; - - if (ifp->if_flags & (IFF_LOOPBACK|IFF_POINTOPOINT)) - flags |= RTF_HOST; - - error = in_addprefix(ia, flags); + error = in_addprefix(ia); if (error) goto fail1; } @@ -494,10 +487,7 @@ in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) /* * Add a loopback route to self. */ - if (vhid == 0 && (ifp->if_flags & IFF_LOOPBACK) == 0 && - ia->ia_addr.sin_addr.s_addr != INADDR_ANY && - !((ifp->if_flags & IFF_POINTOPOINT) && - ia->ia_dstaddr.sin_addr.s_addr == ia->ia_addr.sin_addr.s_addr)) { + if (vhid == 0 && ia_need_loopback_route(ia)) { struct in_ifaddr *eia; eia = in_localip_more(ia); @@ -723,7 +713,8 @@ in_match_ifaddr(const struct rtentry *rt, const struct nhop_object *nh, void *ar static int in_handle_prefix_route(uint32_t fibnum, int cmd, - struct sockaddr_in *dst, struct sockaddr_in *netmask, struct ifaddr *ifa) + struct sockaddr_in *dst, struct sockaddr_in *netmask, struct ifaddr *ifa, + struct ifnet *ifp) { NET_EPOCH_ASSERT(); @@ -738,6 +729,7 @@ in_handle_prefix_route(uint32_t fibnum, int cmd, struct rt_addrinfo info = { .rti_ifa = ifa, + .rti_ifp = ifp, .rti_flags = RTF_PINNED | ((netmask != NULL) ? 0 : RTF_HOST), .rti_info = { [RTAX_DST] = (struct sockaddr *)dst, @@ -753,29 +745,105 @@ in_handle_prefix_route(uint32_t fibnum, int cmd, } /* - * Adds or delete interface route corresponding to @ifa. + * Routing table interaction with interface addresses. + * + * In general, two types of routes needs to be installed: + * a) "interface" or "prefix" route, telling user that the addresses + * behind the ifa prefix are reached directly. + * b) "loopback" route installed for the ifa address, telling user that + * the address belongs to local system. + * + * Handling for (a) and (b) differs in multi-fib aspects, hence they + * are implemented in different functions below. + * + * The cases above may intersect - /32 interface aliases results in + * the same prefix produced by (a) and (b). This blurs the definition + * of the "loopback" route and complicate interactions. The interaction + * table is defined below. The case numbers are used in the multiple + * functions below to refer to the particular test case. + * * There can be multiple options: - * 1) Adding addr with prefix on non-p2p/non-lo interface. - * Example: 192.0.2.1/24. Action: add route towards - * 192.0.2.0/24 via this interface, using ifa as an address source. - * Note: route to 192.0.2.1 will be installed separately via - * ifa_maintain_loopback_route(). - * 2) Adding addr with "host" mask. - * Example: 192.0.2.2/32. In this case no action is performed, - * as the route should be installed by ifa_maintain_loopback_route(). - * Returns 0 to indicate success. + * 1) Adding address with prefix on non-p2p/non-loopback interface. + * Example: 192.0.2.1/24. Action: + * * add "prefix" route towards 192.0.2.0/24 via @ia interface, + * using @ia as an address source. + * * add "loopback" route towards 192.0.2.1 via V_loif, saving + * @ia ifp in the gateway and using @ia as an address source. + * + * 2) Adding address with /32 mask to non-p2p/non-loopback interface. + * Example: 192.0.2.2/32. Action: + * * add "prefix" host route via V_loif, using @ia as an address source. + * * 3) Adding address with or without prefix to p2p interface. - * Example: 10.0.0.1/24->10.0.0.2. In this case, all other addresses - * covered by prefix, does not make sense in the context of p2p link. - * Action: add route towards 10.0.0.2 via this interface, using ifa as an - * address source. - * Similar to (1), route to 10.0.0.1 will be installed by - * ifa_maintain_loopback_route(). + * Example: 10.0.0.1/24->10.0.0.2. Action: + * * add "prefix" host route towards 10.0.0.2 via this interface, using @ia + * as an address source. Note: no sense in installing full /24 as the interface + * is point-to-point. + * * add "loopback" route towards 10.0.9.1 via V_loif, saving + * @ia ifp in the gateway and using @ia as an address source. + * * 4) Adding address with or without prefix to loopback interface. - * Example: 192.0.2.1/24. In this case, trafic to non-host addresses cannot - * be forwarded, as it would introduce an infinite cycle. - * Similar to (2), perform no action and return 0. Loopback route - * will be installed by ifa_maintain_loopback_route(). + * Example: 192.0.2.1/24. Action: + * * add "prefix" host route via @ia interface, using @ia as an address source. + * Note: Skip installing /24 prefix as it would introduce TTL loop + * for the traffic destined to these addresses. + */ + +/* + * Checks if @ia needs to install loopback route to @ia address via + * ifa_maintain_loopback_route(). + * + * Return true on success. + */ +static bool +ia_need_loopback_route(const struct in_ifaddr *ia) +{ + struct ifnet *ifp = ia->ia_ifp; + + /* Case 4: Skip loopback interfaces */ + if ((ifp->if_flags & IFF_LOOPBACK) || + (ia->ia_addr.sin_addr.s_addr == INADDR_ANY)) + return (false); + + /* Clash avoidance: Skip p2p interfaces with both addresses are equal */ + if ((ifp->if_flags & IFF_POINTOPOINT) && + ia->ia_dstaddr.sin_addr.s_addr == ia->ia_addr.sin_addr.s_addr) + return (false); + + /* Case 2: skip /32 prefixes */ + if (!(ifp->if_flags & IFF_POINTOPOINT) && + (ia->ia_sockmask.sin_addr.s_addr == INADDR_BROADCAST)) + return (false); + + return (true); +} + +/* + * Calculate "prefix" route corresponding to @ia. + */ +static void +ia_getrtprefix(const struct in_ifaddr *ia, struct in_addr *prefix, struct in_addr *mask) +{ + + if (ia->ia_ifp->if_flags & IFF_POINTOPOINT) { + /* Case 3: return host route for dstaddr */ + *prefix = ia->ia_dstaddr.sin_addr; + mask->s_addr = INADDR_BROADCAST; + } else if (ia->ia_ifp->if_flags & IFF_LOOPBACK) { + /* Case 4: return host route for ifaddr */ + *prefix = ia->ia_addr.sin_addr; + mask->s_addr = INADDR_BROADCAST; + } else { + /* Cases 1,2: return actual ia prefix */ + *prefix = ia->ia_addr.sin_addr; + *mask = ia->ia_sockmask.sin_addr; + prefix->s_addr &= mask->s_addr; + } +} + +/* + * Adds or delete interface "prefix" route corresponding to @ifa. + * Returns 0 on success or errno. */ int in_handle_ifaddr_route(int cmd, struct in_ifaddr *ia) @@ -786,25 +854,7 @@ in_handle_ifaddr_route(int cmd, struct in_ifaddr *ia) struct epoch_tracker et; int error; - /* Case 4: ignore loopbacks */ - if (ifa->ifa_ifp->if_flags & IFF_LOOPBACK) - return (0); - - if (ifa->ifa_ifp->if_flags & IFF_POINTOPOINT) { - /* Case 3: install route towards dst addr */ - daddr = ia->ia_dstaddr.sin_addr; - pmask = NULL; - maddr.s_addr = INADDR_BROADCAST; - } else { - daddr = ia->ia_addr.sin_addr; - pmask = &ia->ia_sockmask; - maddr = pmask->sin_addr; - - if (maddr.s_addr == INADDR_BROADCAST) { - /* Case 2: ignore /32 routes */ - return (0); - } - } + ia_getrtprefix(ia, &daddr, &maddr); struct sockaddr_in mask = { .sin_family = AF_INET, @@ -812,8 +862,7 @@ in_handle_ifaddr_route(int cmd, struct in_ifaddr *ia) .sin_addr = maddr, }; - if (pmask != NULL) - pmask = &mask; + pmask = (maddr.s_addr != INADDR_BROADCAST) ? &mask : NULL; struct sockaddr_in dst = { .sin_family = AF_INET, @@ -821,56 +870,44 @@ in_handle_ifaddr_route(int cmd, struct in_ifaddr *ia) .sin_addr.s_addr = daddr.s_addr & maddr.s_addr, }; + struct ifnet *ifp = ia->ia_ifp; + + if ((maddr.s_addr == INADDR_BROADCAST) && + (!(ia->ia_ifp->if_flags & (IFF_POINTOPOINT|IFF_LOOPBACK)))) { + /* Case 2: host route on broadcast interface */ + ifp = V_loif; + } + uint32_t fibnum = ifa->ifa_ifp->if_fib; NET_EPOCH_ENTER(et); - error = in_handle_prefix_route(fibnum, cmd, &dst, pmask, ifa); + error = in_handle_prefix_route(fibnum, cmd, &dst, pmask, ifa, ifp); NET_EPOCH_EXIT(et); return (error); } - -#define rtinitflags(x) \ - ((((x)->ia_ifp->if_flags & (IFF_LOOPBACK | IFF_POINTOPOINT)) != 0) \ - ? RTF_HOST : 0) - /* * Check if we have a route for the given prefix already. */ static bool -in_hasrtprefix(struct in_ifaddr *target, int flags) +in_hasrtprefix(struct in_ifaddr *target) { struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia; struct in_addr prefix, mask, p, m; bool result = false; - if ((flags & RTF_HOST) != 0) { - prefix = target->ia_dstaddr.sin_addr; - mask.s_addr = 0; - } else { - prefix = target->ia_addr.sin_addr; - mask = target->ia_sockmask.sin_addr; - prefix.s_addr &= mask.s_addr; - } + ia_getrtprefix(target, &prefix, &mask); IN_IFADDR_RLOCK(&in_ifa_tracker); /* Look for an existing address with the same prefix, mask, and fib */ CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { - if (rtinitflags(ia)) { - p = ia->ia_dstaddr.sin_addr; + ia_getrtprefix(ia, &p, &m); - if (prefix.s_addr != p.s_addr) - continue; - } else { - p = ia->ia_addr.sin_addr; - m = ia->ia_sockmask.sin_addr; - p.s_addr &= m.s_addr; + if (prefix.s_addr != p.s_addr || + mask.s_addr != m.s_addr) + continue; - if (prefix.s_addr != p.s_addr || - mask.s_addr != m.s_addr) - continue; - } if (target->ia_ifp->if_fib != ia->ia_ifp->if_fib) continue; @@ -889,11 +926,11 @@ in_hasrtprefix(struct in_ifaddr *target, int flags) } int -in_addprefix(struct in_ifaddr *target, int flags) +in_addprefix(struct in_ifaddr *target) { int error; - if (in_hasrtprefix(target, flags)) { + if (in_hasrtprefix(target)) { if (V_nosameprefix) return (EEXIST); else { @@ -967,9 +1004,7 @@ in_scrubprefix(struct in_ifaddr *target, u_int flags) /* * Remove the loopback route to the interface address. */ - if ((target->ia_addr.sin_addr.s_addr != INADDR_ANY) && - !(target->ia_ifp->if_flags & IFF_LOOPBACK) && - (flags & LLE_STATIC)) { + if (ia_need_loopback_route(target) && (flags & LLE_STATIC)) { struct in_ifaddr *eia; /* @@ -989,14 +1024,7 @@ in_scrubprefix(struct in_ifaddr *target, u_int flags) } } - if (rtinitflags(target)) { - prefix = target->ia_dstaddr.sin_addr; - mask.s_addr = 0; - } else { - prefix = target->ia_addr.sin_addr; - mask = target->ia_sockmask.sin_addr; - prefix.s_addr &= mask.s_addr; - } + ia_getrtprefix(target, &prefix, &mask); if ((target->ia_flags & IFA_ROUTE) == 0) { rt_addrmsg(RTM_DELETE, &target->ia_ifa, target->ia_ifp->if_fib); @@ -1013,20 +1041,11 @@ in_scrubprefix(struct in_ifaddr *target, u_int flags) IN_IFADDR_RLOCK(&in_ifa_tracker); CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { - if (rtinitflags(ia)) { - p = ia->ia_dstaddr.sin_addr; - - if (prefix.s_addr != p.s_addr) - continue; - } else { - p = ia->ia_addr.sin_addr; - m = ia->ia_sockmask.sin_addr; - p.s_addr &= m.s_addr; + ia_getrtprefix(ia, &p, &m); - if (prefix.s_addr != p.s_addr || - mask.s_addr != m.s_addr) - continue; - } + if (prefix.s_addr != p.s_addr || + mask.s_addr != m.s_addr) + continue; if ((ia->ia_ifp->if_flags & IFF_UP) == 0) continue; @@ -1077,8 +1096,6 @@ in_scrubprefix(struct in_ifaddr *target, u_int flags) return (error); } -#undef rtinitflags - void in_ifscrub_all(void) { diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h index 3a83c5e832ab..c7ebff80e56d 100644 --- a/sys/netinet/in_var.h +++ b/sys/netinet/in_var.h @@ -461,7 +461,7 @@ int in_leavegroup_locked(struct in_multi *, /*const*/ struct in_mfilter *); int in_control(struct socket *, u_long, caddr_t, struct ifnet *, struct thread *); -int in_addprefix(struct in_ifaddr *, int); +int in_addprefix(struct in_ifaddr *); int in_scrubprefix(struct in_ifaddr *, u_int); void in_ifscrub_all(void); int in_handle_ifaddr_route(int, struct in_ifaddr *); diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 1fe3f16a92c8..9a551a70c3ad 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1065,7 +1065,7 @@ carp_ifa_addroute(struct ifaddr *ifa) switch (ifa->ifa_addr->sa_family) { #ifdef INET case AF_INET: - in_addprefix(ifatoia(ifa), RTF_UP); + in_addprefix(ifatoia(ifa)); ifa_add_loopback_route(ifa, (struct sockaddr *)&ifatoia(ifa)->ia_addr); break; From owner-dev-commits-src-main@freebsd.org Thu Jan 21 21:59:51 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A32904E1597 for ; Thu, 21 Jan 2021 21:59:51 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic301-22.consmr.mail.gq1.yahoo.com (sonic301-22.consmr.mail.gq1.yahoo.com [98.137.64.148]) (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 4DMGX55m9Lz3FXr for ; Thu, 21 Jan 2021 21:59:49 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1611266387; bh=67KwvQ+fpXbiAkAFiVa7r/N0rI2PpPCwX2cuEz0zphA=; h=Subject:From:Date:To:From:Subject:Reply-To; b=IG0j6QZ5T/Lirp6QKtiT8O3qt1OVDO3/m7C/9Jnla6XL3k+RbP2JAv5hXIqIzWMWT5I1+MVm+UsFhW10/GQWD2tF36WTlHBpR9Yikx3YjSWMHj7/lkmHJTu7s2I3f2ulim0KFLOASIma1bgwFSqW9hIqFa95qwvFkOtOANgqzI6OLjdeilLIYlPrh3VEEMp/1SHXXAp4SIUUivlAwxpxSjV2H6FzD+6BYD1FWLfptFWuyCoX3lQ58HlP5w78ThPKIFhGRPWaBgeXFWFnvXA6p0UaegWoMcJlXr8xP4A3iRWCrOk9e7jK1OfFYYOnebkklc5r1TKFXvAOmwDDrBxoFg== X-YMail-OSG: ukV8NGwVM1kMTsnyY5.T4hLEAzpnSfv8JXMleGdXhn4utcB585QGr83gcqgPQuo 6nrw8lxrnc0VZhjs5mBGKCOjE2Vl4EeWY2o09MMRl89ixq9wIhDMQHK5ZhOWGeD3dY8Av.hwGeSb 0bd7sYVu7oD0KTWnTXDiN66pyokMYD3CLoZr015fxUyh5uxLpuVKQUTzn2CbHKKVPr35HTJPDblb ntnYsxgoPynIHDvs_43AX9YvJpdVyMNdGWIl1crhCHO0u.YwdyjTouescB7lPNvk.U5Ckt6yX3IT QTRO434UnjeAtlOyLrbZaUI9Fz5pdBe2ZGyk2x3RqQ3JUMibyRyjfe9p8KqF7TAqKqJZQv7Veby5 3XPSddmPzqgEmoDjuc43Q8dCRex4Z_mz4MPSqAYGiAIUTaGS9jx25.CUwDm0FtR9wqYNnBGwCR90 WgSlIdinu_z.Y8An5Bfwv304BrbjN.mZgH_FsWEUr7uTj5eRbNBOjrRdz9P_Tvqyny42jyepDU1Y ow9TBFZxLy67IKcQ7KtK.JjEO4cZJvuBnyXsvfctSSzL4bO5pPZuUX6cH25Ibpsf.AmSTn6LJO8r j9mSCfmg3xcu7ipkjROX6HyDOqqktpFLIf.lqbFLZmWOpeh2WEQoa8TpgpEiOXlPkvenWNNNsEhD YLwDWjLgJVTu.G94oPWNjHFg81.vLqLbwK84UctNPE5a.6smq7vvYAWRz84eCMJQ023CUkRYLnIh uFx9gTVuchts9P_K6il6sGXD.vRld87.0rUu1io9FGTruyZ2idAnfDonLeddGzMKf3tPxWE0iwZ7 UD7xZ8wjJ1NMoRthuPE2m0zxEQGUFxf7OmmXrQD5BFCHIEhUKBoC4RkQz3rMgnhATY2ezOkm7BDv Hor9d0oDWaGQ3DDmrTHJhF5KuKhBG4tQfvCPcHwndh3LA1O3AsQ762813rA8uxVQHIm2t6yY22zl rlhH0ghcPNcQFErqlWJSve.Uh9JtsLMyuFRK6ck9ZMNezBhiVqRXOKch9WyXhX4d8LWJFZ0ZsyTc PmFczCtFrVzD5rfjCqA6h0X7QHb1BGxSwdhXztPraSkubQ.CeSE9Nz1aMzENuS7sI100X5x9YDHo 155pFJSrfLMMEYlq4eOe99EjU3WgJA7PiQ99fA1F3gcNRMGPK057820gUcEp0YcBufjYwu3zMhXp XVVyyz1d3g1kY1hrK5n.O0wlQIlNhA6XhrH3I5JieyKOK7nve2TynRsEg0hXK70dQcWK_ZJboIpa jjU8QmbVj7H3LVEDKgVaLU3EtU4BuHL8MUpSzJfyUeUntmhTlhGvdcrrFH2vgluqTF3_nwROtfpf s5gwVqn_IFvD15YtKPK.RIbyYvcXHW093vxivTOSkrVNU5cb41kP8QQ5o_N34jGEnJP8kq4jATtL yGzqSn51g.n2mh3o3TBe__WL3ZvPf1SnW1vMmPup9BKycge2rcuGootY6WsKq1UEfQcn7PH0o6.e VG0Utj85cnF25b7XGeK0B3TVn48Z2pwTBLM3LqOgwYmb1fmAmGgdOFnVIis1BXMo3IVTw0iJW2Kq aczZi3..ScHY_q7BA9DWM_XCuSSbTQxsFK3736rtxmxpAGdlvBdVrMutxnd8iGqMIMqIpx6ar4BN RY0Ns5uTXnDmemtoZxHrzoQ9PVjb2_iwrxE7U7AW3eSy5valIzG2BDz9WvGmLFbtqTHNn4xFJm3i zll1l_2VdmlXKFajsMIhmNbC9P93irmO3zhgRUc_2HtliVNCODpHKEca4njSUw6MPDP_QEcBO9WI xdQQPs522CDTuzUvgGT3zUsIRR4XHcUqCp7KFKyewy8snKMGxOIgIjXM11qyaR2MzmZ1n8UjvCvy .xmfo_DHbRxMLEZbeMo.HILDabBAO3sC9Xs.LPHLu.X_ARnZ5rJSWOFxJcX03JEvz6w8DOvwUXOt YW3kFMF8NVFnr0_L8dbh4hWCiJcuWRtoA8en6v50Sw_dMDpA3XtMM.VebTwZZ3hY_db4pH06sOpk vEM.7HGmSneiXL7hdziVq6ha.pG72PP8.3KBD.jermo1c3OE2gsDu4UJmFbv6NAURpbT6LqLjjKR jTbQdLonCys_LHbmsQdJYinMfIOiME8ikB6PmaHqIoGcjJj28.tAAqOeQbXsS4joOrDb_euagFeq BtADkqwogwUzoBaL8QWdbGDagM8HVBF5YAsbg.Zlmy.88ugIVd2EVMM9Ypz6HpM1fQLthLebKc_U VuuX7oUA55AF9E1hf.4Fm4OvPXEO8lJIS0cXDOMDAn_oeOg4rM2hfoCUoJzcJxOfkdWh4OMyiNri ArL6PiLfwC29Pt8JyIxyEpS_33NdqSEzVPMposWWoVASCYlcjQOA_9MU1zUK21tQZqeQOyacwGh8 Tu9a4OJu5T3O01h6ZuXDqc7kxbQOkxRMpyOrhx5G4DMHA.fNYbYgXQghxk5cIcdIaEA4g.7gQm7c MVrmuVmv5NdlTHlvYUWKYOB76jCn.P2MdI.GgosKihLWtmyYMpq4WF2U3QsmU50UdRBm1V7kOu8T HRUSXWXfWvBUU3GhKQrcEpFV1jTEzmhHE_SF_h4MCpfvwwtOZOAubpA33qjRiuN9MKF4jWf8- Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.gq1.yahoo.com with HTTP; Thu, 21 Jan 2021 21:59:47 +0000 Received: by smtp417.mail.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 9a6415102952294e6c6cf7b792cd5d1a; Thu, 21 Jan 2021 21:59:43 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) [the removal of git branch information] From: Mark Millard In-Reply-To: <38C7FD1F-4C7D-4EFC-8217-95CF4ECDB5A5@yahoo.com> Date: Thu, 21 Jan 2021 13:59:41 -0800 Cc: Current FreeBSD Content-Transfer-Encoding: quoted-printable Message-Id: References: <38C7FD1F-4C7D-4EFC-8217-95CF4ECDB5A5@yahoo.com> To: dev-commits-src-main@freebsd.org X-Mailer: Apple Mail (2.3654.40.0.2.32) X-Rspamd-Queue-Id: 4DMGX55m9Lz3FXr X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.03 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_SHORT(-0.53)[-0.531]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; RBL_DBL_DONT_QUERY_IPS(0.00)[98.137.64.148:from]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[98.137.64.148:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.64.148:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.64.148:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 21:59:51 -0000 On 2021-Jan-21, at 09:24, Mark Millard wrote: > Ulrich Sp=C3=83=C2=B6rlein uqs at FreeBSD.org wrote on > Wed Jan 20 09:49:49 UTC 2021 : >=20 >> While here, drop the redundant branch name from the git output and = don't >> count commits in shallow clones. >>=20 >=20 > The branch name part of the patch breaks how I work with multiple > branches and I will be locally "reverting" it in my branches > unless FreeBSD itself reverts it. For my context it even breaks > how I would work for main vs. stable/12 if I ever did something > with stable/12 . (I'm not using shallow clones, it is the branch > name removal that messes up my specific way of working.) In other > words, for how I choose to work, the branch name is not redundant. >=20 > Going in another direction: mixing gitup/clone-counting and the > branch name removal in the same commit and in the code structure > means that I'm unable to just skip a commit to deal with the > branch name issue. I had an exchange with Michael Osipov and he reports that he "advocated to have" the git branch information. So, for: "While here, drop the redundant branch name from the git output" do not take the content of the commit log as indicating that Michael Osipov was asking for this part of the change. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-dev-commits-src-main@freebsd.org Thu Jan 21 23:20:46 2021 Return-Path: Delivered-To: dev-commits-src-main@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 AAD674E3338; Thu, 21 Jan 2021 23:20:46 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMJKV4Vqsz3LXc; Thu, 21 Jan 2021 23:20:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D68D1467B; Thu, 21 Jan 2021 23:20:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LNKkYN071105; Thu, 21 Jan 2021 23:20:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LNKkS7071104; Thu, 21 Jan 2021 23:20:46 GMT (envelope-from git) Date: Thu, 21 Jan 2021 23:20:46 GMT Message-Id: <202101212320.10LNKkS7071104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marius Strobl Subject: git: b2a29e5f8319 - main - boot_font(4): remove obsolete font MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2a29e5f8319d5016a2c6690cb023c39266ae89c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 23:20:46 -0000 The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=b2a29e5f8319d5016a2c6690cb023c39266ae89c commit b2a29e5f8319d5016a2c6690cb023c39266ae89c Author: Marius Strobl AuthorDate: 2021-01-17 13:21:49 +0000 Commit: Marius Strobl CommitDate: 2021-01-21 23:18:39 +0000 boot_font(4): remove obsolete font It's no longer used since 4e421792ec80df7a5fa82e97dcc3575c3ec6740a and r325892 respectively. --- sys/dev/fb/boot_font.c | 4637 ------------------------------------------------ sys/dev/fb/gfb.h | 43 - 2 files changed, 4680 deletions(-) diff --git a/sys/dev/fb/boot_font.c b/sys/dev/fb/boot_font.c deleted file mode 100644 index 369aa1d59bcf..000000000000 --- a/sys/dev/fb/boot_font.c +++ /dev/null @@ -1,4637 +0,0 @@ -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran. - * - * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. - */ -/*- - * This font lives in the public domain. It is a PC font, IBM encoding - * (CP437), which was designed for use with syscons. - * - * Copyright (c) 2000 Andrew Miklic - */ - -#include -__FBSDID("$FreeBSD$"); - -#include - -#include - -const struct gfb_font bold8x16 = { - 8, - 16, - { - /* \00 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \01 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x3c, /* ..****.. */ - 0x42, /* .*....*. */ - 0x81, /* *......* */ - 0xe7, /* ***..*** */ - 0xa5, /* *.*..*.* */ - 0x99, /* *..**..* */ - 0x81, /* *......* */ - 0x99, /* *..**..* */ - 0x42, /* .*....*. */ - 0x3c, /* ..****.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \02 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x3c, /* ..****.. */ - 0x7e, /* .******. */ - 0xff, /* ******** */ - 0x99, /* *..**..* */ - 0xdb, /* **.**.** */ - 0xe7, /* ***..*** */ - 0xff, /* ******** */ - 0xe7, /* ***..*** */ - 0x7e, /* .******. */ - 0x3c, /* ..****.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \03 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x6c, /* .**.**.. */ - 0xfe, /* *******. */ - 0xfe, /* *******. */ - 0xfe, /* *******. */ - 0xfe, /* *******. */ - 0xfe, /* *******. */ - 0x7c, /* .*****.. */ - 0x38, /* ..***... */ - 0x10, /* ...*.... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \04 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x10, /* ...*.... */ - 0x38, /* ..***... */ - 0x7c, /* .*****.. */ - 0xfe, /* *******. */ - 0x7c, /* .*****.. */ - 0x38, /* ..***... */ - 0x10, /* ...*.... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \05 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x10, /* ...*.... */ - 0xd6, /* **.*.**. */ - 0xfe, /* *******. */ - 0xd6, /* **.*.**. */ - 0x10, /* ...*.... */ - 0x38, /* ..***... */ - 0x7c, /* .*****.. */ - 0x7c, /* .*****.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \06 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x10, /* ...*.... */ - 0x38, /* ..***... */ - 0x7c, /* .*****.. */ - 0xfe, /* *******. */ - 0xfe, /* *******. */ - 0x54, /* .*.*.*.. */ - 0x10, /* ...*.... */ - 0x38, /* ..***... */ - 0x7c, /* .*****.. */ - 0x7c, /* .*****.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \07 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x18, /* ...**... */ - 0x3c, /* ..****.. */ - 0x3c, /* ..****.. */ - 0x18, /* ...**... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \010 */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xe7, /* ***..*** */ - 0xc3, /* **....** */ - 0xc3, /* **....** */ - 0xe7, /* ***..*** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - - /* \011 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x3c, /* ..****.. */ - 0x66, /* .**..**. */ - 0x42, /* .*....*. */ - 0x42, /* .*....*. */ - 0x66, /* .**..**. */ - 0x3c, /* ..****.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \012 */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xc3, /* **....** */ - 0x99, /* *..**..* */ - 0xbd, /* *.****.* */ - 0xbd, /* *.****.* */ - 0x99, /* *..**..* */ - 0xc3, /* **....** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0xff, /* ******** */ - - /* \013 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x1e, /* ...****. */ - 0x0e, /* ....***. */ - 0x1a, /* ...**.*. */ - 0x30, /* ..**.... */ - 0x78, /* .****... */ - 0xcc, /* **..**.. */ - 0xcc, /* **..**.. */ - 0xcc, /* **..**.. */ - 0xcc, /* **..**.. */ - 0x78, /* .****... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \014 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x3c, /* ..****.. */ - 0x66, /* .**..**. */ - 0x66, /* .**..**. */ - 0x66, /* .**..**. */ - 0x3c, /* ..****.. */ - 0x18, /* ...**... */ - 0x7e, /* .******. */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \015 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x10, /* ...*.... */ - 0x18, /* ...**... */ - 0x14, /* ...*.*.. */ - 0x14, /* ...*.*.. */ - 0x14, /* ...*.*.. */ - 0x10, /* ...*.... */ - 0x10, /* ...*.... */ - 0x30, /* ..**.... */ - 0x70, /* .***.... */ - 0x20, /* ..*..... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \016 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x3e, /* ..*****. */ - 0x22, /* ..*...*. */ - 0x3e, /* ..*****. */ - 0x22, /* ..*...*. */ - 0x22, /* ..*...*. */ - 0x22, /* ..*...*. */ - 0x22, /* ..*...*. */ - 0x26, /* ..*..**. */ - 0x6e, /* .**.***. */ - 0xe4, /* ***..*.. */ - 0x40, /* .*...... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \017 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x10, /* ...*.... */ - 0x92, /* *..*..*. */ - 0x54, /* .*.*.*.. */ - 0x28, /* ..*.*... */ - 0xc6, /* **...**. */ - 0x28, /* ..*.*... */ - 0x54, /* .*.*.*.. */ - 0x92, /* *..*..*. */ - 0x10, /* ...*.... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \020 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x60, /* .**..... */ - 0x70, /* .***.... */ - 0x78, /* .****... */ - 0x7c, /* .*****.. */ - 0x7e, /* .******. */ - 0x7e, /* .******. */ - 0x7c, /* .*****.. */ - 0x78, /* .****... */ - 0x70, /* .***.... */ - 0x60, /* .**..... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \021 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x06, /* .....**. */ - 0x0e, /* ....***. */ - 0x1e, /* ...****. */ - 0x3e, /* ..*****. */ - 0x7e, /* .******. */ - 0x7e, /* .******. */ - 0x3e, /* ..*****. */ - 0x1e, /* ...****. */ - 0x0e, /* ....***. */ - 0x06, /* .....**. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \022 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x10, /* ...*.... */ - 0x38, /* ..***... */ - 0x7c, /* .*****.. */ - 0xfe, /* *******. */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0xfe, /* *******. */ - 0x7c, /* .*****.. */ - 0x38, /* ..***... */ - 0x10, /* ...*.... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \023 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x66, /* .**..**. */ - 0x66, /* .**..**. */ - 0x66, /* .**..**. */ - 0x66, /* .**..**. */ - 0x66, /* .**..**. */ - 0x66, /* .**..**. */ - 0x66, /* .**..**. */ - 0x00, /* ........ */ - 0x66, /* .**..**. */ - 0x66, /* .**..**. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \024 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x7e, /* .******. */ - 0xf4, /* ****.*.. */ - 0xf4, /* ****.*.. */ - 0xf4, /* ****.*.. */ - 0x74, /* .***.*.. */ - 0x14, /* ...*.*.. */ - 0x14, /* ...*.*.. */ - 0x14, /* ...*.*.. */ - 0x14, /* ...*.*.. */ - 0x14, /* ...*.*.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \025 */ - 0x00, /* ........ */ - 0x1e, /* ...****. */ - 0x30, /* ..**.... */ - 0x78, /* .****... */ - 0xdc, /* **.***.. */ - 0xce, /* **..***. */ - 0xe7, /* ***..*** */ - 0x73, /* .***..** */ - 0x3b, /* ..***.** */ - 0x1e, /* ...****. */ - 0x0c, /* ....**.. */ - 0x78, /* .****... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \026 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0xfe, /* *******. */ - 0xfe, /* *******. */ - 0xfe, /* *******. */ - 0xfe, /* *******. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \027 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x10, /* ...*.... */ - 0x38, /* ..***... */ - 0x7c, /* .*****.. */ - 0xfe, /* *******. */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0xfe, /* *******. */ - 0x7c, /* .*****.. */ - 0x38, /* ..***... */ - 0x10, /* ...*.... */ - 0xfe, /* *******. */ - 0x00, /* ........ */ - - /* \030 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x10, /* ...*.... */ - 0x38, /* ..***... */ - 0x7c, /* .*****.. */ - 0xfe, /* *******. */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \031 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0x38, /* ..***... */ - 0xfe, /* *******. */ - 0x7c, /* .*****.. */ - 0x38, /* ..***... */ - 0x10, /* ...*.... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \032 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x08, /* ....*... */ - 0x0c, /* ....**.. */ - 0xfe, /* *******. */ - 0xff, /* ******** */ - 0xfe, /* *******. */ - 0x0c, /* ....**.. */ - 0x08, /* ....*... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \033 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x10, /* ...*.... */ - 0x30, /* ..**.... */ - 0x7f, /* .******* */ - 0xff, /* ******** */ - 0x7f, /* .******* */ - 0x30, /* ..**.... */ - 0x10, /* ...*.... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \034 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x33, /* ..**..** */ - 0x66, /* .**..**. */ - 0xee, /* ***.***. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \035 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x24, /* ..*..*.. */ - 0x66, /* .**..**. */ - 0xff, /* ******** */ - 0x66, /* .**..**. */ - 0x24, /* ..*..*.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \036 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x18, /* ...**... */ - 0x3c, /* ..****.. */ - 0x7e, /* .******. */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* \037 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0xff, /* ******** */ - 0xff, /* ******** */ - 0x7e, /* .******. */ - 0x3c, /* ..****.. */ - 0x18, /* ...**... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* ! */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x18, /* ...**... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* " */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x77, /* .***.*** */ - 0x66, /* .**..**. */ - 0xcc, /* **..**.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* # */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x6c, /* .**.**.. */ - 0x6c, /* .**.**.. */ - 0xfe, /* *******. */ - 0x6c, /* .**.**.. */ - 0x6c, /* .**.**.. */ - 0x6c, /* .**.**.. */ - 0xfe, /* *******. */ - 0x6c, /* .**.**.. */ - 0x6c, /* .**.**.. */ - 0x6c, /* .**.**.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* $ */ - 0x00, /* ........ */ - 0x10, /* ...*.... */ - 0x10, /* ...*.... */ - 0x7c, /* .*****.. */ - 0xd6, /* **.*.**. */ - 0xd0, /* **.*.... */ - 0xd0, /* **.*.... */ - 0x7c, /* .*****.. */ - 0x16, /* ...*.**. */ - 0x16, /* ...*.**. */ - 0xd6, /* **.*.**. */ - 0x7c, /* .*****.. */ - 0x10, /* ...*.... */ - 0x10, /* ...*.... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* % */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0xc6, /* **...**. */ - 0xc4, /* **...*.. */ - 0x0c, /* ....**.. */ - 0x08, /* ....*... */ - 0x18, /* ...**... */ - 0x30, /* ..**.... */ - 0x20, /* ..*..... */ - 0x60, /* .**..... */ - 0x46, /* .*...**. */ - 0xc6, /* **...**. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* & */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x38, /* ..***... */ - 0x6c, /* .**.**.. */ - 0x6c, /* .**.**.. */ - 0x38, /* ..***... */ - 0x76, /* .***.**. */ - 0xdc, /* **.***.. */ - 0xcc, /* **..**.. */ - 0xcc, /* **..**.. */ - 0xcc, /* **..**.. */ - 0x76, /* .***.**. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* ' */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x1c, /* ...***.. */ - 0x18, /* ...**... */ - 0x30, /* ..**.... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* ( */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x0c, /* ....**.. */ - 0x18, /* ...**... */ - 0x30, /* ..**.... */ - 0x30, /* ..**.... */ - 0x30, /* ..**.... */ - 0x30, /* ..**.... */ - 0x30, /* ..**.... */ - 0x30, /* ..**.... */ - 0x18, /* ...**... */ - 0x0c, /* ....**.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* ) */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x30, /* ..**.... */ - 0x18, /* ...**... */ - 0x0c, /* ....**.. */ - 0x0c, /* ....**.. */ - 0x0c, /* ....**.. */ - 0x0c, /* ....**.. */ - 0x0c, /* ....**.. */ - 0x0c, /* ....**.. */ - 0x18, /* ...**... */ - 0x30, /* ..**.... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* * */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x66, /* .**..**. */ - 0x3c, /* ..****.. */ - 0xff, /* ******** */ - 0x3c, /* ..****.. */ - 0x66, /* .**..**. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* + */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x7e, /* .******. */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* , */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x1c, /* ...***.. */ - 0x18, /* ...**... */ - 0x30, /* ..**.... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* - */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x7e, /* .******. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* . */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* / */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x06, /* .....**. */ - 0x04, /* .....*.. */ - 0x0c, /* ....**.. */ - 0x08, /* ....*... */ - 0x18, /* ...**... */ - 0x10, /* ...*.... */ - 0x30, /* ..**.... */ - 0x20, /* ..*..... */ - 0x60, /* .**..... */ - 0x40, /* .*...... */ - 0xc0, /* **...... */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* 0 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x7c, /* .*****.. */ - 0xc6, /* **...**. */ - 0xc6, /* **...**. */ - 0xc6, /* **...**. */ - 0xd6, /* **.*.**. */ - 0xd6, /* **.*.**. */ - 0xc6, /* **...**. */ - 0xc6, /* **...**. */ - 0xc6, /* **...**. */ - 0x7c, /* .*****.. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* 1 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x18, /* ...**... */ - 0x38, /* ..***... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x18, /* ...**... */ - 0x7e, /* .******. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ - - /* 2 */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x7c, /* .*****.. */ - 0xc6, /* **...**. */ - 0x06, /* .....**. */ - 0x06, /* .....**. */ - 0x0c, /* ....**.. */ - 0x18, /* ...**... */ - 0x30, /* ..**.... */ - 0x60, /* .**..... */ - 0xc0, /* **...... */ - 0xfe, /* *******. */ - 0x00, /* ........ */ - 0x00, /* ........ */ - 0x00, /* ........ */ *** 3724 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu Jan 21 23:20:47 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BD3714E33BE; Thu, 21 Jan 2021 23:20:47 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMJKW53XRz3LXd; Thu, 21 Jan 2021 23:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A110314BA3; Thu, 21 Jan 2021 23:20:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LNKleS071353; Thu, 21 Jan 2021 23:20:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LNKloP071341; Thu, 21 Jan 2021 23:20:47 GMT (envelope-from git) Date: Thu, 21 Jan 2021 23:20:47 GMT Message-Id: <202101212320.10LNKloP071341@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marius Strobl Subject: git: c62ee7332e4d - main - fb_if: remove unused method MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c62ee7332e4dc5a9c4cbec47c967b94f8abf1981 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 23:20:47 -0000 The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=c62ee7332e4dc5a9c4cbec47c967b94f8abf1981 commit c62ee7332e4dc5a9c4cbec47c967b94f8abf1981 Author: Marius Strobl AuthorDate: 2021-01-17 13:31:56 +0000 Commit: Marius Strobl CommitDate: 2021-01-21 23:18:39 +0000 fb_if: remove unused method Apparently, it never came into play. --- sys/dev/fb/fb_if.m | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/dev/fb/fb_if.m b/sys/dev/fb/fb_if.m index f7cb52ce967a..53e4563bb6f5 100644 --- a/sys/dev/fb/fb_if.m +++ b/sys/dev/fb/fb_if.m @@ -3,11 +3,6 @@ INTERFACE fb; -METHOD int pin_max { - device_t dev; - int *npins; -}; - METHOD struct fb_info * getinfo { device_t dev; }; From owner-dev-commits-src-main@freebsd.org Thu Jan 21 23:20:50 2021 Return-Path: Delivered-To: dev-commits-src-main@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 80F1F4E33C3; Thu, 21 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMJKZ1StNz3LKv; Thu, 21 Jan 2021 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0B31145E9; Thu, 21 Jan 2021 23:20:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LNKnjQ071859; Thu, 21 Jan 2021 23:20:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LNKnuF071858; Thu, 21 Jan 2021 23:20:49 GMT (envelope-from git) Date: Thu, 21 Jan 2021 23:20:49 GMT Message-Id: <202101212320.10LNKnuF071858@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marius Strobl Subject: git: 2dcbf0462e17 - main - sym(4): handle mixed tagged/untagged commands gracefully MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2dcbf0462e17db1b0a8cc99d1f95a7b0ba6437b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 23:20:50 -0000 The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=2dcbf0462e17db1b0a8cc99d1f95a7b0ba6437b2 commit 2dcbf0462e17db1b0a8cc99d1f95a7b0ba6437b2 Author: Marius Strobl AuthorDate: 2021-01-21 22:48:08 +0000 Commit: Marius Strobl CommitDate: 2021-01-21 23:18:39 +0000 sym(4): handle mixed tagged/untagged commands gracefully Handle the case of a tagged command arriving when there's an untagged one still outstanding gracefully instead of panicing. While at it: - Replace fancy arithmetics with a simple assignment as busy_itl can only ever be either 0 or 1. - Fix a comment typo in sym_free_ccb(). --- sys/dev/sym/sym_hipd.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index f1c058f75c52..61104f75fd92 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -6291,13 +6291,12 @@ static ccb_p sym_get_ccb (hcb_p np, u_char tn, u_char ln, u_char tag_order) goto out_free; } else { /* - * If we have been asked for a tagged command. + * If we have been asked for a tagged command, refuse + * to overlap with an existing untagged one. */ if (tag_order) { - /* - * Debugging purpose. - */ - assert(lp->busy_itl == 0); + if (lp->busy_itl != 0) + goto out_free; /* * Allocate resources for tags if not yet. */ @@ -6330,22 +6329,17 @@ static ccb_p sym_get_ccb (hcb_p np, u_char tn, u_char ln, u_char tag_order) * one, refuse to overlap this untagged one. */ else { - /* - * Debugging purpose. - */ - assert(lp->busy_itl == 0 && lp->busy_itlq == 0); + if (lp->busy_itlq != 0 || lp->busy_itl != 0) + goto out_free; /* * Count this nexus for this LUN. * Set up the CCB bus address for reselection. * Toggle reselect path to untagged. */ - if (++lp->busy_itl == 1) { - lp->head.itl_task_sa = cpu_to_scr(cp->ccb_ba); - lp->head.resel_sa = - cpu_to_scr(SCRIPTA_BA (np, resel_no_tag)); - } - else - goto out_free; + lp->busy_itl = 1; + lp->head.itl_task_sa = cpu_to_scr(cp->ccb_ba); + lp->head.resel_sa = + cpu_to_scr(SCRIPTA_BA (np, resel_no_tag)); } } /* @@ -6391,7 +6385,7 @@ static void sym_free_ccb(hcb_p np, ccb_p cp) */ if (lp) { /* - * If tagged, release the tag, set the relect path + * If tagged, release the tag, set the reselect path. */ if (cp->tag != NO_TAG) { /* @@ -6412,7 +6406,7 @@ static void sym_free_ccb(hcb_p np, ccb_p cp) * and uncount this CCB. */ lp->head.itl_task_sa = cpu_to_scr(np->bad_itl_ba); - --lp->busy_itl; + lp->busy_itl = 0; } /* * If no JOB active, make the LUN reselect path invalid. From owner-dev-commits-src-main@freebsd.org Thu Jan 21 23:20:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4850C4E323D; Thu, 21 Jan 2021 23:20:49 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMJKY0FmNz3LKq; Thu, 21 Jan 2021 23:20:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA3D1149D0; Thu, 21 Jan 2021 23:20:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LNKmus071841; Thu, 21 Jan 2021 23:20:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LNKmrL071840; Thu, 21 Jan 2021 23:20:48 GMT (envelope-from git) Date: Thu, 21 Jan 2021 23:20:48 GMT Message-Id: <202101212320.10LNKmrL071840@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marius Strobl Subject: git: e60a0db3b8c9 - main - sym(4): fix nits reported by Coverity MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e60a0db3b8c922f9bcd085f737508a9cb4eb7f29 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 23:20:50 -0000 The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=e60a0db3b8c922f9bcd085f737508a9cb4eb7f29 commit e60a0db3b8c922f9bcd085f737508a9cb4eb7f29 Author: Marius Strobl AuthorDate: 2021-01-21 22:34:19 +0000 Commit: Marius Strobl CommitDate: 2021-01-21 23:18:39 +0000 sym(4): fix nits reported by Coverity - In ___dma_getp(), remove dead code. [1] - In sym_sir_bad_scsi_status(), add missing FALLTHROUGH. [2] While at it: - For getbaddrcb(), remove __unused from the nseg argument as it's in fact used when compiling with INVARIANTS. - In sym_int_sir(), ensure in all branches that cp is not NULL before using it. Reported by: Coverity CID: 1008861 [1], 114996 [2] --- sys/dev/sym/sym_hipd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index 45a9452dbd81..f1c058f75c52 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -571,8 +571,7 @@ static void sym_mfree(void *ptr, int size, char *name) * BUS handle. A reverse table (hashed) is maintained for virtual * to BUS address translation. */ -static void getbaddrcb(void *arg, bus_dma_segment_t *segs, int nseg __unused, - int error) +static void getbaddrcb(void *arg, bus_dma_segment_t *segs, int nseg, int error) { bus_addr_t *baddr; @@ -610,8 +609,6 @@ static m_addr_t ___dma_getp(m_pool_s *mp) return (m_addr_t) vaddr; } out_err: - if (baddr) - bus_dmamap_unload(mp->dmat, vbp->dmamap); if (vaddr) bus_dmamem_free(mp->dmat, vaddr, vbp->dmamap); if (vbp) @@ -4680,6 +4677,7 @@ static void sym_sir_bad_scsi_status(hcb_p np, ccb_p cp) PRINT_ADDR(cp); printf (s_status == S_BUSY ? "BUSY" : "QUEUE FULL\n"); } + /* FALLTHROUGH */ default: /* S_INT, S_INT_COND_MET, S_CONFLICT */ sym_complete_error (np, cp); break; @@ -6003,6 +6001,8 @@ static void sym_int_sir (hcb_p np) * or has been auto-sensed. */ case SIR_COMPLETE_ERROR: + if (!cp) + goto out; sym_complete_error(np, cp); return; /* @@ -6228,6 +6228,8 @@ static void sym_int_sir (hcb_p np) * Target does not want answer message. */ case SIR_NEGO_PROTO: + if (!cp) + goto out; sym_nego_default(np, tp, cp); goto out; } From owner-dev-commits-src-main@freebsd.org Thu Jan 21 23:20:57 2021 Return-Path: Delivered-To: dev-commits-src-main@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 DF00C4E3435; Thu, 21 Jan 2021 23:20:57 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMJKf63Wvz3LQd; Thu, 21 Jan 2021 23:20:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2770B14C9B; Thu, 21 Jan 2021 23:20:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LNKqC2071903; Thu, 21 Jan 2021 23:20:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LNKqh2071902; Thu, 21 Jan 2021 23:20:52 GMT (envelope-from git) Date: Thu, 21 Jan 2021 23:20:52 GMT Message-Id: <202101212320.10LNKqh2071902@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marius Strobl Subject: git: 679e4cdabdc5 - main - kvprintf(9): add missing FALLTHROUGH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 679e4cdabdc5a93e5c0d7cdf3fc52202a8de02ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 23:20:58 -0000 The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=679e4cdabdc5a93e5c0d7cdf3fc52202a8de02ef commit 679e4cdabdc5a93e5c0d7cdf3fc52202a8de02ef Author: Marius Strobl AuthorDate: 2021-01-21 23:16:37 +0000 Commit: Marius Strobl CommitDate: 2021-01-21 23:18:40 +0000 kvprintf(9): add missing FALLTHROUGH Reported by: Coverity CID: 1005166 --- sys/kern/subr_prf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index b51213a25d0d..bbe95653919f 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -848,6 +848,7 @@ reswitch: switch (ch = (u_char)*fmt++) { goto handle_nosign; case 'X': upper = 1; + /* FALLTHROUGH */ case 'x': base = 16; goto handle_nosign; From owner-dev-commits-src-main@freebsd.org Thu Jan 21 23:20:55 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8E6FC4E3521; Thu, 21 Jan 2021 23:20:55 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMJKc42prz3LSY; Thu, 21 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 158E214C99; Thu, 21 Jan 2021 23:20:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10LNKofx071881; Thu, 21 Jan 2021 23:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10LNKogm071880; Thu, 21 Jan 2021 23:20:50 GMT (envelope-from git) Date: Thu, 21 Jan 2021 23:20:50 GMT Message-Id: <202101212320.10LNKogm071880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marius Strobl Subject: git: 3b433ed76500 - main - mmcsd(4): properly set BIO error when partition switching fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b433ed76500f1dde444bed736f9f36695cb93a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2021 23:20:55 -0000 The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=3b433ed76500f1dde444bed736f9f36695cb93a0 commit 3b433ed76500f1dde444bed736f9f36695cb93a0 Author: Marius Strobl AuthorDate: 2021-01-21 23:09:09 +0000 Commit: Marius Strobl CommitDate: 2021-01-21 23:18:40 +0000 mmcsd(4): properly set BIO error when partition switching fails While at it, remove redundant braces and goto in mmcsd_task(). Reported by: Coverity CID: 1419639 --- sys/dev/mmc/mmcsd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index 2a55a9be1548..5e821586f722 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -1440,6 +1440,7 @@ mmcsd_task(void *arg) mmcbus = sc->mmcbus; while (1) { + bio_error = 0; MMCSD_DISK_LOCK(part); do { if (part->running == 0) @@ -1481,21 +1482,18 @@ mmcsd_task(void *arg) if (block < part->eend && end > part->eblock) part->eblock = part->eend = 0; block = mmcsd_rw(part, bp); - } else if (bp->bio_cmd == BIO_DELETE) { + } else if (bp->bio_cmd == BIO_DELETE) block = mmcsd_delete(part, bp); - } else { + else bio_error = EOPNOTSUPP; - goto release; - } release: MMCBUS_RELEASE_BUS(mmcbus, dev); if (block < end) { bp->bio_error = (bio_error == 0) ? EIO : bio_error; bp->bio_resid = (end - block) * sz; bp->bio_flags |= BIO_ERROR; - } else { + } else bp->bio_resid = 0; - } biodone(bp); } out: From owner-dev-commits-src-main@freebsd.org Fri Jan 22 00:10:33 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C0B244E4D56; Fri, 22 Jan 2021 00:10:33 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMKQx543zz3QBs; Fri, 22 Jan 2021 00:10:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0A421539F; Fri, 22 Jan 2021 00:10:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10M0AX02033942; Fri, 22 Jan 2021 00:10:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10M0AXDQ033941; Fri, 22 Jan 2021 00:10:33 GMT (envelope-from git) Date: Fri, 22 Jan 2021 00:10:33 GMT Message-Id: <202101220010.10M0AXDQ033941@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: a53ce3fc4938 - main - Bump CURRENT to 14.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a53ce3fc4938e37d5ec89304846203d2083c61a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 00:10:33 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=a53ce3fc4938e37d5ec89304846203d2083c61a2 commit a53ce3fc4938e37d5ec89304846203d2083c61a2 Author: Glen Barber AuthorDate: 2021-01-22 00:10:07 +0000 Commit: Glen Barber CommitDate: 2021-01-22 00:10:07 +0000 Bump CURRENT to 14.0 This one goes to 14. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- Makefile.inc1 | 4 +- RELNOTES | 295 +------------------------------ UPDATING | 2 +- lib/clang/freebsd_cc_version.h | 2 +- lib/clang/include/lld/Common/Version.inc | 2 +- lib/clang/llvm.build.mk | 2 +- share/mk/bsd.compat.mk | 8 +- sys/conf/newvers.sh | 4 +- sys/sys/param.h | 2 +- 9 files changed, 14 insertions(+), 307 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index d9ef01eefde5..251993ef8b71 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -137,9 +137,9 @@ TARGET_ABI= gnueabi .endif .endif MACHINE_ABI?= unknown -MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd13.0 +MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd14.0 TARGET_ABI?= unknown -TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0 +TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd14.0 KNOWN_ARCHES?= aarch64/arm64 \ amd64 \ armv6/arm \ diff --git a/RELNOTES b/RELNOTES index 136a6123ee72..a4f276592a73 100644 --- a/RELNOTES +++ b/RELNOTES @@ -1,4 +1,4 @@ -Release notes for FreeBSD 13.0. +Release notes for FreeBSD 14.0. This file describes new user-visible features, changes and updates relevant to users of binary FreeBSD releases. Each entry should describe the change in no @@ -10,296 +10,3 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. -074a91f746bd: - The aesni(4) and armv8crypto(4) devices are now included in - GENERIC on amd64, i386, and arm64. - -2e1c94aa1fd5: - Add support for enforcing W^X mapping policy for user - processes. The policy is not enforced by default but can be - enabled by setting the kern.elf32.allow_wx and - kern.elf64.allow_wx sysctls to 0. Individual binaries can be - exempted from the policy by elfctl(1) via the wxneeded - feature. - -4979620ece98: - Add AES-XTS support to armv8crypto(4) providing accelerated - software support for the default GELI cipher on arm64 systems. - -r368667: - GDB 6.1.1 was removed. Users of crashinfo(8) should install the - gdb package or devel/gdb port. - -r368559: - The hme(4) driver was removed. - -r367660: - Fixes the case where gssd will not startup because /usr is a separate - local file system that is not yet mounted. It does not fix the case - where /usr is a separately mounted remote file system (such as NFS). - This latter case can be fixed by adding mountcritremote to the - REQUIRED line. Unfortunately doing so implies that all Kerberized - NFS mounts in /etc/fstab will need the "late" mount option. - This was not done, since the requirement for "late" would introduce - a POLA violation. - -r367423: - This commit added a new startup scripts variable called - nfsv4_server_only which uses the -R option on mountd added by r367026. - When nfsv4_server_only is set to "YES" in /etc/rc.conf, the NFS server - only handles NFSv4 and does not register with rpcbind. As such, rpcbind - does not need to be running. Useful for sites which consider rpcbind a - security issue. - -r366267: - Kernel option ACPI_DMAR was renamed to IOMMU. amd64's IOMMU subsystem - was split out from amd64 DMAR support and is now generic, i.e., it can - be used by all architectures. - -r364896: - A series of commits ending with r364896 added NFS over TLS - to the kernel. This is believed to be compatible with - the Internet Draft titled "Towards Remote Procedure Call Encryption - By Default" (expected to soon become an RFC). - The mount_nfs(8) and exports(5) man pages describe the mount and - export option(s) related to NFS over TLS. - For NFS over TLS to work, the rpctlscd(8) { client } or rpctlssd(8) - { server } must be running on a kernel built with "options KERN_TLS" - on an architecture where PMAP_HAS_DMAP != 0. - -r364725: - Changes to one obscure devd event generated on resume need to - be documented. The old form will still be generated in 13, but not - in 14. - -r363679: - Applications using regex(3), e.g. sed/grep, will no longer accept - redundant escapes for most ordinary characters. - -r363253: - SCTP support has been removed from GENERIC kernel configurations. - The SCTP stack is now built as sctp.ko and can be dynamically loaded. - -r363233: - Merge sendmail 8.16.1: See contrib/sendmail/RELEASE_NOTES for details. - -r363180: - The safexcel(4) crypto offload driver has been added. - -r363084: - nc(1) now implements SCTP mode, enabled by specifying the --sctp option. - -r362681: - A new implementation of bc and dc has been imported. It offers - better standards compliance, performance, localization and comes - with extensive test cases that are optionally installed. - Use WITHOUT_GH_BC=yes to build and install the world with the - previous version instead of the new one, if required. - -r362158, r362163: - struct export_args has changed so that the "user" specified for - the -maproot and -mapall exports(5) options may be in more than - 16 groups. - -r361884: - sed(1) has learned about hex escapes (e.g. \x27) and will now do the - right thing with them, removing the need for printf magic or obnoxious - escaping in many scenarios. - -r361238, r361798, r361799: - ZFS will now unconditionally reject read(2) of a directory with EISDIR. - Additionally, read(2) of a directory is now rejected with EISDIR by - default and may be re-enabled for non-ZFS filesystems that allow it with - the sysctl(8) MIB 'security.bsd.allow_read_dir'. - - Aliases for grep to default to '-d skip' may be desired if commonly - non-recursively grepping a list that includes directories and the - possibility of EISDIR errors in stderr is not tolerable. Example - aliases, commented out, have been installed in /root/.cshrc and - /root/.shrc. - -r361066: - Add exec.prepare and exec.release hooks for jail(8) and jail.conf(5). - exec.prepare runs before mounts, so can be used to populate new jails. - exec.release runs after unmounts, so can be used to remove ephemeral - jails. - -r360920,r360923,r360924,r360927,r360928,r360931,r360933,r360936: - Remove support for ARC4, Blowfish, Cast, DES, Triple DES, MD5, - MD5-KPDK, MD5-HMAC, SHA1-KPDK, and Skipjack algorithms from - the kernel open cryptographic framework (OCF). - -r360562: - Remove support for ARC4, Blowfish, Cast, DES, Triple DES, - MD5-HMAC, and Skipjack algorithms from /dev/crypto. - -r360557: - Remove support for DES, Triple DES, Blowfish, Cast, and - Camellia ciphers from IPsec(4). Remove support for MD5-HMAC, - Keyed MD5, Keyed SHA1, and RIPEMD160-HMAC from IPsec(4). - -r359945: - Remove support for Triple DES, Blowfish, and MD5 HMAC from - geli(4). - -r359786-r359787: - Remove support for DES, Triple DES, and RC4 from in-kernel GSS - authentication. - -r357627: - remove elf2aout. - -r357560-r357565: - init(8), service(8), and cron(8) will now adopt user/class environment - variables (excluding PATH, by default, which will be overwritten) by - default. Notably, environment variables for all cron jobs and rc - services can now be set via login.conf(5). - -r357455: - sparc64 has been removed from FreeBSD. - -r355677: - Adds support for NFSv4.2 (RFC-7862) and Extended Attributes - (RFC-8276) to the NFS client and server. - NFSv4.2 is comprised of several optional features that can be supported - in addition to NFSv4.1. This patch adds the following optional features: - - posix_fadvise(POSIX_FADV_WILLNEED/POSIX_FADV_DONTNEED) - - posix_fallocate() - - intra server file range copying via the copy_file_range(2) syscall - --> Avoiding data tranfer over the wire to/from the NFS client. - - lseek(SEEK_DATA/SEEK_HOLE) - - Extended attribute syscalls for "user" namespace attributes as defined - by RFC-8276. - - For the client, NFSv4.2 is only used if the mount command line option - minorversion=2 is specified. - For the server, two new sysctls called vfs.nfsd.server_min_minorversion4 - and vfs.nfsd.server_max_minorversion4 have been added that allow - sysadmins to limit the minor versions of NFSv4 supported by the nfsd - server. - Setting vfs.nfsd.server_max_minorversion4 to 0 or 1 will disable NFSv4.2 - on the server. - -r356263: - armv5 support has been removed from FreeBSD. - -r354517: - iwm(4) now supports most Intel 9260, 9460 and 9560 Wi-Fi devices. - -r354269: - sqlite3 is updated to sqlite3-3.30.1. - -r352668: - cron(8) now supports the -n (suppress mail on succesful run) and -q - (suppress logging of command execution) options in the crontab format. - See the crontab(5) manpage for details. - -r352304: - ntpd is no longer by default locked in memory. rlimit memlock 32 - or rlimit memlock 0 can be used to restore this behaviour. - -r351863: - rc.subr(8) now honors ${name}_env in all rc(8) scripts. Previously, - environment variables set by a user via ${name}_env were ignored - if the service defined a custom *_cmd variable to control the behavior - of the run_rc_command function, e.g., start_cmd, instead of relying on - the variables like command and command_args, - -r351770,r352920,r352922,r352923: - dd(1) now supports conv=fsync, conv=fdatasync, oflag=fsync, oflag=sync, - and iflag=fullblock flags, compatible with illumos and GNU. - -r351522: - Add kernel-side support for in-kernel Transport Layer Security - (KTLS). KTLS permits using sendfile(2) over sockets using - TLS. - -r351397: - WPA is updated from 2.8 to 2.9. - -r351361: - Add probes for lockmgr(9) to the lockstat DTrace provider, add - corresponding lockstat(1) events, and document the new probes in - dtrace_lockstat.4. - -r351356: - Intel RST is a new 'feature' that remaps NVMe devices from - their normal location to part of the AHCI bar space. This - will eliminate the need to set the BIOS SATA setting from RST - to AHCI causing the nvme drive to be erased before FreeBSD - will see the nvme drive. FreeBSD will now be able to see the - nvme drive now in the default config. - -r351201, r351372: - Add a vop_stdioctl() call, so that file systems that do not support - holes will have a trivial implementation of lseek(SEEK_DATA/SEEK_HOLE). - The algorithm appears to be compatible with the POSIX draft and - the implementation in Linux for the case of a file system that - does not support holes. Prior to this patch, lseek(2) would reply - -1 with errno set to ENOTTY for SEEK_DATA/SEEK_HOLE on files in - file systems that do not support holes. - r351372 maps ENOTTY to EINVAL for lseek(SEEK_DATA/SEEK_HOLE) for - any other cases, such as a ENOTTY return from vn_bmap_seekhole(). - -r350665: - The fuse driver has been renamed to fusefs(5) and been substantially - rewritten. The new driver includes many bug fixes and performance - enhancements, as well as the following user-visible features: - * Optional kernel-side permissions checks (-o default_permissions) - * mknod(2), socket(2), and pipe(2) support - * server side locking with fcntl(2) - * FUSE operations are now interruptible when mounted with -o intr - * server side handling of UTIME_NOW during utimensat(2) - * mount options may be updated with "mount -u" - * fusefs file system may now be exported over NFS - * RLIMIT_FSIZE support - * support for fuse file systems using protocols as old as 7.4 - - FUSE file system developers should also take note of the following new - features: - * The protocol level has been raised from 7.8 to 7.23 - * kqueue support on /dev/fuse - * server-initiated cache invalidation via FUSE_NOTIFY_REPLY - -r350471: - gnop(8) can now configure a delay to be applied to read and write - request delays. See the -d, -q and -x parameters. - -r350315, r350316: - Adds a Linux compatible copy_file_range(2) syscall. - -r350307: - libcap_random(3) has been removed. Applications can use native - APIs to get random data in capability mode. - -r349529,r349530: - Add support for using unmapped mbufs with sendfile(2). - -r349352: - nand(4) and related components have been removed. - -r349349: - The UEFI loader now supports HTTP boot. - -r349335: - bhyve(8) now implements a High Definition Audio (HDA) driver, allowing - guests to play to and record audio data from the host. - -r349286: - swapon(8) can now erase a swap device immediately before enabling it, - similar to newfs(8)'s -E option. This behaviour can be specified by - adding -E to swapon(8)'s command-line parameters, or by adding the - "trimonce" option to a swap device's /etc/fstab entry. - -r347908-r347923: - The following network drivers have been removed: bm(4), cs(4), de(4), - ed(4), ep(4), ex(4), fe(4), pcn(4), sf(4), sn(4), tl(4), tx(4), txp(4), - vx(4), wb(4), xe(4). - -r347532: - Wired page accounting has been split into kernel wirings and user - wirings (e.g., by mlock(2)). Kernel wirings no long count towards - the global limit, which is renamed to vm.max_user_wired. bhyve -S - allocates user-wired memory and is now subject to that limit. - -$FreeBSD$ diff --git a/UPDATING b/UPDATING index cbb9000b17db..f3d70c3c1c2e 100644 --- a/UPDATING +++ b/UPDATING @@ -11,7 +11,7 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. -NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: +NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: FreeBSD 13.x has many debugging features turned on, in both the kernel and userland. These features attempt to detect incorrect use of system primitives, and encourage loud failure through extra sanity diff --git a/lib/clang/freebsd_cc_version.h b/lib/clang/freebsd_cc_version.h index 54e8d6780158..ee830cb584a0 100644 --- a/lib/clang/freebsd_cc_version.h +++ b/lib/clang/freebsd_cc_version.h @@ -1,3 +1,3 @@ /* $FreeBSD$ */ -#define FREEBSD_CC_VERSION 1300007 +#define FREEBSD_CC_VERSION 1400000 diff --git a/lib/clang/include/lld/Common/Version.inc b/lib/clang/include/lld/Common/Version.inc index 336fc0fdb136..4aef2b1a92c3 100644 --- a/lib/clang/include/lld/Common/Version.inc +++ b/lib/clang/include/lld/Common/Version.inc @@ -1,3 +1,3 @@ // $FreeBSD$ -#define LLD_VERSION_STRING "11.0.1" +#define LLD_VERSION_STRING "14.0.0" diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index ef271e85bf3f..b248fb816364 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -40,7 +40,7 @@ TARGET_ABI= -gnueabi TARGET_ABI= .endif VENDOR= unknown -OS_VERSION= freebsd13.0 +OS_VERSION= freebsd14.0 LLVM_TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI} LLVM_BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-${OS_VERSION} diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk index d7d63bfe55db..e063415bcbfc 100644 --- a/share/mk/bsd.compat.mk +++ b/share/mk/bsd.compat.mk @@ -30,7 +30,7 @@ LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} .endif .if ${COMPAT_COMPILER_TYPE} == gcc .else -LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0 +LIB32CPUFLAGS+= -target x86_64-unknown-freebsd14.0 .endif LIB32CPUFLAGS+= -m32 LIB32_MACHINE= i386 @@ -51,7 +51,7 @@ LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} .if ${COMPAT_COMPILER_TYPE} == "gcc" LIB32CPUFLAGS+= -m32 .else -LIB32CPUFLAGS+= -target powerpc-unknown-freebsd13.0 +LIB32CPUFLAGS+= -target powerpc-unknown-freebsd14.0 .endif LIB32_MACHINE= powerpc @@ -69,9 +69,9 @@ LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} .endif .else .if ${COMPAT_ARCH:Mmips64el*} != "" -LIB32CPUFLAGS= -target mipsel-unknown-freebsd13.0 +LIB32CPUFLAGS= -target mipsel-unknown-freebsd14.0 .else -LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 +LIB32CPUFLAGS= -target mips-unknown-freebsd14.0 .endif .endif LIB32CPUFLAGS+= -mabi=32 diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 7d2ac14223b6..6482417b3ebe 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -53,8 +53,8 @@ # TYPE="FreeBSD" -REVISION="13.0" -BRANCH="ALPHA1" +REVISION="14.0" +BRANCH="CURRENT" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi diff --git a/sys/sys/param.h b/sys/sys/param.h index e6765e62a75b..19d6d3fb2d35 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300136 /* Master, propagated to newvers */ +#define __FreeBSD_version 1400000 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-main@freebsd.org Fri Jan 22 00:46:21 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7A09F4E59DA; Fri, 22 Jan 2021 00:46:21 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DMLDF2jB6z3j5d; Fri, 22 Jan 2021 00:46:21 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-ot1-x335.google.com with SMTP id i30so3553384ota.6; Thu, 21 Jan 2021 16:46:21 -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=1Tbk7t7CasMLums2lpuGEJTrKgI1laQi84W/x3O9r6A=; b=kOr1eOSztXRxnv97k/gjbbPzQRVEZk05uTGr4J9M+dgM1lIcOjJagpl93H37orczw+ 5J/+iLfSdC0O9qZY5llpvUQjMxIfUJB4YWQ3WfO3iGxWTO/1mkMp05XM7sHaUEHduKSr xj5GuZzsrmNQnOqf2gP21AdT2I3zW5yZb2Keoo1KoePMJGLlP2RJU8Th7uKwRzIb99mx 6hjOxp49xuJGrDFCqs310HLoF2HNz44D3mHP+OdPMyGxt9WtSyr471kZbNL2/F0ju9z6 MafFYW+V60uGJQqcEo2rQ18M6aJIOcbBYxYFb/tLtpX5mQo+iTTDrdgtyILtGLXHxlF7 xg4g== 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=1Tbk7t7CasMLums2lpuGEJTrKgI1laQi84W/x3O9r6A=; b=EWczKnhQ0I4EEW2jmWH4S32Qi63Mx4JIBQFROVksmjRXSDnTCky3GQmR3wsvk2O9re rk9WCSo+h+hA9xYdcKGpWCg8OA8uNc45/8of9XxD7pR6Y5I7eNdE301Yka6XCIiTSzNp AqXYZBC6bmLc+tMl6Y1j2/3TqsKrn4sNZhdoa/8NK1e+Z3nosSD2sY8oxg3YqSSCiUmx aoSMeXCt3hptp1S52xW/LQh7CpLnj7HQ/IY16ZCYqaGD66ufrvayAgCl8EGRTEiMj2dd RmwK01SZJqtW5cZE4HcA4mqTN5HBjDfDZhMjiANtdI8xzBMBstt9dbH85Oa68voeAvRx J4Iw== X-Gm-Message-State: AOAM531U/zsLxeobWD8tbwxezO06lcS6pmD7m1TnAI7StvpvZ1j8mNbi CjVbdCEiXkWRSKBMcnKInFClPVvSY5CsxoVKli7S2b8j X-Google-Smtp-Source: ABdhPJzVysTVG8sCXHhfQQ9PjEmZe9WEVLzm1yPGz+89hsv868eK5eT44KgKHHrjYY3njqGjvh53r62fB4TSAlhcY5I= X-Received: by 2002:a05:6830:2385:: with SMTP id l5mr1450989ots.370.1611276379827; Thu, 21 Jan 2021 16:46:19 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a4a:a187:0:0:0:0:0 with HTTP; Thu, 21 Jan 2021 16:46:19 -0800 (PST) In-Reply-To: <202101220010.10M0AXDQ033941@gitrepo.freebsd.org> References: <202101220010.10M0AXDQ033941@gitrepo.freebsd.org> From: Oliver Pinter Date: Fri, 22 Jan 2021 01:46:19 +0100 Message-ID: Subject: Re: git: a53ce3fc4938 - main - Bump CURRENT to 14.0 To: Glen Barber Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4DMLDF2jB6z3j5d X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 00:46:21 -0000 On Friday, January 22, 2021, Glen Barber wrote: > The branch main has been updated by gjb: > > URL: https://cgit.FreeBSD.org/src/commit/?id= > a53ce3fc4938e37d5ec89304846203d2083c61a2 > > commit a53ce3fc4938e37d5ec89304846203d2083c61a2 > Author: Glen Barber > AuthorDate: 2021-01-22 00:10:07 +0000 > Commit: Glen Barber > CommitDate: 2021-01-22 00:10:07 +0000 > > Bump CURRENT to 14.0 > > This one goes to 14. > > Approved by: re (implicit) > Sponsored by: Rubicon Communications, LLC ("Netgate") > --- > Makefile.inc1 | 4 +- > RELNOTES | 295 > +------------------------------ > UPDATING | 2 +- > lib/clang/freebsd_cc_version.h | 2 +- > lib/clang/include/lld/Common/Version.inc | 2 +- > lib/clang/llvm.build.mk | 2 +- > share/mk/bsd.compat.mk | 8 +- > sys/conf/newvers.sh | 4 +- > sys/sys/param.h | 2 +- > 9 files changed, 14 insertions(+), 307 deletions(-) > > diff --git a/Makefile.inc1 b/Makefile.inc1 > index d9ef01eefde5..251993ef8b71 100644 > --- a/Makefile.inc1 > +++ b/Makefile.inc1 > @@ -137,9 +137,9 @@ TARGET_ABI= gnueabi > .endif > .endif > MACHINE_ABI?= unknown > -MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$/ > /:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd13.0 > +MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$/ > /:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd14.0 > TARGET_ABI?= unknown > -TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/: > C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0 > +TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/: > C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd14.0 > KNOWN_ARCHES?= aarch64/arm64 \ > amd64 \ > armv6/arm \ > diff --git a/RELNOTES b/RELNOTES > index 136a6123ee72..a4f276592a73 100644 > --- a/RELNOTES > +++ b/RELNOTES > @@ -1,4 +1,4 @@ > -Release notes for FreeBSD 13.0. > +Release notes for FreeBSD 14.0. > > This file describes new user-visible features, changes and updates > relevant to > users of binary FreeBSD releases. Each entry should describe the change > in no > @@ -10,296 +10,3 @@ newline. Entries should be separated by a newline. > > Changes to this file should not be MFCed. > > -074a91f746bd: > - The aesni(4) and armv8crypto(4) devices are now included in > - GENERIC on amd64, i386, and arm64. > - > -2e1c94aa1fd5: > - Add support for enforcing W^X mapping policy for user > - processes. The policy is not enforced by default but can be > - enabled by setting the kern.elf32.allow_wx and > - kern.elf64.allow_wx sysctls to 0. Individual binaries can be > - exempted from the policy by elfctl(1) via the wxneeded > - feature. > - > -4979620ece98: > - Add AES-XTS support to armv8crypto(4) providing accelerated > - software support for the default GELI cipher on arm64 systems. > - > -r368667: > - GDB 6.1.1 was removed. Users of crashinfo(8) should install the > - gdb package or devel/gdb port. > - > -r368559: > - The hme(4) driver was removed. > - > -r367660: > - Fixes the case where gssd will not startup because /usr is a > separate > - local file system that is not yet mounted. It does not fix the > case > - where /usr is a separately mounted remote file system (such as > NFS). > - This latter case can be fixed by adding mountcritremote to the > - REQUIRED line. Unfortunately doing so implies that all Kerberized > - NFS mounts in /etc/fstab will need the "late" mount option. > - This was not done, since the requirement for "late" would introduce > - a POLA violation. > - > -r367423: > - This commit added a new startup scripts variable called > - nfsv4_server_only which uses the -R option on mountd added by > r367026. > - When nfsv4_server_only is set to "YES" in /etc/rc.conf, the NFS > server > - only handles NFSv4 and does not register with rpcbind. As such, > rpcbind > - does not need to be running. Useful for sites which consider > rpcbind a > - security issue. > - > -r366267: > - Kernel option ACPI_DMAR was renamed to IOMMU. amd64's IOMMU > subsystem > - was split out from amd64 DMAR support and is now generic, i.e., > it can > - be used by all architectures. > - > -r364896: > - A series of commits ending with r364896 added NFS over TLS > - to the kernel. This is believed to be compatible with > - the Internet Draft titled "Towards Remote Procedure Call Encryption > - By Default" (expected to soon become an RFC). > - The mount_nfs(8) and exports(5) man pages describe the mount and > - export option(s) related to NFS over TLS. > - For NFS over TLS to work, the rpctlscd(8) { client } or rpctlssd(8) > - { server } must be running on a kernel built with "options > KERN_TLS" > - on an architecture where PMAP_HAS_DMAP != 0. > - > -r364725: > - Changes to one obscure devd event generated on resume need to > - be documented. The old form will still be generated in 13, but not > - in 14. > - > -r363679: > - Applications using regex(3), e.g. sed/grep, will no longer accept > - redundant escapes for most ordinary characters. > - > -r363253: > - SCTP support has been removed from GENERIC kernel configurations. > - The SCTP stack is now built as sctp.ko and can be dynamically > loaded. > - > -r363233: > - Merge sendmail 8.16.1: See contrib/sendmail/RELEASE_NOTES for > details. > - > -r363180: > - The safexcel(4) crypto offload driver has been added. > - > -r363084: > - nc(1) now implements SCTP mode, enabled by specifying the --sctp > option. > - > -r362681: > - A new implementation of bc and dc has been imported. It offers > - better standards compliance, performance, localization and comes > - with extensive test cases that are optionally installed. > - Use WITHOUT_GH_BC=yes to build and install the world with the > - previous version instead of the new one, if required. > - > -r362158, r362163: > - struct export_args has changed so that the "user" specified for > - the -maproot and -mapall exports(5) options may be in more than > - 16 groups. > - > -r361884: > - sed(1) has learned about hex escapes (e.g. \x27) and will now do > the > - right thing with them, removing the need for printf magic or > obnoxious > - escaping in many scenarios. > - > -r361238, r361798, r361799: > - ZFS will now unconditionally reject read(2) of a directory with > EISDIR. > - Additionally, read(2) of a directory is now rejected with EISDIR by > - default and may be re-enabled for non-ZFS filesystems that allow > it with > - the sysctl(8) MIB 'security.bsd.allow_read_dir'. > - > - Aliases for grep to default to '-d skip' may be desired if commonly > - non-recursively grepping a list that includes directories and the > - possibility of EISDIR errors in stderr is not tolerable. Example > - aliases, commented out, have been installed in /root/.cshrc and > - /root/.shrc. > - > -r361066: > - Add exec.prepare and exec.release hooks for jail(8) and > jail.conf(5). > - exec.prepare runs before mounts, so can be used to populate new > jails. > - exec.release runs after unmounts, so can be used to remove > ephemeral > - jails. > - > -r360920,r360923,r360924,r360927,r360928,r360931,r360933,r360936: > - Remove support for ARC4, Blowfish, Cast, DES, Triple DES, MD5, > - MD5-KPDK, MD5-HMAC, SHA1-KPDK, and Skipjack algorithms from > - the kernel open cryptographic framework (OCF). > - > -r360562: > - Remove support for ARC4, Blowfish, Cast, DES, Triple DES, > - MD5-HMAC, and Skipjack algorithms from /dev/crypto. > - > -r360557: > - Remove support for DES, Triple DES, Blowfish, Cast, and > - Camellia ciphers from IPsec(4). Remove support for MD5-HMAC, > - Keyed MD5, Keyed SHA1, and RIPEMD160-HMAC from IPsec(4). > - > -r359945: > - Remove support for Triple DES, Blowfish, and MD5 HMAC from > - geli(4). > - > -r359786-r359787: > - Remove support for DES, Triple DES, and RC4 from in-kernel GSS > - authentication. > - > -r357627: > - remove elf2aout. > - > -r357560-r357565: > - init(8), service(8), and cron(8) will now adopt user/class > environment > - variables (excluding PATH, by default, which will be overwritten) > by > - default. Notably, environment variables for all cron jobs and rc > - services can now be set via login.conf(5). > - > -r357455: > - sparc64 has been removed from FreeBSD. > - > -r355677: > - Adds support for NFSv4.2 (RFC-7862) and Extended Attributes > - (RFC-8276) to the NFS client and server. > - NFSv4.2 is comprised of several optional features that can be > supported > - in addition to NFSv4.1. This patch adds the following optional > features: > - - posix_fadvise(POSIX_FADV_WILLNEED/POSIX_FADV_DONTNEED) > - - posix_fallocate() > - - intra server file range copying via the copy_file_range(2) > syscall > - --> Avoiding data tranfer over the wire to/from the NFS client. > - - lseek(SEEK_DATA/SEEK_HOLE) > - - Extended attribute syscalls for "user" namespace attributes as > defined > - by RFC-8276. > - > - For the client, NFSv4.2 is only used if the mount command line > option > - minorversion=2 is specified. > - For the server, two new sysctls called vfs.nfsd.server_min_ > minorversion4 > - and vfs.nfsd.server_max_minorversion4 have been added that allow > - sysadmins to limit the minor versions of NFSv4 supported by the > nfsd > - server. > - Setting vfs.nfsd.server_max_minorversion4 to 0 or 1 will disable > NFSv4.2 > - on the server. > - > -r356263: > - armv5 support has been removed from FreeBSD. > - > -r354517: > - iwm(4) now supports most Intel 9260, 9460 and 9560 Wi-Fi devices. > - > -r354269: > - sqlite3 is updated to sqlite3-3.30.1. > - > -r352668: > - cron(8) now supports the -n (suppress mail on succesful run) and -q > - (suppress logging of command execution) options in the crontab > format. > - See the crontab(5) manpage for details. > - > -r352304: > - ntpd is no longer by default locked in memory. rlimit memlock 32 > - or rlimit memlock 0 can be used to restore this behaviour. > - > -r351863: > - rc.subr(8) now honors ${name}_env in all rc(8) scripts. > Previously, > - environment variables set by a user via ${name}_env were ignored > - if the service defined a custom *_cmd variable to control the > behavior > - of the run_rc_command function, e.g., start_cmd, instead of > relying on > - the variables like command and command_args, > - > -r351770,r352920,r352922,r352923: > - dd(1) now supports conv=fsync, conv=fdatasync, oflag=fsync, > oflag=sync, > - and iflag=fullblock flags, compatible with illumos and GNU. > - > -r351522: > - Add kernel-side support for in-kernel Transport Layer Security > - (KTLS). KTLS permits using sendfile(2) over sockets using > - TLS. > - > -r351397: > - WPA is updated from 2.8 to 2.9. > - > -r351361: > - Add probes for lockmgr(9) to the lockstat DTrace provider, add > - corresponding lockstat(1) events, and document the new probes in > - dtrace_lockstat.4. > - > -r351356: > - Intel RST is a new 'feature' that remaps NVMe devices from > - their normal location to part of the AHCI bar space. This > - will eliminate the need to set the BIOS SATA setting from RST > - to AHCI causing the nvme drive to be erased before FreeBSD > - will see the nvme drive. FreeBSD will now be able to see the > - nvme drive now in the default config. > - > -r351201, r351372: > - Add a vop_stdioctl() call, so that file systems that do not support > - holes will have a trivial implementation of > lseek(SEEK_DATA/SEEK_HOLE). > - The algorithm appears to be compatible with the POSIX draft and > - the implementation in Linux for the case of a file system that > - does not support holes. Prior to this patch, lseek(2) would reply > - -1 with errno set to ENOTTY for SEEK_DATA/SEEK_HOLE on files in > - file systems that do not support holes. > - r351372 maps ENOTTY to EINVAL for lseek(SEEK_DATA/SEEK_HOLE) for > - any other cases, such as a ENOTTY return from vn_bmap_seekhole(). > - > -r350665: > - The fuse driver has been renamed to fusefs(5) and been > substantially > - rewritten. The new driver includes many bug fixes and performance > - enhancements, as well as the following user-visible features: > - * Optional kernel-side permissions checks (-o default_permissions) > - * mknod(2), socket(2), and pipe(2) support > - * server side locking with fcntl(2) > - * FUSE operations are now interruptible when mounted with -o intr > - * server side handling of UTIME_NOW during utimensat(2) > - * mount options may be updated with "mount -u" > - * fusefs file system may now be exported over NFS > - * RLIMIT_FSIZE support > - * support for fuse file systems using protocols as old as 7.4 > - > - FUSE file system developers should also take note of the following > new > - features: > - * The protocol level has been raised from 7.8 to 7.23 > - * kqueue support on /dev/fuse > - * server-initiated cache invalidation via FUSE_NOTIFY_REPLY > - > -r350471: > - gnop(8) can now configure a delay to be applied to read and write > - request delays. See the -d, -q and -x parameters. > - > -r350315, r350316: > - Adds a Linux compatible copy_file_range(2) syscall. > - > -r350307: > - libcap_random(3) has been removed. Applications can use native > - APIs to get random data in capability mode. > - > -r349529,r349530: > - Add support for using unmapped mbufs with sendfile(2). > - > -r349352: > - nand(4) and related components have been removed. > - > -r349349: > - The UEFI loader now supports HTTP boot. > - > -r349335: > - bhyve(8) now implements a High Definition Audio (HDA) driver, > allowing > - guests to play to and record audio data from the host. > - > -r349286: > - swapon(8) can now erase a swap device immediately before enabling > it, > - similar to newfs(8)'s -E option. This behaviour can be specified > by > - adding -E to swapon(8)'s command-line parameters, or by adding the > - "trimonce" option to a swap device's /etc/fstab entry. > - > -r347908-r347923: > - The following network drivers have been removed: bm(4), cs(4), > de(4), > - ed(4), ep(4), ex(4), fe(4), pcn(4), sf(4), sn(4), tl(4), tx(4), > txp(4), > - vx(4), wb(4), xe(4). > - > -r347532: > - Wired page accounting has been split into kernel wirings and user > - wirings (e.g., by mlock(2)). Kernel wirings no long count towards > - the global limit, which is renamed to vm.max_user_wired. bhyve -S > - allocates user-wired memory and is now subject to that limit. > - > -$FreeBSD$ > diff --git a/UPDATING b/UPDATING > index cbb9000b17db..f3d70c3c1c2e 100644 > --- a/UPDATING > +++ b/UPDATING > @@ -11,7 +11,7 @@ handbook: > Items affecting the ports and packages system can be found in > /usr/ports/UPDATING. Please read that file before running portupgrade. > > -NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: > +NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: > FreeBSD 13.x has many debugging features turned on, in both the > kernel > and userland. These features attempt to detect incorrect use of > system primitives, and encourage loud failure through extra sanity > diff --git a/lib/clang/freebsd_cc_version.h b/lib/clang/freebsd_cc_ > version.h > index 54e8d6780158..ee830cb584a0 100644 > --- a/lib/clang/freebsd_cc_version.h > +++ b/lib/clang/freebsd_cc_version.h > @@ -1,3 +1,3 @@ > /* $FreeBSD$ */ > > -#define FREEBSD_CC_VERSION 1300007 > +#define FREEBSD_CC_VERSION 1400000 > diff --git a/lib/clang/include/lld/Common/Version.inc > b/lib/clang/include/lld/Common/Version.inc > index 336fc0fdb136..4aef2b1a92c3 100644 > --- a/lib/clang/include/lld/Common/Version.inc > +++ b/lib/clang/include/lld/Common/Version.inc > @@ -1,3 +1,3 @@ > // $FreeBSD$ > > -#define LLD_VERSION_STRING "11.0.1" > +#define LLD_VERSION_STRING "14.0.0" Seems like this part of the change is incorrect. This represents the LLVM version and not the OS version. > diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk > index ef271e85bf3f..b248fb816364 100644 > --- a/lib/clang/llvm.build.mk > +++ b/lib/clang/llvm.build.mk > @@ -40,7 +40,7 @@ TARGET_ABI= -gnueabi > TARGET_ABI= > .endif > VENDOR= unknown > -OS_VERSION= freebsd13.0 > +OS_VERSION= freebsd14.0 > > LLVM_TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/: > C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI} > LLVM_BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/: > C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-${OS_VERSION} > diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk > index d7d63bfe55db..e063415bcbfc 100644 > --- a/share/mk/bsd.compat.mk > +++ b/share/mk/bsd.compat.mk > @@ -30,7 +30,7 @@ LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} > .endif > .if ${COMPAT_COMPILER_TYPE} == gcc > .else > -LIB32CPUFLAGS+= -target x86_64-unknown-freebsd13.0 > +LIB32CPUFLAGS+= -target x86_64-unknown-freebsd14.0 > .endif > LIB32CPUFLAGS+= -m32 > LIB32_MACHINE= i386 > @@ -51,7 +51,7 @@ LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} > .if ${COMPAT_COMPILER_TYPE} == "gcc" > LIB32CPUFLAGS+= -m32 > .else > -LIB32CPUFLAGS+= -target powerpc-unknown-freebsd13.0 > +LIB32CPUFLAGS+= -target powerpc-unknown-freebsd14.0 > .endif > > LIB32_MACHINE= powerpc > @@ -69,9 +69,9 @@ LIB32CPUFLAGS= -march=${COMPAT_CPUTYPE} > .endif > .else > .if ${COMPAT_ARCH:Mmips64el*} != "" > -LIB32CPUFLAGS= -target mipsel-unknown-freebsd13.0 > +LIB32CPUFLAGS= -target mipsel-unknown-freebsd14.0 > .else > -LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 > +LIB32CPUFLAGS= -target mips-unknown-freebsd14.0 > .endif > .endif > LIB32CPUFLAGS+= -mabi=32 > diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh > index 7d2ac14223b6..6482417b3ebe 100644 > --- a/sys/conf/newvers.sh > +++ b/sys/conf/newvers.sh > @@ -53,8 +53,8 @@ > # > > TYPE="FreeBSD" > -REVISION="13.0" > -BRANCH="ALPHA1" > +REVISION="14.0" > +BRANCH="CURRENT" > if [ -n "${BRANCH_OVERRIDE}" ]; then > BRANCH=${BRANCH_OVERRIDE} > fi > diff --git a/sys/sys/param.h b/sys/sys/param.h > index e6765e62a75b..19d6d3fb2d35 100644 > --- a/sys/sys/param.h > +++ b/sys/sys/param.h > @@ -60,7 +60,7 @@ > * in the range 5 to 9. > */ > #undef __FreeBSD_version > -#define __FreeBSD_version 1300136 /* Master, propagated to newvers */ > +#define __FreeBSD_version 1400000 /* Master, propagated to newvers */ > > /* > * __FreeBSD_kernel__ indicates that this system uses the kernel of > FreeBSD, > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all- > unsubscribe@freebsd.org" > From owner-dev-commits-src-main@freebsd.org Fri Jan 22 00:50:02 2021 Return-Path: Delivered-To: dev-commits-src-main@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 11B144E5E35; Fri, 22 Jan 2021 00:50:02 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMLJT74wGz3j4C; Fri, 22 Jan 2021 00:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1C6715D88; Fri, 22 Jan 2021 00:50:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10M0o1qY079831; Fri, 22 Jan 2021 00:50:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10M0o1Uo079828; Fri, 22 Jan 2021 00:50:01 GMT (envelope-from git) Date: Fri, 22 Jan 2021 00:50:01 GMT Message-Id: <202101220050.10M0o1Uo079828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: f9a66922c9ec - main - fix incorrect LLD_VERSION_STRING from previous commit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9a66922c9ec6a82b72a62f5d1c93be1be91865a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 00:50:02 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=f9a66922c9ec6a82b72a62f5d1c93be1be91865a commit f9a66922c9ec6a82b72a62f5d1c93be1be91865a Author: Glen Barber AuthorDate: 2021-01-22 00:49:30 +0000 Commit: Glen Barber CommitDate: 2021-01-22 00:49:30 +0000 fix incorrect LLD_VERSION_STRING from previous commit Reported by: Oliver Pinter Sponsored by: Rubicon Communications, LLC ("Netgate") --- lib/clang/include/lld/Common/Version.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clang/include/lld/Common/Version.inc b/lib/clang/include/lld/Common/Version.inc index 4aef2b1a92c3..336fc0fdb136 100644 --- a/lib/clang/include/lld/Common/Version.inc +++ b/lib/clang/include/lld/Common/Version.inc @@ -1,3 +1,3 @@ // $FreeBSD$ -#define LLD_VERSION_STRING "14.0.0" +#define LLD_VERSION_STRING "11.0.1" From owner-dev-commits-src-main@freebsd.org Fri Jan 22 00:50:40 2021 Return-Path: Delivered-To: dev-commits-src-main@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 86FCA4E603F; Fri, 22 Jan 2021 00:50:40 +0000 (UTC) (envelope-from gjb@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMLKD3CQZz3j4t; Fri, 22 Jan 2021 00:50:40 +0000 (UTC) (envelope-from gjb@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1611276640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oh4X/SCERxdrW6i3yWC1D7bqzTSr77K094ZbDtyaf80=; b=IFt5zeU9pq6Sc7qh9ObDWeqceiT61B83OE/ERTyPJD+eqa1WnmmmCUprVYQhKlatOX2VJY SjaFOc2beDncEQa1YGAoLVnAg1Lshk8x1jmdi+vG9l08OGC91YSHfi9ge80dkwB+vjVbd7 deAwof84wxFDS1DDewBRkK5Kp8BvD4Fvpg93XWNceVwdMjJ3tTZn0BUoNMx7XzMAGr8IJ7 /RhLmNCzJwSxkfflOXsumuTYZhhotHVsK03ROimGC5U9lv7QYie+arQCemesi2rZaGMMhv ySTsI8GJkbYIgmqw8yIJ3xOqt4RID7vFclxfjPECJitbvu/yG30pA+EJuHNRxQ== Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 02F12475D; Fri, 22 Jan 2021 00:50:39 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Fri, 22 Jan 2021 00:50:37 +0000 From: Glen Barber To: Oliver Pinter Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: a53ce3fc4938 - main - Bump CURRENT to 14.0 Message-ID: <20210122005037.GS77557@FreeBSD.org> References: <202101220010.10M0AXDQ033941@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cmVHo2jXx4bdYlgS" Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1611276640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oh4X/SCERxdrW6i3yWC1D7bqzTSr77K094ZbDtyaf80=; b=Vyp4c0mLd+M7uyPoYvzyUUojxL3BgMcVSAv6A+HNLa7rCK33a9ea43P9MvdOmzCyCX9h+G cC2WHIDromt5fKIX2naCms1hF+bOlr9aY422KRWmdiAmbE7ny+L9sytRqPqQS8b3kMRLiF h6Zq5Dgn4k1aI/vSD4zLGcufmMmf3QAjDeL8dq8beWjoeWKMjK1dvzMEqNPh/f0wx8fqVE MatIC9ElTEWW7g6KqnsJZNXN2a7NbSyIFb/qEFjnj9aRP+n+mS2JyY2tPZyU39sXIUfrDV eKR1ff6c4tDBdd00nldhQkW+fHdFU+KNdJ0NUqg+yIAGyATWu2QGiQB2uSC4OQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1611276640; a=rsa-sha256; cv=none; b=xVuG7Q2JSTdS/1NZv/YrSMNBERrIRJWELTmg3SYilTXXnE6pISb3lP8yzcbrlrQ2bXeFDf 8QjNRm9KrXSqvDi/ZJ2PPJYJsogj3FLhEgAxP728V8GU0kmW1K6ND4b9Kw3cdpC5XpCYPs xg2xpPlYwG9zq+T/ff2SDM5VN8zOBmGGnmdQm9vsABlsDNZgOHvbNhoWAvpILHc29FFNqc 23JiOjuT5z7Qe9e8EcwYRb6AEd6g9z6PoRsykILAcmDcSoEHUGYkZT5Q8QqbdXKbZkFV+X RkSHON8saSTOvNDmeIPx5vL43zC+/hVEuOzDNPtiQeF87s6EPeN5OKX3olnR8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 00:50:40 -0000 --cmVHo2jXx4bdYlgS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 22, 2021 at 01:46:19AM +0100, Oliver Pinter wrote: > On Friday, January 22, 2021, Glen Barber wrote: > > diff --git a/lib/clang/include/lld/Common/Version.inc > > b/lib/clang/include/lld/Common/Version.inc > > index 336fc0fdb136..4aef2b1a92c3 100644 > > --- a/lib/clang/include/lld/Common/Version.inc > > +++ b/lib/clang/include/lld/Common/Version.inc > > @@ -1,3 +1,3 @@ > > // $FreeBSD$ > > > > -#define LLD_VERSION_STRING "11.0.1" > > +#define LLD_VERSION_STRING "14.0.0" >=20 >=20 > Seems like this part of the change is incorrect. This represents the LLVM > version and not the OS version. >=20 Fixed. Thank you for noticing. Glen --cmVHo2jXx4bdYlgS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAmAKIVgACgkQAxRYpUeP 4pPC+A/9FgA5pTIpHwnIhgPjSLSWkzS/3wd0QuGWENtZsy7I6M/qESh9rzoRd85E +0tJAkTdOHXf9UDBX5/eJitcr45+JKO6ft1eBzlKfmVCraCzKCnRW4cGNguwWpCe pzsX6Y7JSn1dv/TqQX/y8AVSAaKQCMy5Z5zlKj+i0WNf7or6T1IohBcMZv98Tfuq D60UG/SDJ6+B4cqXjfLa/DBSIJaQkzvw38BqT7usitGeAkFztY4kTpg0rqEKQJX/ Ixt/3y5bWKd2cbOQRvUopItcOBLtfMqQ00qvGOUb+dMuvc4A4UWGZ9MteXUaJvUN aMJd9sgRNU1M3rbZjySlxeBPymrl+gE7brigowkCpwMBmMkpr8F/kScQnZGGeE+L v8MpntZLfkLycbt1bum8OIKFrKHiAq+kxu+coClgxkO1ZKZvlKrryepjsYZ71ySv 6/BedFgqbBCboMVdBMJr+Bo8os0Kti6wrKAMjkDagKV8OJ45zBM/WYpA50XrI9Rn dRiwxC2uSleZd3tuxD0v9kEpO3ucJd9SqS+qEbhZ2yiqJC8b8N8uGGou4yMWRqKn EiJiJXOlDoKYw0FRoWbyyxaVFmYZJFm3RzOHBspBWAoxSPsicjw5cUU/Hs46sbwv SEXGdNIYK0KPwFqNts9r3GTzcMiqpgf/tzTIVWqXyli35Q5ahQw= =eeXq -----END PGP SIGNATURE----- --cmVHo2jXx4bdYlgS-- From owner-dev-commits-src-main@freebsd.org Fri Jan 22 05:45:21 2021 Return-Path: Delivered-To: dev-commits-src-main@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 64D2C4EAA54; Fri, 22 Jan 2021 05:45:21 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMSsF2NP8z4R83; Fri, 22 Jan 2021 05:45:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4044C1945B; Fri, 22 Jan 2021 05:45:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10M5jLjK070274; Fri, 22 Jan 2021 05:45:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10M5jLcZ070273; Fri, 22 Jan 2021 05:45:21 GMT (envelope-from git) Date: Fri, 22 Jan 2021 05:45:21 GMT Message-Id: <202101220545.10M5jLcZ070273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Oleksandr Tymoshenko Subject: git: ed9b7f441466 - main - armv8crypto: add AES-GCM support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gonzo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed9b7f4414663703e0e9581a730c4bdfaca5687f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 05:45:21 -0000 The branch main has been updated by gonzo: URL: https://cgit.FreeBSD.org/src/commit/?id=ed9b7f4414663703e0e9581a730c4bdfaca5687f commit ed9b7f4414663703e0e9581a730c4bdfaca5687f Author: Oleksandr Tymoshenko AuthorDate: 2021-01-13 06:27:10 +0000 Commit: Oleksandr Tymoshenko CommitDate: 2021-01-22 05:41:27 +0000 armv8crypto: add AES-GCM support Add support for AES-GCM using OpenSSL's accelerated routines. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D27454 Sponsored by: Ampere Computing Submitted by: Klara, Inc. --- sys/conf/files.arm64 | 10 ++ sys/crypto/armv8/armv8_crypto.c | 232 +++++++++++++++++++++++++++-------- sys/crypto/armv8/armv8_crypto.h | 51 ++++++-- sys/crypto/armv8/armv8_crypto_wrap.c | 208 +++++++++++++++++++++++++++++-- sys/modules/armv8crypto/Makefile | 19 ++- 5 files changed, 445 insertions(+), 75 deletions(-) diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index fb001f95a672..f7003b1048c8 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -279,6 +279,16 @@ armv8_crypto_wrap.o optional armv8crypto \ compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ ${WERROR} ${NO_WCAST_QUAL} ${PROF} -march=armv8-a+crypto ${.IMPSRC}" \ no-implicit-rule \ clean "armv8_crypto_wrap.o" +aesv8-armx.o optional armv8crypto \ + dependency "$S/crypto/openssl/aarch64/aesv8-armx.S" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ -I$S/crypto/openssl/crypto ${WERROR} ${NO_WCAST_QUAL} ${PROF} -march=armv8-a+crypto ${.IMPSRC}" \ + no-implicit-rule \ + clean "aesv8-armx.o" +ghashv8-armx.o optional armv8crypto \ + dependency "$S/crypto/openssl/aarch64/ghashv8-armx.S" \ + compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ -I$S/crypto/openssl/crypto ${WERROR} ${NO_WCAST_QUAL} ${PROF} -march=armv8-a+crypto ${.IMPSRC}" \ + no-implicit-rule \ + clean "ghashv8-armx.o" crypto/des/des_enc.c optional netsmb crypto/openssl/ossl_aarch64.c optional ossl crypto/openssl/aarch64/sha1-armv8.S optional ossl \ diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c index f296337e6f33..be39168d50f3 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -2,6 +2,7 @@ * Copyright (c) 2005-2008 Pawel Jakub Dawidek * Copyright (c) 2010 Konstantin Belousov * Copyright (c) 2014,2016 The FreeBSD Foundation + * Copyright (c) 2020 Ampere Computing * All rights reserved. * * Portions of this software were developed by John-Mark Gurney @@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -66,6 +68,7 @@ struct armv8_crypto_softc { int dieing; int32_t cid; struct rwlock lock; + bool has_pmul; }; static struct mtx *ctx_mtx; @@ -109,16 +112,20 @@ armv8_crypto_probe(device_t dev) switch (ID_AA64ISAR0_AES_VAL(reg)) { case ID_AA64ISAR0_AES_BASE: + ret = 0; + device_set_desc(dev, "AES-CBC,AES-XTS"); + break; case ID_AA64ISAR0_AES_PMULL: ret = 0; + device_set_desc(dev, "AES-CBC,AES-XTS,AES-GCM"); + break; + default: break; case ID_AA64ISAR0_AES_NONE: device_printf(dev, "CPU lacks AES instructions"); break; } - device_set_desc_copy(dev, "AES-CBC,AES-XTS"); - /* TODO: Check more fields as we support more features */ return (ret); @@ -128,11 +135,17 @@ static int armv8_crypto_attach(device_t dev) { struct armv8_crypto_softc *sc; + uint64_t reg; int i; sc = device_get_softc(dev); sc->dieing = 0; + reg = READ_SPECIALREG(id_aa64isar0_el1); + + if (ID_AA64ISAR0_AES_VAL(reg) == ID_AA64ISAR0_AES_PMULL) + sc->has_pmul = true; + sc->cid = crypto_get_driverid(dev, sizeof(struct armv8_crypto_session), CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | CRYPTOCAP_F_ACCEL_SOFTWARE); if (sc->cid < 0) { @@ -185,14 +198,43 @@ armv8_crypto_detach(device_t dev) return (0); } +#define SUPPORTED_SES (CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD) + static int armv8_crypto_probesession(device_t dev, const struct crypto_session_params *csp) { + struct armv8_crypto_softc *sc; + + sc = device_get_softc(dev); - if (csp->csp_flags != 0) + if ((csp->csp_flags & ~(SUPPORTED_SES)) != 0) return (EINVAL); + switch (csp->csp_mode) { + case CSP_MODE_AEAD: + switch (csp->csp_cipher_alg) { + case CRYPTO_AES_NIST_GCM_16: + if (!sc->has_pmul) + return (EINVAL); + if (csp->csp_ivlen != AES_GCM_IV_LEN) + return (EINVAL); + if (csp->csp_auth_mlen != 0 && + csp->csp_auth_mlen != GMAC_DIGEST_LEN) + return (EINVAL); + switch (csp->csp_cipher_klen * 8) { + case 128: + case 192: + case 256: + break; + default: + return (EINVAL); + } + break; + default: + return (EINVAL); + } + break; case CSP_MODE_CIPHER: switch (csp->csp_cipher_alg) { case CRYPTO_AES_CBC: @@ -228,40 +270,55 @@ armv8_crypto_probesession(device_t dev, return (CRYPTODEV_PROBE_ACCEL_SOFTWARE); } -static void +static int armv8_crypto_cipher_setup(struct armv8_crypto_session *ses, const struct crypto_session_params *csp, const uint8_t *key, int keylen) { - int i; + __uint128_val_t H; + struct fpu_kern_ctx *ctx; + int kt, i; if (csp->csp_cipher_alg == CRYPTO_AES_XTS) keylen /= 2; switch (keylen * 8) { case 128: - ses->rounds = AES128_ROUNDS; - break; case 192: - ses->rounds = AES192_ROUNDS; - break; case 256: - ses->rounds = AES256_ROUNDS; break; default: - panic("invalid AES key length"); + return (EINVAL); } - rijndaelKeySetupEnc(ses->enc_schedule, key, keylen * 8); - rijndaelKeySetupDec(ses->dec_schedule, key, keylen * 8); - if (csp->csp_cipher_alg == CRYPTO_AES_XTS) - rijndaelKeySetupEnc(ses->xts_schedule, key + keylen, keylen * 8); + kt = is_fpu_kern_thread(0); + if (!kt) { + AQUIRE_CTX(i, ctx); + fpu_kern_enter(curthread, ctx, + FPU_KERN_NORMAL | FPU_KERN_KTHR); + } + + aes_v8_set_encrypt_key(key, + keylen * 8, &ses->enc_schedule); + + if ((csp->csp_cipher_alg == CRYPTO_AES_XTS) || + (csp->csp_cipher_alg == CRYPTO_AES_CBC)) + aes_v8_set_decrypt_key(key, + keylen * 8, &ses->dec_schedule); + + if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) { + memset(H.c, 0, sizeof(H.c)); + aes_v8_encrypt(H.c, H.c, &ses->enc_schedule); + H.u[0] = bswap64(H.u[0]); + H.u[1] = bswap64(H.u[1]); + gcm_init_v8(ses->Htable, H.u); + } - for (i = 0; i < nitems(ses->enc_schedule); i++) { - ses->enc_schedule[i] = bswap32(ses->enc_schedule[i]); - ses->dec_schedule[i] = bswap32(ses->dec_schedule[i]); - if (csp->csp_cipher_alg == CRYPTO_AES_XTS) - ses->xts_schedule[i] = bswap32(ses->xts_schedule[i]); + if (!kt) { + fpu_kern_leave(curthread, ctx); + RELEASE_CTX(i, ctx); } + + return (0); } static int @@ -270,6 +327,7 @@ armv8_crypto_newsession(device_t dev, crypto_session_t cses, { struct armv8_crypto_softc *sc; struct armv8_crypto_session *ses; + int error; sc = device_get_softc(dev); rw_wlock(&sc->lock); @@ -279,40 +337,29 @@ armv8_crypto_newsession(device_t dev, crypto_session_t cses, } ses = crypto_get_driver_session(cses); - armv8_crypto_cipher_setup(ses, csp, csp->csp_cipher_key, + error = armv8_crypto_cipher_setup(ses, csp, csp->csp_cipher_key, csp->csp_cipher_klen); rw_wunlock(&sc->lock); - return (0); + return (error); } static int armv8_crypto_process(device_t dev, struct cryptop *crp, int hint __unused) { struct armv8_crypto_session *ses; - int error; - - /* We can only handle full blocks for now */ - if ((crp->crp_payload_length % AES_BLOCK_LEN) != 0) { - error = EINVAL; - goto out; - } ses = crypto_get_driver_session(crp->crp_session); - error = armv8_crypto_cipher_process(ses, crp); - -out: - crp->crp_etype = error; + crp->crp_etype = armv8_crypto_cipher_process(ses, crp); crypto_done(crp); return (0); } static uint8_t * -armv8_crypto_cipher_alloc(struct cryptop *crp, int *allocated) +armv8_crypto_cipher_alloc(struct cryptop *crp, int start, int length, int *allocated) { uint8_t *addr; - addr = crypto_contiguous_subsegment(crp, crp->crp_payload_start, - crp->crp_payload_length); + addr = crypto_contiguous_subsegment(crp, start, length); if (addr != NULL) { *allocated = 0; return (addr); @@ -320,8 +367,7 @@ armv8_crypto_cipher_alloc(struct cryptop *crp, int *allocated) addr = malloc(crp->crp_payload_length, M_ARMV8_CRYPTO, M_NOWAIT); if (addr != NULL) { *allocated = 1; - crypto_copydata(crp, crp->crp_payload_start, - crp->crp_payload_length, addr); + crypto_copydata(crp, start, length, addr); } else *allocated = 0; return (addr); @@ -333,19 +379,63 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, { const struct crypto_session_params *csp; struct fpu_kern_ctx *ctx; - uint8_t *buf; - uint8_t iv[AES_BLOCK_LEN]; - int allocated, i; + uint8_t *buf, *authbuf, *outbuf; + uint8_t iv[AES_BLOCK_LEN], tag[GMAC_DIGEST_LEN]; + int allocated, authallocated, outallocated, i; int encflag; int kt; + int error; + bool outcopy; csp = crypto_get_params(crp->crp_session); encflag = CRYPTO_OP_IS_ENCRYPT(crp->crp_op); - buf = armv8_crypto_cipher_alloc(crp, &allocated); + allocated = 0; + outallocated = 0; + authallocated = 0; + authbuf = NULL; + kt = 1; + + buf = armv8_crypto_cipher_alloc(crp, crp->crp_payload_start, + crp->crp_payload_length, &allocated); if (buf == NULL) return (ENOMEM); + if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) { + if (crp->crp_aad != NULL) + authbuf = crp->crp_aad; + else + authbuf = armv8_crypto_cipher_alloc(crp, crp->crp_aad_start, + crp->crp_aad_length, &authallocated); + if (authbuf == NULL) { + error = ENOMEM; + goto out; + } + } + + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + outbuf = crypto_buffer_contiguous_subsegment(&crp->crp_obuf, + crp->crp_payload_output_start, crp->crp_payload_length); + if (outbuf == NULL) { + outcopy = true; + if (allocated) + outbuf = buf; + else { + outbuf = malloc(crp->crp_payload_length, + M_ARMV8_CRYPTO, M_NOWAIT); + if (outbuf == NULL) { + error = ENOMEM; + goto out; + } + outallocated = true; + } + } else + outcopy = false; + } else { + outbuf = buf; + outcopy = allocated; + } + kt = is_fpu_kern_thread(0); if (!kt) { AQUIRE_CTX(i, ctx); @@ -363,36 +453,74 @@ armv8_crypto_cipher_process(struct armv8_crypto_session *ses, /* Do work */ switch (csp->csp_cipher_alg) { case CRYPTO_AES_CBC: + if ((crp->crp_payload_length % AES_BLOCK_LEN) != 0) { + error = EINVAL; + goto out; + } if (encflag) - armv8_aes_encrypt_cbc(ses->rounds, ses->enc_schedule, + armv8_aes_encrypt_cbc(&ses->enc_schedule, crp->crp_payload_length, buf, buf, iv); else - armv8_aes_decrypt_cbc(ses->rounds, ses->dec_schedule, + armv8_aes_decrypt_cbc(&ses->dec_schedule, crp->crp_payload_length, buf, iv); break; case CRYPTO_AES_XTS: if (encflag) - armv8_aes_encrypt_xts(ses->rounds, ses->enc_schedule, - ses->xts_schedule, crp->crp_payload_length, buf, + armv8_aes_encrypt_xts(&ses->enc_schedule, + &ses->xts_schedule.aes_key, crp->crp_payload_length, buf, buf, iv); else - armv8_aes_decrypt_xts(ses->rounds, ses->dec_schedule, - ses->xts_schedule, crp->crp_payload_length, buf, + armv8_aes_decrypt_xts(&ses->dec_schedule, + &ses->xts_schedule.aes_key, crp->crp_payload_length, buf, buf, iv); break; + case CRYPTO_AES_NIST_GCM_16: + if (encflag) { + memset(tag, 0, sizeof(tag)); + armv8_aes_encrypt_gcm(&ses->enc_schedule, + crp->crp_payload_length, + buf, outbuf, + crp->crp_aad_length, authbuf, + tag, iv, ses->Htable); + crypto_copyback(crp, crp->crp_digest_start, sizeof(tag), + tag); + } else { + crypto_copydata(crp, crp->crp_digest_start, sizeof(tag), + tag); + if (armv8_aes_decrypt_gcm(&ses->enc_schedule, + crp->crp_payload_length, + buf, outbuf, + crp->crp_aad_length, authbuf, + tag, iv, ses->Htable) != 0) { + error = EBADMSG; + goto out; + } + } + break; } - if (allocated) - crypto_copyback(crp, crp->crp_payload_start, - crp->crp_payload_length, buf); + if (outcopy) + crypto_copyback(crp, CRYPTO_HAS_OUTPUT_BUFFER(crp) ? + crp->crp_payload_output_start : crp->crp_payload_start, + crp->crp_payload_length, outbuf); + error = 0; +out: if (!kt) { fpu_kern_leave(curthread, ctx); RELEASE_CTX(i, ctx); } + if (allocated) zfree(buf, M_ARMV8_CRYPTO); - return (0); + if (authallocated) + zfree(authbuf, M_ARMV8_CRYPTO); + if (outallocated) + zfree(outbuf, M_ARMV8_CRYPTO); + explicit_bzero(iv, sizeof(iv)); + explicit_bzero(tag, sizeof(tag)); + + return (error); } static device_method_t armv8_crypto_methods[] = { diff --git a/sys/crypto/armv8/armv8_crypto.h b/sys/crypto/armv8/armv8_crypto.h index 2d0be163b072..0e4cd91e7062 100644 --- a/sys/crypto/armv8/armv8_crypto.h +++ b/sys/crypto/armv8/armv8_crypto.h @@ -32,27 +32,56 @@ #ifndef _ARMV8_CRYPTO_H_ #define _ARMV8_CRYPTO_H_ -#define AES128_ROUNDS 10 -#define AES192_ROUNDS 12 #define AES256_ROUNDS 14 #define AES_SCHED_LEN ((AES256_ROUNDS + 1) * AES_BLOCK_LEN) +typedef struct { + uint32_t aes_key[AES_SCHED_LEN/4]; + int aes_rounds; +} AES_key_t; + +typedef union { + uint64_t u[2]; + uint32_t d[4]; + uint8_t c[16]; + size_t t[16 / sizeof(size_t)]; +} __uint128_val_t; + struct armv8_crypto_session { - uint32_t enc_schedule[AES_SCHED_LEN/4]; - uint32_t dec_schedule[AES_SCHED_LEN/4]; - uint32_t xts_schedule[AES_SCHED_LEN/4]; - int algo; - int rounds; + AES_key_t enc_schedule; + AES_key_t dec_schedule; + AES_key_t xts_schedule; + __uint128_val_t Htable[16]; }; -void armv8_aes_encrypt_cbc(int, const void *, size_t, const uint8_t *, +/* Prototypes for aesv8-armx.S */ +void aes_v8_encrypt(uint8_t *in, uint8_t *out, const AES_key_t *key); +int aes_v8_set_encrypt_key(const unsigned char *userKey, const int bits, const AES_key_t *key); +int aes_v8_set_decrypt_key(const unsigned char *userKey, const int bits, const AES_key_t *key); + +/* Prototypes for ghashv8-armx.S */ +void gcm_init_v8(__uint128_val_t Htable[16], const uint64_t Xi[2]); +void gcm_gmult_v8(uint64_t Xi[2], const __uint128_val_t Htable[16]); +void gcm_ghash_v8(uint64_t Xi[2], const __uint128_val_t Htable[16], const uint8_t *inp, size_t len); + +void armv8_aes_encrypt_cbc(const AES_key_t *, size_t, const uint8_t *, uint8_t *, const uint8_t[static AES_BLOCK_LEN]); -void armv8_aes_decrypt_cbc(int, const void *, size_t, uint8_t *, +void armv8_aes_decrypt_cbc(const AES_key_t *, size_t, uint8_t *, const uint8_t[static AES_BLOCK_LEN]); +void armv8_aes_encrypt_gcm(AES_key_t *, size_t, const uint8_t *, + uint8_t *, size_t, const uint8_t*, + uint8_t tag[static GMAC_DIGEST_LEN], + const uint8_t[static AES_BLOCK_LEN], + const __uint128_val_t *); +int armv8_aes_decrypt_gcm(AES_key_t *, size_t, const uint8_t *, + uint8_t *, size_t, const uint8_t*, + const uint8_t tag[static GMAC_DIGEST_LEN], + const uint8_t[static AES_BLOCK_LEN], + const __uint128_val_t *); -void armv8_aes_encrypt_xts(int, const void *, const void *, size_t, +void armv8_aes_encrypt_xts(AES_key_t *, const void *, size_t, const uint8_t *, uint8_t *, const uint8_t[AES_BLOCK_LEN]); -void armv8_aes_decrypt_xts(int, const void *, const void *, size_t, +void armv8_aes_decrypt_xts(AES_key_t *, const void *, size_t, const uint8_t *, uint8_t *, const uint8_t[AES_BLOCK_LEN]); #endif /* _ARMV8_CRYPTO_H_ */ diff --git a/sys/crypto/armv8/armv8_crypto_wrap.c b/sys/crypto/armv8/armv8_crypto_wrap.c index 83af3fad40ef..ea93f1b9a176 100644 --- a/sys/crypto/armv8/armv8_crypto_wrap.c +++ b/sys/crypto/armv8/armv8_crypto_wrap.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2016 The FreeBSD Foundation + * Copyright (c) 2020 Ampere Computing * All rights reserved. * * This software was developed by Andrew Turner under @@ -41,6 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include @@ -90,7 +93,7 @@ armv8_aes_dec(int rounds, const uint8x16_t *keysched, const uint8x16_t from) } void -armv8_aes_encrypt_cbc(int rounds, const void *key_schedule, size_t len, +armv8_aes_encrypt_cbc(const AES_key_t *key, size_t len, const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]) { uint8x16_t tot, ivreg, tmp; @@ -100,8 +103,8 @@ armv8_aes_encrypt_cbc(int rounds, const void *key_schedule, size_t len, ivreg = vld1q_u8(iv); for (i = 0; i < len; i++) { tmp = vld1q_u8(from); - tot = armv8_aes_enc(rounds - 1, key_schedule, - veorq_u8(tmp, ivreg)); + tot = armv8_aes_enc(key->aes_rounds - 1, + (const void*)key->aes_key, veorq_u8(tmp, ivreg)); ivreg = tot; vst1q_u8(to, tot); from += AES_BLOCK_LEN; @@ -110,7 +113,7 @@ armv8_aes_encrypt_cbc(int rounds, const void *key_schedule, size_t len, } void -armv8_aes_decrypt_cbc(int rounds, const void *key_schedule, size_t len, +armv8_aes_decrypt_cbc(const AES_key_t *key, size_t len, uint8_t *buf, const uint8_t iv[static AES_BLOCK_LEN]) { uint8x16_t ivreg, nextiv, tmp; @@ -120,7 +123,8 @@ armv8_aes_decrypt_cbc(int rounds, const void *key_schedule, size_t len, ivreg = vld1q_u8(iv); for (i = 0; i < len; i++) { nextiv = vld1q_u8(buf); - tmp = armv8_aes_dec(rounds - 1, key_schedule, nextiv); + tmp = armv8_aes_dec(key->aes_rounds - 1, + (const void*)key->aes_key, nextiv); vst1q_u8(buf, veorq_u8(tmp, ivreg)); ivreg = nextiv; buf += AES_BLOCK_LEN; @@ -200,21 +204,203 @@ armv8_aes_crypt_xts(int rounds, const uint8x16_t *data_schedule, } void -armv8_aes_encrypt_xts(int rounds, const void *data_schedule, +armv8_aes_encrypt_xts(AES_key_t *data_schedule, const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]) { - armv8_aes_crypt_xts(rounds, data_schedule, tweak_schedule, len, from, to, - iv, 1); + armv8_aes_crypt_xts(data_schedule->aes_rounds, + (const void *)&data_schedule->aes_key, tweak_schedule, len, from, + to, iv, 1); } void -armv8_aes_decrypt_xts(int rounds, const void *data_schedule, +armv8_aes_decrypt_xts(AES_key_t *data_schedule, const void *tweak_schedule, size_t len, const uint8_t *from, uint8_t *to, const uint8_t iv[static AES_BLOCK_LEN]) { - armv8_aes_crypt_xts(rounds, data_schedule, tweak_schedule, len, from, to, - iv, 0); + armv8_aes_crypt_xts(data_schedule->aes_rounds, + (const void *)&data_schedule->aes_key, tweak_schedule, len, from, + to,iv, 0); + +} + +#define AES_INC_COUNTER(counter) \ + do { \ + for (int pos = AES_BLOCK_LEN - 1; \ + pos >= 0; pos--) \ + if (++(counter)[pos]) \ + break; \ + } while (0) + +void +armv8_aes_encrypt_gcm(AES_key_t *aes_key, size_t len, + const uint8_t *from, uint8_t *to, + size_t authdatalen, const uint8_t *authdata, + uint8_t tag[static GMAC_DIGEST_LEN], + const uint8_t iv[static AES_GCM_IV_LEN], + const __uint128_val_t *Htable) +{ + size_t i; + const uint64_t *from64; + uint64_t *to64; + uint8_t aes_counter[AES_BLOCK_LEN]; + uint8_t block[AES_BLOCK_LEN]; + size_t trailer; + __uint128_val_t EK0, EKi, Xi, lenblock; + + bzero(&aes_counter, AES_BLOCK_LEN); + memcpy(aes_counter, iv, AES_GCM_IV_LEN); + + /* Setup the counter */ + aes_counter[AES_BLOCK_LEN - 1] = 1; + + /* EK0 for a final GMAC round */ + aes_v8_encrypt(aes_counter, EK0.c, aes_key); + + /* GCM starts with 2 as counter, 1 is used for final xor of tag. */ + aes_counter[AES_BLOCK_LEN - 1] = 2; + + memset(Xi.c, 0, sizeof(Xi.c)); + memset(block, 0, sizeof(block)); + memcpy(block, authdata, min(authdatalen, sizeof(block))); + gcm_ghash_v8(Xi.u, Htable, block, AES_BLOCK_LEN); + + from64 = (const uint64_t*)from; + to64 = (uint64_t*)to; + trailer = len % AES_BLOCK_LEN; + + for (i = 0; i < (len - trailer); i += AES_BLOCK_LEN) { + aes_v8_encrypt(aes_counter, EKi.c, aes_key); + AES_INC_COUNTER(aes_counter); + to64[0] = from64[0] ^ EKi.u[0]; + to64[1] = from64[1] ^ EKi.u[1]; + gcm_ghash_v8(Xi.u, Htable, (uint8_t*)to64, AES_BLOCK_LEN); + + to64 += 2; + from64 += 2; + } + + to += (len - trailer); + from += (len - trailer); + + if (trailer) { + aes_v8_encrypt(aes_counter, EKi.c, aes_key); + AES_INC_COUNTER(aes_counter); + for (i = 0; i < trailer; i++) { + block[i] = to[i] = from[i] ^ EKi.c[i % AES_BLOCK_LEN]; + } + + for (; i < AES_BLOCK_LEN; i++) + block[i] = 0; + + gcm_ghash_v8(Xi.u, Htable, block, AES_BLOCK_LEN); + } + + /* Lengths block */ + lenblock.u[0] = lenblock.u[1] = 0; + lenblock.d[1] = htobe32(authdatalen * 8); + lenblock.d[3] = htobe32(len * 8); + gcm_ghash_v8(Xi.u, Htable, lenblock.c, AES_BLOCK_LEN); + + Xi.u[0] ^= EK0.u[0]; + Xi.u[1] ^= EK0.u[1]; + memcpy(tag, Xi.c, GMAC_DIGEST_LEN); + + explicit_bzero(aes_counter, sizeof(aes_counter)); + explicit_bzero(Xi.c, sizeof(Xi.c)); + explicit_bzero(EK0.c, sizeof(EK0.c)); + explicit_bzero(EKi.c, sizeof(EKi.c)); + explicit_bzero(lenblock.c, sizeof(lenblock.c)); +} + +int +armv8_aes_decrypt_gcm(AES_key_t *aes_key, size_t len, + const uint8_t *from, uint8_t *to, + size_t authdatalen, const uint8_t *authdata, + const uint8_t tag[static GMAC_DIGEST_LEN], + const uint8_t iv[static AES_GCM_IV_LEN], + const __uint128_val_t *Htable) +{ + size_t i; + const uint64_t *from64; + uint64_t *to64; + uint8_t aes_counter[AES_BLOCK_LEN]; + uint8_t block[AES_BLOCK_LEN]; + size_t trailer; + __uint128_val_t EK0, EKi, Xi, lenblock; + int error; + + error = 0; + bzero(&aes_counter, AES_BLOCK_LEN); + memcpy(aes_counter, iv, AES_GCM_IV_LEN); + + /* Setup the counter */ + aes_counter[AES_BLOCK_LEN - 1] = 1; + + /* EK0 for a final GMAC round */ + aes_v8_encrypt(aes_counter, EK0.c, aes_key); + + memset(Xi.c, 0, sizeof(Xi.c)); + memset(block, 0, sizeof(block)); + memcpy(block, authdata, min(authdatalen, sizeof(block))); + gcm_ghash_v8(Xi.u, Htable, block, AES_BLOCK_LEN); + trailer = len % AES_BLOCK_LEN; + gcm_ghash_v8(Xi.u, Htable, from, len - trailer); + + if (trailer) { + for (i = 0; i < trailer; i++) + block[i] = from[len - trailer + i]; + for (; i < AES_BLOCK_LEN; i++) + block[i] = 0; + gcm_ghash_v8(Xi.u, Htable, block, AES_BLOCK_LEN); + } + + /* Lengths block */ + lenblock.u[0] = lenblock.u[1] = 0; + lenblock.d[1] = htobe32(authdatalen * 8); + lenblock.d[3] = htobe32(len * 8); + gcm_ghash_v8(Xi.u, Htable, lenblock.c, AES_BLOCK_LEN); + + Xi.u[0] ^= EK0.u[0]; + Xi.u[1] ^= EK0.u[1]; + if (timingsafe_bcmp(tag, Xi.c, GMAC_DIGEST_LEN) != 0) { + error = EBADMSG; + goto out; + } + + /* GCM starts with 2 as counter, 1 is used for final xor of tag. */ + aes_counter[AES_BLOCK_LEN - 1] = 2; + + from64 = (const uint64_t*)from; + to64 = (uint64_t*)to; + + for (i = 0; i < (len - trailer); i += AES_BLOCK_LEN) { + aes_v8_encrypt(aes_counter, EKi.c, aes_key); + AES_INC_COUNTER(aes_counter); + to64[0] = from64[0] ^ EKi.u[0]; + to64[1] = from64[1] ^ EKi.u[1]; + to64 += 2; + from64 += 2; + } + + to += (len - trailer); + from += (len - trailer); + + if (trailer) { + aes_v8_encrypt(aes_counter, EKi.c, aes_key); + AES_INC_COUNTER(aes_counter); + for (i = 0; i < trailer; i++) + to[i] = from[i] ^ EKi.c[i % AES_BLOCK_LEN]; + } + +out: + explicit_bzero(aes_counter, sizeof(aes_counter)); + explicit_bzero(Xi.c, sizeof(Xi.c)); + explicit_bzero(EK0.c, sizeof(EK0.c)); + explicit_bzero(EKi.c, sizeof(EKi.c)); + explicit_bzero(lenblock.c, sizeof(lenblock.c)); + + return (error); } diff --git a/sys/modules/armv8crypto/Makefile b/sys/modules/armv8crypto/Makefile index 4b9a84c953d2..bd38fe039fc9 100644 --- a/sys/modules/armv8crypto/Makefile +++ b/sys/modules/armv8crypto/Makefile @@ -1,12 +1,13 @@ # $FreeBSD$ .PATH: ${SRCTOP}/sys/crypto/armv8 +.PATH: ${SRCTOP}/sys/crypto/openssl/aarch64 KMOD= armv8crypto SRCS= armv8_crypto.c SRCS+= device_if.h bus_if.h opt_bus.h cryptodev_if.h -OBJS+= armv8_crypto_wrap.o +OBJS+= armv8_crypto_wrap.o aesv8-armx.o ghashv8-armx.o # Remove -nostdinc so we can get the intrinsics. armv8_crypto_wrap.o: armv8_crypto_wrap.c @@ -16,6 +17,22 @@ armv8_crypto_wrap.o: armv8_crypto_wrap.c -march=armv8-a+crypto ${.IMPSRC} ${CTFCONVERT_CMD} +aesv8-armx.o: aesv8-armx.S + ${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} \ + -I${SRCTOP}/sys/crypto/armv8 \ + -I${SRCTOP}/sys/crypto/openssl/crypto \ + ${WERROR} ${PROF} \ + -march=armv8-a+crypto ${.IMPSRC} + ${CTFCONVERT_CMD} + +ghashv8-armx.o: ghashv8-armx.S + ${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} \ + -I${SRCTOP}/sys/crypto/armv8 \ + -I${SRCTOP}/sys/crypto/openssl/crypto \ + ${WERROR} ${PROF} \ + -march=armv8-a+crypto ${.IMPSRC} + ${CTFCONVERT_CMD} + armv8_crypto_wrap.o: armv8_crypto.h .include From owner-dev-commits-src-main@freebsd.org Fri Jan 22 08:12:36 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BADEB4EDA0A; Fri, 22 Jan 2021 08:12:36 +0000 (UTC) (envelope-from rm@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMX784nqvz4XYr; Fri, 22 Jan 2021 08:12:36 +0000 (UTC) (envelope-from rm@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1611303156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H2Q4ytU2OqaI6D9b6mtn+1sirh5PHcJbnNn5zqHqlPU=; b=SnX03CAtoDRtZ8Sx6EVDwghZRaqMBCE4qzvRzGiEu7FQgyYmL/3wCdaBgE+z56fFFlK4q7 2uhdR8EM34uJVd+o0rgZc0TGgmHDCgJgJjK0dnAivgJSahZ+MKcwyxZNRNeaxEuGEHl2mZ 1kuXElmfW3TD+iyQahwxboYycEGDEV+HedY3b0iEPwFpfMiS2PztKBPtykX35qugIoBpTg Sdhba0up371lXRjbMk/XW+H8Gkk6+Z0QyCSHWpcNRmwRNFfy0iljZQYW9cPqg4+Mt0IsdH 3A0AFxIcnKwb9ptX7eb/znOMuMbXTXdpHUJSCRou0mIDLZ3WV0/kvKvKNCFK9g== Received: from [127.0.0.1] (unknown [127.0.1.132]) by freefall.freebsd.org (Postfix) with ESMTP id E5F3671CD; Fri, 22 Jan 2021 08:12:35 +0000 (UTC) (envelope-from rm@FreeBSD.org) Subject: Re: git: a53ce3fc4938 - main - Bump CURRENT to 14.0 To: Glen Barber , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101220010.10M0AXDQ033941@gitrepo.freebsd.org> From: Ruslan Makhmatkhanov Message-ID: <24c4cf27-bcc5-0208-da7f-e2b6e66c4812@FreeBSD.org> Date: Fri, 22 Jan 2021 11:12:35 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <202101220010.10M0AXDQ033941@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1611303156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H2Q4ytU2OqaI6D9b6mtn+1sirh5PHcJbnNn5zqHqlPU=; b=djrVwDPUuzjSBwSG6AOJbxtFVSP3eJZyDHp+0RL80W7GIttRwdx26AUG5i6coGsxKfYFAk joo6owQv4JLcsgZAdqlDB11GfVmRHnGATbH7wmhW9IMxXUakdszJdgxhQ4FnAJwjgSwGxY DlxEptlRpbUH81OFomQtIqmsEh3hBueqOpiTbxGFc2BkkEfwYPSumpic1e0D9ht9E0YXWe O7LbzYAzWzG/iycDz/WWf6eApQq75A4NIov0lSZgWsToY3XWH9rvWV2AtrOt5YpywkVAwD Ek6Vd7A9lxlsNBWOnbgDwnTzNZqm2ePhiih9afHfO2z/awRbB6WBUoR4VAUDJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1611303156; a=rsa-sha256; cv=none; b=k0ba6qT3gmEBTatCqr53CGD97NCCprCpwUITFxh4uxnRbqFpDk7I4wH4NVCqObAzoSQvWG bxoz7JFOcG5XbXCZdYYKwfvjV1KQUDTaGZa3CqtCmTWOctEHoSvqctfxG/Vc4B8GZm7Rch uMqsS+irRtsl/zOfrWaw8P5KqndqxszaqLmLtMWJXJy5RN8EY5nckJ88HNPa6ggmbDcZ5l 4oeaL8Tzm4YPRbM8KQk9EbsVw5i0NQopXUvLPFDfwadrHTzQkHrBsUt2atOuDVwVHBn1hV wn3fWFI3WOe2WnIJnwkF8V4Jr3Mpc8AViLZ88WY0GK+cTC0Ivd6KvorgRXX62w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 08:12:36 -0000 Glen Barber wrote on 1/22/21 3:10 AM: > The branch main has been updated by gjb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=a53ce3fc4938e37d5ec89304846203d2083c61a2 > > commit a53ce3fc4938e37d5ec89304846203d2083c61a2 > Author: Glen Barber > AuthorDate: 2021-01-22 00:10:07 +0000 > Commit: Glen Barber > CommitDate: 2021-01-22 00:10:07 +0000 > > Bump CURRENT to 14.0 > > This one goes to 14. > [...] > diff --git a/UPDATING b/UPDATING > index cbb9000b17db..f3d70c3c1c2e 100644 > --- a/UPDATING > +++ b/UPDATING > @@ -11,7 +11,7 @@ handbook: > Items affecting the ports and packages system can be found in > /usr/ports/UPDATING. Please read that file before running portupgrade. > > -NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: > +NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: > FreeBSD 13.x has many debugging features turned on, in both the kernel ^^^^^^^^^^^^ one more remnant > and userland. These features attempt to detect incorrect use of > system primitives, and encourage loud failure through extra sanity [...] -- Regards, Ruslan T.O.S. Of Reality From owner-dev-commits-src-main@freebsd.org Fri Jan 22 09:54:42 2021 Return-Path: Delivered-To: dev-commits-src-main@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 817764EF81D; Fri, 22 Jan 2021 09:54:42 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMZNy3DwLz4dZR; Fri, 22 Jan 2021 09:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61F771C93B; Fri, 22 Jan 2021 09:54:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10M9sgKQ097340; Fri, 22 Jan 2021 09:54:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10M9sgDt097339; Fri, 22 Jan 2021 09:54:42 GMT (envelope-from git) Date: Fri, 22 Jan 2021 09:54:42 GMT Message-Id: <202101220954.10M9sgDt097339@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: af3993c9e4d7 - main - Catch up another version bump to 14.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: af3993c9e4d7445caf92b36df2d8bfc6b76d456d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 09:54:42 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=af3993c9e4d7445caf92b36df2d8bfc6b76d456d commit af3993c9e4d7445caf92b36df2d8bfc6b76d456d Author: Li-Wen Hsu AuthorDate: 2021-01-22 09:53:59 +0000 Commit: Li-Wen Hsu CommitDate: 2021-01-22 09:53:59 +0000 Catch up another version bump to 14.0 Reported by: rm --- UPDATING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index f3d70c3c1c2e..b947129ca7a5 100644 --- a/UPDATING +++ b/UPDATING @@ -12,7 +12,7 @@ Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: - FreeBSD 13.x has many debugging features turned on, in both the kernel + FreeBSD 14.x has many debugging features turned on, in both the kernel and userland. These features attempt to detect incorrect use of system primitives, and encourage loud failure through extra sanity checking and fail stop semantics. They also substantially impact From owner-dev-commits-src-main@freebsd.org Fri Jan 22 09:57:16 2021 Return-Path: Delivered-To: dev-commits-src-main@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 582D74EF4E7; Fri, 22 Jan 2021 09:57:16 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DMZRw1p2kz4dN4; Fri, 22 Jan 2021 09:57:16 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x42e.google.com with SMTP id v15so4468182wrx.4; Fri, 22 Jan 2021 01:57: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=9u0P5rlBPVP4gMC6tXPOgJpp2r6QOvX/ktdPHRA/8hI=; b=tkhh0nW9S8tjZyJCbNym+P+mjGzTO5+HSMTO7vPOPvGPIkR/SgnjqDlqGqqBRU2wHt mnD7Ax3fkekw5jjCEM+iB85rJnNwqbTxn0ZE5BQBAtMMw9BxFijiUencU1QOcbcrsfe7 8Teu07e6VIaYssBdV6rXbqrXxS0rflwGW7oGLEJCC/pMldDUWMxgHTZU6Cd7P2092AVu CPlC43bJW6vuGsGEJkRdPLE1cZXi0zUjA7X0ZxeQLlEd3FLrY+xGGCr3PTN93eTRuxvi EVQyoJf4OUVPFaZSBGks61WmlqGd6uRCVnpA0P3ZyPEOqNzfBubuhR5PgT/yGIJZYgoe 25lg== 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=9u0P5rlBPVP4gMC6tXPOgJpp2r6QOvX/ktdPHRA/8hI=; b=kBihXZk0E4Vzp47GyrE08KOjZsoT4jlAJYPiVcciFOf6Db1W5Gk1TCRifX2TqvZ+VZ n0NK4gYKR2vwRhGYqOtXq2OYFgr1ZEYXFrmhK4QTuQZC27YtSGEGyjGq23xUsf5imbMV wTH7tkUeSCSnnFsUK6iEAb1LacIQB9g0rDYb0bZPnRA68gUyZCnoEsVL1o0109OZNX9Z eippSWC4P2HYxpTxSZNjMS2tUpT0h5+Xr8ltZyJ8S4u132gd4TmZ84TsAHXp6J2paBnx xguhBcggGeqlW3DAZuaS7oGJCRhDs6UCV2Ocf8o8COWdNLzxyhq66qcvNEaxgm0teQZC qYxg== X-Gm-Message-State: AOAM533jnouTYs+VOh7QY8cY8vduyqZskS48c3lr/sceigSLwQ+pASVI sycs59rzKmgmVHIzSomy7w9ol6ZPWge9vlj4iM+8jQzTDQQ= X-Google-Smtp-Source: ABdhPJwpPCAZNxF3lIeMBu8iUpnLlRQMA3Nh927TiKtLnYtVLFTbtN/EjFAMLjVy26+6J8Payoy6lUok7xcA2/wP+Es= X-Received: by 2002:a05:6000:186f:: with SMTP id d15mr3667326wri.237.1611309434373; Fri, 22 Jan 2021 01:57:14 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:464c:0:0:0:0:0 with HTTP; Fri, 22 Jan 2021 01:57:12 -0800 (PST) In-Reply-To: References: <202101200949.10K9nmkZ029085@gitrepo.freebsd.org> <49353415-D1B2-43D5-AC39-EF64F03EE512@freebsd.org> From: Mateusz Guzik Date: Fri, 22 Jan 2021 10:57:12 +0100 Message-ID: Subject: Re: git: a9fc14fbf445 - main - newvers.sh: add support for gitup(1) To: Ed Maste Cc: Jessica Clarke , =?UTF-8?Q?Ulrich_Sp=C3=B6rlein?= , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DMZRw1p2kz4dN4 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 09:57:16 -0000 So can someone sort this out? stable/13 just got created and it does not have the branch name. On 1/21/21, Ed Maste wrote: >> > This fixes the problem at hand, > > Thanks for confirming, I've fixed that part now. > >> > but a new regression is shown: >> > >> > $ strings kernel | grep 'FreeBSD 13.0-ALPHA1' >> > FreeBSD 13.0-ALPHA1 #47 c256181-gb06e91d1b700: Thu Jan 21 14:31:35 UTC >> > 2021 >> > >> > branch name is no longer present. >> >> See the commit message, though I'd argue it's not redundant in a lot of >> local development cases (i.e. anything other than main, stable/*, etc), >> and is actually rather useful. > > I agree, and my suggestion is that we restore it unconditionally. I > think it's more confusing without a consistent format / set of > components. > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Fri Jan 22 10:18:47 2021 Return-Path: Delivered-To: dev-commits-src-main@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 19AB94F054F; Fri, 22 Jan 2021 10:18:47 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMZwk71rsz4gH6; Fri, 22 Jan 2021 10:18:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E20E21CBC5; Fri, 22 Jan 2021 10:18:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MAIk2f024355; Fri, 22 Jan 2021 10:18:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MAIkOc024354; Fri, 22 Jan 2021 10:18:46 GMT (envelope-from git) Date: Fri, 22 Jan 2021 10:18:46 GMT Message-Id: <202101221018.10MAIkOc024354@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: bb3b6995c4d0 - main - Revert "[mips] revert r366664 - flip mips back from -O2 to -O" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bb3b6995c4d0ced1a87ec57407f216ece69ab674 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 10:18:47 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=bb3b6995c4d0ced1a87ec57407f216ece69ab674 commit bb3b6995c4d0ced1a87ec57407f216ece69ab674 Author: Mateusz Guzik AuthorDate: 2021-01-22 10:17:34 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-22 10:17:34 +0000 Revert "[mips] revert r366664 - flip mips back from -O2 to -O" This reverts commit bd72252aace382921840ddbceea712b96f4ad242. The commit at hand breaks the build for all mips targets and does not have a one-liner fix. make[5]: "/usr/src/share/mk/sys.mk" line 169: Malformed conditional (${MACHINE_CPUARCH} == "mips" && ${COMPILER_TYPE} == "gcc") --- share/mk/sys.mk | 7 ------- 1 file changed, 7 deletions(-) diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 72f458397683..8f456b28593a 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -166,14 +166,7 @@ CC ?= c89 CFLAGS ?= -O .else CC ?= cc -.if ${MACHINE_CPUARCH} == "mips" && ${COMPILER_TYPE} == "gcc" -# Note: there are currently issues generating code gcc-6.x targeting -# code for at least mips32. The system hits infinite page faults -# when starting /sbin/init if -O2 is used. -CFLAGS ?= -O -pipe -.else CFLAGS ?= -O2 -pipe -.endif .if defined(NO_STRICT_ALIASING) CFLAGS += -fno-strict-aliasing .endif From owner-dev-commits-src-main@freebsd.org Fri Jan 22 10:18:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 DE6814F023E; Fri, 22 Jan 2021 10:18:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMZwj5zBlz4gS8; Fri, 22 Jan 2021 10:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C00531CE81; Fri, 22 Jan 2021 10:18:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MAIjOP024337; Fri, 22 Jan 2021 10:18:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MAIjrh024336; Fri, 22 Jan 2021 10:18:45 GMT (envelope-from git) Date: Fri, 22 Jan 2021 10:18:45 GMT Message-Id: <202101221018.10MAIjrh024336@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 64b1230c03c8 - main - arm64: fix typo in file name in GENERIC-MMCCAM-NODEBUG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 64b1230c03c8dcb6f35041a87bad675062a7f7b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 10:18:45 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=64b1230c03c8dcb6f35041a87bad675062a7f7b2 commit 64b1230c03c8dcb6f35041a87bad675062a7f7b2 Author: Mateusz Guzik AuthorDate: 2021-01-22 10:16:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-22 10:16:57 +0000 arm64: fix typo in file name in GENERIC-MMCCAM-NODEBUG --- sys/arm64/conf/GENERIC-MMCCAM-NODEBUG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/conf/GENERIC-MMCCAM-NODEBUG b/sys/arm64/conf/GENERIC-MMCCAM-NODEBUG index 93360bea9bc0..803b5fd25416 100644 --- a/sys/arm64/conf/GENERIC-MMCCAM-NODEBUG +++ b/sys/arm64/conf/GENERIC-MMCCAM-NODEBUG @@ -7,7 +7,7 @@ # # $FreeBSD$ -include GENERIC-MMCCAP +include GENERIC-MMCCAM include "../../conf/std.nodebug" ident GENERIC-MMCCAM-NODEBUG From owner-dev-commits-src-main@freebsd.org Fri Jan 22 11:54:14 2021 Return-Path: Delivered-To: dev-commits-src-main@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 3E4934F1F1E; Fri, 22 Jan 2021 11:54:14 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMd2t1HMsz4lct; Fri, 22 Jan 2021 11:54:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1ED621DDE4; Fri, 22 Jan 2021 11:54:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MBsEa3053818; Fri, 22 Jan 2021 11:54:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MBsEbq053817; Fri, 22 Jan 2021 11:54:14 GMT (envelope-from git) Date: Fri, 22 Jan 2021 11:54:14 GMT Message-Id: <202101221154.10MBsEbq053817@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lewis Cook Subject: git: e808c8309cc6 - main - Complete Steps 5 and 9 from the Committer's guide MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lcook X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e808c8309cc6ba9c42d68825dc445937a740c9e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 11:54:14 -0000 The branch main has been updated by lcook (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e808c8309cc6ba9c42d68825dc445937a740c9e4 commit e808c8309cc6ba9c42d68825dc445937a740c9e4 Author: Lewis Cook AuthorDate: 2021-01-22 11:22:56 +0000 Commit: Lewis Cook CommitDate: 2021-01-22 11:54:05 +0000 Complete Steps 5 and 9 from the Committer's guide Summary: Steps 5 and 9: - Update Mentor and Mentee Information - Update Ports with Personal Information Reviewers: tcberner, fernape Reviewed By: fernape Subscribers: imp Differential Revision: https://reviews.freebsd.org/D28281 --- share/misc/committers-ports.dot | 4 ++++ usr.bin/calendar/calendars/calendar.freebsd | 1 + 2 files changed, 5 insertions(+) diff --git a/share/misc/committers-ports.dot b/share/misc/committers-ports.dot index aba3225de23c..d23bcff6e8c6 100644 --- a/share/misc/committers-ports.dot +++ b/share/misc/committers-ports.dot @@ -167,6 +167,7 @@ laszlof [label="Frank Laszlo\nlaszlof@FreeBSD.org\n2006/11/07"] lawrance [label="Sam Lawrance\nlawrance@FreeBSD.org\n2005/04/11\n2007/02/21"] lbartoletti [label="Loïc Bartoletti\nlbartoletti@FreeBSD.org\n2020/01/02"] lbr [label="Lars Balker Rasmussen\nlbr@FreeBSD.org\n2006/04/30"] +lcook [label="Lewis Cook\nlcook@FreeBSD.org\n2021/01/21"] leeym [label="Yen-Ming Lee\nleeym@FreeBSD.org\n2002/08/14"] ler [label="Larry Rosenman\nler@FreeBSD.org\n2017/01/09"] leres [label="Craig Leres\nleres@FreeBSD.org\n2017/10/10"] @@ -437,6 +438,8 @@ feld -> junovitch feld -> mmokhi feld -> rezny +fernape -> lcook + fjoe -> danfe fjoe -> flo fjoe -> krion @@ -754,6 +757,7 @@ tcberner -> fernape tcberner -> joneum tcberner -> kai tcberner -> lbartoletti +tcberner -> lcook tcberner -> pkubaj tcberner -> rhurlin tcberner -> rigoletto diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd index df016ec95209..5cbb9dcedec9 100644 --- a/usr.bin/calendar/calendars/calendar.freebsd +++ b/usr.bin/calendar/calendars/calendar.freebsd @@ -36,6 +36,7 @@ 01/19 Ruslan Ermilov born in Simferopol, USSR, 1974 01/19 Marcelo S. Araujo born in Joinville, Santa Catarina, Brazil, 1981 01/20 Poul-Henning Kamp born in Korsoer, Denmark, 1966 +01/21 Lewis Cook born in London, England, 1998 01/21 Mahdi Mokhtari born in Tehran, Iran, 1995 01/21 Mitchell Horne born in Toronto, Ontario, Canada, 1997 01/22 Johann Visagie born in Cape Town, South Africa, 1970 From owner-dev-commits-src-main@freebsd.org Fri Jan 22 13:03:22 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C24A44F4E14; Fri, 22 Jan 2021 13:03:22 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMfZf51gqz4vG4; Fri, 22 Jan 2021 13:03:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F2DD1F0A8; Fri, 22 Jan 2021 13:03:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MD3Map045599; Fri, 22 Jan 2021 13:03:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MD3MRT045598; Fri, 22 Jan 2021 13:03:22 GMT (envelope-from git) Date: Fri, 22 Jan 2021 13:03:22 GMT Message-Id: <202101221303.10MD3MRT045598@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: ace7209ce04d - main - newvers.sh: restore reporting branch names MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ace7209ce04d0e4dc0e84d5e2eb27fc762e67a01 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 13:03:22 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ace7209ce04d0e4dc0e84d5e2eb27fc762e67a01 commit ace7209ce04d0e4dc0e84d5e2eb27fc762e67a01 Author: Mateusz Guzik AuthorDate: 2021-01-22 13:00:24 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-22 13:03:15 +0000 newvers.sh: restore reporting branch names It got removed arguably without much discussion in the commit which added gitup support. --- sys/conf/newvers.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 6482417b3ebe..605e61181dec 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -258,6 +258,10 @@ if [ -n "$git_cmd" ] ; then git="c${git_cnt}-g${git}" fi fi + git_b=$($git_cmd rev-parse --abbrev-ref HEAD) + if [ -n "$git_b" -a "$git_b" != "HEAD" ] ; then + git="${git_b}-${git}" + fi if git_tree_modified; then git="${git}-dirty" modified=yes From owner-dev-commits-src-main@freebsd.org Fri Jan 22 14:21:28 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C2F294F6428; Fri, 22 Jan 2021 14:21:28 +0000 (UTC) (envelope-from gjb@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMhJm54pvz3FjQ; Fri, 22 Jan 2021 14:21:28 +0000 (UTC) (envelope-from gjb@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1611325288; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BV5AGBeRRlLpRHp4kcT9VwANr7DPoKAbhbqvaFcoxEk=; b=BCHZguTzO53wt/pjIMAiZV07OVSR1HZQ0VPoEfhdQ271KJakqfqHjS9rGnrKy74xg1/1Jb b/Z6tz3DlNdERLcImlrfRr+0GYwnsWFqXlClY65kHWFhssZnXvBoNuuM0PqDHQ12PSTBjY 3fllO7g9j8Q4vE+S/8phHYq+XU3gvOS5xYrT2sE3uVypxt+NgxXWIRVT8i0I6D9WL1YSaF D65en7p+NfjneFKaPdC6UXmscnJs7IC73ISknpFXw2XtP8F7yDpXaSa1YtGwOtIJStL8HG V/ThdFYJfjhT8RJubObMxwUOjK7Bv6Nf/Sj40IoaCMtSsS9OXdaMAUMaP/U/bw== Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 389B6D461; Fri, 22 Jan 2021 14:21:28 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Fri, 22 Jan 2021 14:21:26 +0000 From: Glen Barber To: Li-Wen Hsu Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, rm@freebsd.org Subject: Re: git: af3993c9e4d7 - main - Catch up another version bump to 14.0 Message-ID: <20210122142126.GT77557@FreeBSD.org> References: <202101220954.10M9sgDt097339@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3wfpuDtTLg8/Vq6g" Content-Disposition: inline In-Reply-To: <202101220954.10M9sgDt097339@gitrepo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1611325288; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BV5AGBeRRlLpRHp4kcT9VwANr7DPoKAbhbqvaFcoxEk=; b=u79pxHr84yM8tcrHwjLQdYfDtnIzDrk/mDUBIOQUiJ9bR/5stx0nLwYYtR5ukfODkmZVG8 MhV04MNDNkojgQl8xPzjY9mcPov0ifUJf9jjWzVNCpK5J9x5+T5sjD9zZSO3S/1Miq3VbU 8XYNGvGdCdeLCGb0XXISUuN1tPoedKuvPnoybuXfnAzAXlbhb207L/rUMmwXzFPJP/ZXqZ oxKtsqmmr389KwKxqF+j+Vjg33AwiJjQbQ2vRkeA3Ju6ifPmk+v4Y2hbYisWZlW1m/IiIY MIYFnLO5x0Tn7sb5ZxFHn5tB/TKzd2AoYJRI4L7tNTJwrb0KchvlcAY5z+/sDg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1611325288; a=rsa-sha256; cv=none; b=Jk4421vfiWXsyNiqxUv46fOLPuuA+dP5KqTllGEWuOQCAfAgTfgxSP37cRllvPkHLX/a0I S/j7dnaF1Z4SptUzBiKfaWzG291Ub++ak3v2oVshjln+J/jD3OBORz0SYeMLRGv1GGgSty fbJzm2B4O0jr8UcoVu+vM0LHF+oIhB3OAhClEriQv8UrYWNbzSTm18FpHnmFozMUjRS3yJ QpKN2w8v79x0IbGmJi7QDJgQUxIFK0KH7Jm9NH4Nkka+Pz6iWv1RgntUgNK35VmhTK2ESZ qC1zVUQzvaBEstTH9pb7VYkhDzsiHf4TPImCrG7GA3Hgin//NZ9Bac/jcMSQOA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 14:21:28 -0000 --3wfpuDtTLg8/Vq6g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 22, 2021 at 09:54:42AM +0000, Li-Wen Hsu wrote: > The branch main has been updated by lwhsu: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3Daf3993c9e4d7445caf92b36df2= d8bfc6b76d456d >=20 > commit af3993c9e4d7445caf92b36df2d8bfc6b76d456d > Author: Li-Wen Hsu > AuthorDate: 2021-01-22 09:53:59 +0000 > Commit: Li-Wen Hsu > CommitDate: 2021-01-22 09:53:59 +0000 >=20 > Catch up another version bump to 14.0 > =20 > Reported by: rm > --- > UPDATING | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/UPDATING b/UPDATING > index f3d70c3c1c2e..b947129ca7a5 100644 > --- a/UPDATING > +++ b/UPDATING > @@ -12,7 +12,7 @@ Items affecting the ports and packages system can be fo= und in > /usr/ports/UPDATING. Please read that file before running portupgrade. > =20 > NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: > - FreeBSD 13.x has many debugging features turned on, in both the kernel > + FreeBSD 14.x has many debugging features turned on, in both the kernel > and userland. These features attempt to detect incorrect use of > system primitives, and encourage loud failure through extra sanity > checking and fail stop semantics. They also substantially impact >=20 Thank you, and thanks to rm@ for spotting this. Glen --3wfpuDtTLg8/Vq6g Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAmAK32AACgkQAxRYpUeP 4pNGxQ/+Mbe0H7M3dF0YwyrZT/7JP5ahZJ7u2PVY+fUP+8u5JZ5uoxTpSdOH+N+i N1qPDXmtAB6nXDmjBtvlRUYdIzYr0tZqBnFpVMw82+mh2el5ngTb+WVl4SFs5ycB opJpx6DlNrDTZY30LNIRX3KpdmXzMWH9iDspCdj+l0m/eVP+d/TUItmLw5QqqlEL jjceaDB/ZLLOP3sy2UizQrFK3DCRFgAXcHWLuVY2ZVrW+GwbSsQ/bGY6oK16bZVL nmIpoHlSSh/pv+0HjBxhZXBKZzCVvR7vztNzynLmiE/imT+ULgCH666yYEeQhPtg 70/wKglG7SGWGM7tg5Y9wuU+hQk/jRUA2sSmK6dYn932hPpQV76tEUGNjKcfTniq jndZUCK2CS4gax5gIY+gMIQ7BwfheId8jjjvw5h8jyavaGIjiK7YXqDNOnvp9Owy QSC2mDiNEzhu7ngA8/400YtsQY+3DShCjeHD1VBf+k58F82Nub+9mykTbEdGjZfK dod8Uo6NqVNDcUVV6T7ocR4eV7U6/fLL6GHlrX1jo8hUjZUQ0jwglwU2iSBohOBp XdeP6MUD4RsCcOvi5jSUmAMEWTDlDC2zumAeGUsLkAvwh16kW9uyFXsy90Vo27i+ 51l6SB+KvV8H2h1cRuqNMNcUWAdjxu6pUrYtL4TrFvEJpeklTD8= =icgU -----END PGP SIGNATURE----- --3wfpuDtTLg8/Vq6g-- From owner-dev-commits-src-main@freebsd.org Fri Jan 22 14:29:40 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8F1B14F6850; Fri, 22 Jan 2021 14:29:40 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMhVD3dfvz3GWt; Fri, 22 Jan 2021 14:29:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B6001FFB0; Fri, 22 Jan 2021 14:29:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10METeva050618; Fri, 22 Jan 2021 14:29:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10METefB050617; Fri, 22 Jan 2021 14:29:40 GMT (envelope-from git) Date: Fri, 22 Jan 2021 14:29:40 GMT Message-Id: <202101221429.10METefB050617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: eb61de5b7871 - main - powerpc: fix build without DDB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb61de5b7871e2ee2122b31418d1cd50ae43964e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 14:29:40 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=eb61de5b7871e2ee2122b31418d1cd50ae43964e commit eb61de5b7871e2ee2122b31418d1cd50ae43964e Author: Mateusz Guzik AuthorDate: 2021-01-22 14:29:01 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-22 14:29:01 +0000 powerpc: fix build without DDB --- sys/powerpc/powerpc/machdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index 2bcc0ceed015..716f7e43db48 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -263,8 +263,8 @@ powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offset_t ofentry, void *mdp, char *env; void *kmdp = NULL; bool ofw_bootargs = false; - bool symbols_provided = false; #ifdef DDB + bool symbols_provided = false; vm_offset_t ksym_start; vm_offset_t ksym_end; vm_offset_t ksym_sz; From owner-dev-commits-src-main@freebsd.org Fri Jan 22 15:25:38 2021 Return-Path: Delivered-To: dev-commits-src-main@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 627634F7ACD; Fri, 22 Jan 2021 15:25:38 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DMjkp2DhCz3Ksn; Fri, 22 Jan 2021 15:25:38 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f49.google.com with SMTP id q1so11749895ion.8; Fri, 22 Jan 2021 07:25:38 -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=h67yl4O6rvMZQMim0qX3Q+UUxLvi5CTiN18LTBUfJmA=; b=LJyyDmAxWhcA/VU3hRQYsCbx61iz3+E4AkrB7qJ/H7hXvr53kqtuyx2Q6PPZ7HQObo roEY76bb7AzO8YG/NG4EQOMDdppNIMc07E9JC4tsdr3fF/2O3Ntt5cghQyUx89WuPs0g c9v9Q+cvRe+C8qiwnSgea5bZypDDIj2dV+SvnGotaP7TJRwSkuJ8trK1BUEqy/HAtdLG qGkpw9/GwXStgoJItRrTgcO6vTYNE/o2P01U/yKs/r43LWrT3/4VrKG6ONgAkR6z47/I TftscMgwuycjjj7iFoU5+EYRD1WKsy6B/8cXaUmSurpeuu+JzcYFoamrElK5iMzCFwas PvBQ== X-Gm-Message-State: AOAM532vu9WiKZbzG9Y6abdI9detuV72dHecV5k1MM2H7Afg/Wwi6s8f Atr3hmGpNymiNZaXpNkwnhNuQhewLDz7dqKRW9O93/kBUEE= X-Google-Smtp-Source: ABdhPJzXP5Qn2YR/+BOV7p9TAYktTkDG9J1leObpQq+Y+MmGdZvafp2WQeI9KNloLzLr8ohLc22PvtDJq+lGBv1O0wo= X-Received: by 2002:a92:d94f:: with SMTP id l15mr1043997ilq.11.1611329136701; Fri, 22 Jan 2021 07:25:36 -0800 (PST) MIME-Version: 1.0 References: <202101220545.10M5jLcZ070273@gitrepo.freebsd.org> In-Reply-To: <202101220545.10M5jLcZ070273@gitrepo.freebsd.org> From: Ed Maste Date: Fri, 22 Jan 2021 10:25:21 -0500 Message-ID: Subject: Re: git: ed9b7f441466 - main - armv8crypto: add AES-GCM support To: Oleksandr Tymoshenko Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DMjkp2DhCz3Ksn X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 15:25:38 -0000 On Fri, 22 Jan 2021 at 00:45, Oleksandr Tymoshenko wrote: > > The branch main has been updated by gonzo: > > URL: https://cgit.FreeBSD.org/src/commit/?id=ed9b7f4414663703e0e9581a730c4bdfaca5687f > > armv8crypto: add AES-GCM support Do you intend to bring this into stable/13 also? From owner-dev-commits-src-main@freebsd.org Fri Jan 22 16:41:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 272FE4F8ECF; Fri, 22 Jan 2021 16:41:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMlQd0bXgz3PWM; Fri, 22 Jan 2021 16:41:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0739521C43; Fri, 22 Jan 2021 16:41:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MGfieJ031564; Fri, 22 Jan 2021 16:41:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MGfikH031563; Fri, 22 Jan 2021 16:41:44 GMT (envelope-from git) Date: Fri, 22 Jan 2021 16:41:44 GMT Message-Id: <202101221641.10MGfikH031563@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Kubaj Subject: git: c0a9a0cb1f37 - main - powerpc64le: don't enable COMPAT_* options in GENERIC64LE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c0a9a0cb1f3745dc6537861d8bdc43750e686794 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 16:41:45 -0000 The branch main has been updated by pkubaj (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c0a9a0cb1f3745dc6537861d8bdc43750e686794 commit c0a9a0cb1f3745dc6537861d8bdc43750e686794 Author: Piotr Kubaj AuthorDate: 2021-01-22 16:39:15 +0000 Commit: Piotr Kubaj CommitDate: 2021-01-22 16:39:15 +0000 powerpc64le: don't enable COMPAT_* options in GENERIC64LE Support for powerpc64le appeared in 13, so there's no point to enable COMPAT_* for older releases. Also disable COMPAT_FREEBSD32, since there's no powerpcle. Since that may change in the future, leave the option commented out. Approved by: bdragon, jhibbits (on IRC) --- sys/powerpc/conf/GENERIC64LE | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sys/powerpc/conf/GENERIC64LE b/sys/powerpc/conf/GENERIC64LE index bafa8df52f4e..06bdb4c43124 100644 --- a/sys/powerpc/conf/GENERIC64LE +++ b/sys/powerpc/conf/GENERIC64LE @@ -65,14 +65,7 @@ options TMPFS #Efficient memory filesystem options GEOM_PART_APM #Apple Partition Maps. options GEOM_PART_GPT #GUID Partition Tables. options GEOM_LABEL #Provides labelization -options COMPAT_FREEBSD32 #Compatible with FreeBSD/powerpc binaries -options COMPAT_FREEBSD5 #Compatible with FreeBSD5 -options COMPAT_FREEBSD6 #Compatible with FreeBSD6 -options COMPAT_FREEBSD7 #Compatible with FreeBSD7 -options COMPAT_FREEBSD9 # Compatible with FreeBSD9 -options COMPAT_FREEBSD10 # Compatible with FreeBSD10 -options COMPAT_FREEBSD11 # Compatible with FreeBSD11 -options COMPAT_FREEBSD12 # Compatible with FreeBSD12 +#options COMPAT_FREEBSD32 #Compatible with FreeBSD/powerpc binaries options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) syscall trace support options STACK #stack(9) support From owner-dev-commits-src-main@freebsd.org Fri Jan 22 18:35:07 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5567A4FB3F8; Fri, 22 Jan 2021 18:35:07 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMnxR1vrvz3mKD; Fri, 22 Jan 2021 18:35:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 299A023061; Fri, 22 Jan 2021 18:35:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MIZ7UJ075330; Fri, 22 Jan 2021 18:35:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MIZ7lc075329; Fri, 22 Jan 2021 18:35:07 GMT (envelope-from git) Date: Fri, 22 Jan 2021 18:35:07 GMT Message-Id: <202101221835.10MIZ7lc075329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 123ae3045dd2 - main - build: remove LIBPTHREAD/LIBTHR build options MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 123ae3045dd21badb93ce52445e18e364b3ac807 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 18:35:07 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=123ae3045dd21badb93ce52445e18e364b3ac807 commit 123ae3045dd21badb93ce52445e18e364b3ac807 Author: Kyle Evans AuthorDate: 2021-01-20 14:01:25 +0000 Commit: Kyle Evans CommitDate: 2021-01-22 18:33:27 +0000 build: remove LIBPTHREAD/LIBTHR build options WITHOUT_LIBTHR has been broken for a little over five years now, since the xz 5.2.0 update introduced a hard liblzma dependency on libthr, and building a useful system without threading support is becoming increasingly more difficult. Additionally, in the five plus years that it's been broken more reverse dependencies have cropped up in libzstd, libsqlite3, and libcrypto (among others) that make it more and more difficult to reconcile the effort needed to fix these options. Remove the broken options. PR: 252760 Reviewed by: brooks, emaste, kib Differential Revision: https://reviews.freebsd.org/D28263 --- Makefile.inc1 | 6 +----- cddl/lib/Makefile | 2 -- cddl/usr.bin/Makefile | 2 -- cddl/usr.sbin/Makefile | 2 -- lib/Makefile | 4 ++-- sbin/ggate/Makefile | 9 ++------- share/man/man3/Makefile | 2 -- share/mk/src.opts.mk | 6 ------ tools/build/mk/OptionalObsoleteFiles.inc | 7 ------- tools/build/options/WITHOUT_LIBPTHREAD | 5 ----- tools/build/options/WITHOUT_LIBTHR | 5 ----- usr.sbin/Makefile | 2 -- usr.sbin/ngctl/Makefile | 2 -- 13 files changed, 5 insertions(+), 49 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 251993ef8b71..6387c68d25a5 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2898,7 +2898,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \ lib/libzstd \ ${_lib_casper} \ lib/ncurses/ncurses \ - lib/libopie lib/libpam/libpam ${_lib_libthr} \ + lib/libopie lib/libpam/libpam lib/libthr \ ${_lib_libradius} lib/libsbuf lib/libtacplus \ lib/libgeom \ ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ @@ -2932,10 +2932,6 @@ _prebuild_libs+= lib/libc++ lib/libgeom__L: lib/libexpat__L lib/libsbuf__L lib/libkvm__L: lib/libelf__L -.if ${MK_LIBTHR} != "no" -_lib_libthr= lib/libthr -.endif - .if ${MK_RADIUS_SUPPORT} != "no" _lib_libradius= lib/libradius .endif diff --git a/cddl/lib/Makefile b/cddl/lib/Makefile index 38ab0358dde6..2f360a8684a2 100644 --- a/cddl/lib/Makefile +++ b/cddl/lib/Makefile @@ -28,11 +28,9 @@ _libicp_rescue= libicp_rescue _libzfs= libzfs _libzutil= libzutil _libzfsbootenv= libzfsbootenv -.if ${MK_LIBTHR} != "no" _libzpool= libzpool _libtpool= libtpool .endif -.endif SUBDIR_DEPEND_libctf= libspl SUBDIR_DEPEND_libdtrace= libctf diff --git a/cddl/usr.bin/Makefile b/cddl/usr.bin/Makefile index 8c7fa3ac83fa..5c2595df1c9f 100644 --- a/cddl/usr.bin/Makefile +++ b/cddl/usr.bin/Makefile @@ -15,12 +15,10 @@ SUBDIR.${MK_TESTS}+= tests .if ${MK_ZFS} != "no" _zinject= zinject -.if ${MK_LIBTHR} != "no" _ztest= ztest _zstream = zstream _zstreamdump = zstreamdump .endif -.endif SUBDIR_PARALLEL= diff --git a/cddl/usr.sbin/Makefile b/cddl/usr.sbin/Makefile index a736a75a73ec..42de5c96c53a 100644 --- a/cddl/usr.sbin/Makefile +++ b/cddl/usr.sbin/Makefile @@ -13,10 +13,8 @@ SUBDIR= ${_dtrace} \ SUBDIR.${MK_TESTS}+= tests .if ${MK_ZFS} != "no" -.if ${MK_LIBTHR} != "no" _zdb= zdb _zhack= zhack -.endif . if ${MK_CXX} != "no" _zfsd= zfsd . endif diff --git a/lib/Makefile b/lib/Makefile index 5d7caa6b9423..ddb627917215 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -93,6 +93,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ libstdthreads \ libsysdecode \ libtacplus \ + libthr \ libthread_db \ libucl \ libufs \ @@ -137,7 +138,7 @@ SUBDIR_DEPEND_libsmb= libkiconv SUBDIR_DEPEND_libtacplus= libmd SUBDIR_DEPEND_libulog= libmd SUBDIR_DEPEND_libunbound= ${_libldns} -SUBDIR_DEPEND_liblzma= ${_libthr} +SUBDIR_DEPEND_liblzma= libthr .if ${MK_OFED} != "no" SUBDIR_DEPEND_libpcap= ofed .endif @@ -189,7 +190,6 @@ _libcplusplus+= libc++experimental SUBDIR.${MK_EFI}+= libefivar SUBDIR.${MK_GOOGLETEST}+= googletest -SUBDIR.${MK_LIBTHR}+= libthr SUBDIR.${MK_NETGRAPH}+= libnetgraph SUBDIR.${MK_NIS}+= libypclnt diff --git a/sbin/ggate/Makefile b/sbin/ggate/Makefile index b46335991671..22532cc18512 100644 --- a/sbin/ggate/Makefile +++ b/sbin/ggate/Makefile @@ -2,13 +2,8 @@ .include -SUBDIR= ${_ggatec} \ - ${_ggated} \ +SUBDIR= ggatec \ + ggated \ ggatel -.if ${MK_LIBTHR} != "no" -_ggatec= ggatec -_ggated= ggated -.endif - .include diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index 7fb09f970a26..d33c0d63ea0d 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -370,7 +370,6 @@ MLINKS+= tree.3 RB_EMPTY.3 \ tree.3 SPLAY_RIGHT.3 \ tree.3 SPLAY_ROOT.3 -.if ${MK_LIBTHR} != "no" PTHREAD_MAN= pthread.3 \ pthread_affinity_np.3 \ pthread_atfork.3 \ @@ -504,6 +503,5 @@ PTHREAD_MLINKS+=pthread_testcancel.3 pthread_setcancelstate.3 \ pthread_testcancel.3 pthread_setcanceltype.3 PTHREAD_MLINKS+=pthread_join.3 pthread_peekjoin_np.3 \ pthread_join.3 pthread_timedjoin_np.3 -.endif .include diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 55d07dac42dd..8ed02cbce3fa 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -126,8 +126,6 @@ __DEFAULT_YES_OPTIONS = \ LDNS_UTILS \ LEGACY_CONSOLE \ LIBCPLUSPLUS \ - LIBPTHREAD \ - LIBTHR \ LLD \ LLD_BOOTSTRAP \ LLD_IS_LD \ @@ -378,10 +376,6 @@ BROKEN_OPTIONS+=CLANG_BOOTSTRAP LLD_BOOTSTRAP MK_CASPER:= no .endif -.if ${MK_LIBPTHREAD} == "no" -MK_LIBTHR:= no -.endif - .if ${MK_SOURCELESS} == "no" MK_SOURCELESS_HOST:= no MK_SOURCELESS_UCODE:= no diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 0484ad6fa30a..b517cff65338 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -4110,13 +4110,6 @@ OLD_DIRS+=usr/include/c++/v1/ext OLD_DIRS+=usr/include/c++/v1 .endif -.if ${MK_LIBTHR} == no -OLD_LIBS+=lib/libthr.so.3 -OLD_FILES+=usr/lib/libthr.a -OLD_FILES+=usr/lib/libthr_p.a -OLD_FILES+=usr/share/man/man3/libthr.3.gz -.endif - .if ${MK_LLD} == no OLD_FILES+=usr/bin/ld.lld .endif diff --git a/tools/build/options/WITHOUT_LIBPTHREAD b/tools/build/options/WITHOUT_LIBPTHREAD deleted file mode 100644 index 28a6200bfc92..000000000000 --- a/tools/build/options/WITHOUT_LIBPTHREAD +++ /dev/null @@ -1,5 +0,0 @@ -.\" $FreeBSD$ -Set to not build the -.Nm libpthread -providing library, -.Nm libthr . diff --git a/tools/build/options/WITHOUT_LIBTHR b/tools/build/options/WITHOUT_LIBTHR deleted file mode 100644 index 836473511983..000000000000 --- a/tools/build/options/WITHOUT_LIBTHR +++ /dev/null @@ -1,5 +0,0 @@ -.\" $FreeBSD$ -Set to not build the -.Nm libthr -(1:1 threading) -library. diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index da61617e408b..39913a327b87 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -162,10 +162,8 @@ SUBDIR.${MK_LEGACY_CONSOLE}+= kbdcontrol SUBDIR.${MK_LEGACY_CONSOLE}+= kbdmap SUBDIR.${MK_LEGACY_CONSOLE}+= moused SUBDIR.${MK_LEGACY_CONSOLE}+= vidcontrol -.if ${MK_LIBTHR} != "no" || ${MK_LIBPTHREAD} != "no" SUBDIR.${MK_PPP}+= pppctl SUBDIR.${MK_NS_CACHING}+= nscd -.endif SUBDIR.${MK_LPR}+= lpr SUBDIR.${MK_MAN_UTILS}+= manctl SUBDIR.${MK_MLX5TOOL}+= mlx5tool diff --git a/usr.sbin/ngctl/Makefile b/usr.sbin/ngctl/Makefile index 519bf98c7813..a4831523c3fc 100644 --- a/usr.sbin/ngctl/Makefile +++ b/usr.sbin/ngctl/Makefile @@ -11,9 +11,7 @@ WARNS?= 3 LIBADD= netgraph -.if ${MK_LIBTHR} != "no" CFLAGS+= -DEDITLINE LIBADD+= edit pthread -.endif .include From owner-dev-commits-src-main@freebsd.org Fri Jan 22 18:35:08 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E4AC64FB050; Fri, 22 Jan 2021 18:35:08 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMnxS3Klcz3mPd; Fri, 22 Jan 2021 18:35:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42DA723062; Fri, 22 Jan 2021 18:35:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MIZ8vO075352; Fri, 22 Jan 2021 18:35:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MIZ8fB075351; Fri, 22 Jan 2021 18:35:08 GMT (envelope-from git) Date: Fri, 22 Jan 2021 18:35:08 GMT Message-Id: <202101221835.10MIZ8fB075351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 251a6ddfbdcd - main - Regen src.conf after MK_{LIBTHR, LIBPTHREAD} removal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 251a6ddfbdcd72e0de922e8320d2f0cc6806a423 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 18:35:09 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=251a6ddfbdcd72e0de922e8320d2f0cc6806a423 commit 251a6ddfbdcd72e0de922e8320d2f0cc6806a423 Author: Kyle Evans AuthorDate: 2021-01-20 14:03:21 +0000 Commit: Kyle Evans CommitDate: 2021-01-22 18:34:41 +0000 Regen src.conf after MK_{LIBTHR,LIBPTHREAD} removal --- share/man/man5/src.conf.5 | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 5ff5b31b80be..63495c7c9477 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 20, 2021 +.Dd January 22, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -861,25 +861,9 @@ This is a default setting on arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mips, powerpc/powerpc, riscv/riscv64 and riscv/riscv64sf. .It Va WITHOUT_LIBCPLUSPLUS Set to avoid building libcxxrt and libc++. -.It Va WITHOUT_LIBPTHREAD -Set to not build the -.Nm libpthread -providing library, -.Nm libthr . -When set, it enforces these options: -.Pp -.Bl -item -compact -.It -.Va WITHOUT_LIBTHR -.El .It Va WITH_LIBSOFT On armv6 only, set to enable soft float ABI compatibility libraries. This option is for transitioning to the new hard float ABI. -.It Va WITHOUT_LIBTHR -Set to not build the -.Nm libthr -(1:1 threading) -library. .It Va WITHOUT_LLD Set to not build LLVM's lld linker. .It Va WITHOUT_LLDB From owner-dev-commits-src-main@freebsd.org Fri Jan 22 18:53:48 2021 Return-Path: Delivered-To: dev-commits-src-main@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 6D7694FB8DB; Fri, 22 Jan 2021 18:53:48 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMpM02f6Jz3p3s; Fri, 22 Jan 2021 18:53:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C758235AE; Fri, 22 Jan 2021 18:53:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MIrmRJ000879; Fri, 22 Jan 2021 18:53:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MIrmYb000878; Fri, 22 Jan 2021 18:53:48 GMT (envelope-from git) Date: Fri, 22 Jan 2021 18:53:48 GMT Message-Id: <202101221853.10MIrmYb000878@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 39c8ef90f6d0 - main - jail: A jail could be removed without calling OSD methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 39c8ef90f6d035cd3c3ab40e051b1c0f419c76be Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 18:53:48 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=39c8ef90f6d035cd3c3ab40e051b1c0f419c76be commit 39c8ef90f6d035cd3c3ab40e051b1c0f419c76be Author: Jamie Gritton AuthorDate: 2021-01-22 18:50:10 +0000 Commit: Jamie Gritton CommitDate: 2021-01-22 18:50:10 +0000 jail: A jail could be removed without calling OSD methods Fix a long-standing bug where setting nopersist on a process-less jail would remove it without calling the the OSD PR_METHOD_REMOVE methods. --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index e869bafc96b8..318f81fb13be 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1741,8 +1741,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) prison_hold(pr); refcount_acquire(&pr->pr_uref); } else { - refcount_release(&pr->pr_uref); refcount_release(&pr->pr_ref); + drflags |= PD_DEUREF; } } pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; From owner-dev-commits-src-main@freebsd.org Fri Jan 22 19:00:37 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B29644FC109; Fri, 22 Jan 2021 19:00:37 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMpVs4kwbz3pDN; Fri, 22 Jan 2021 19:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95654235B4; Fri, 22 Jan 2021 19:00:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MJ0bj3009359; Fri, 22 Jan 2021 19:00:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MJ0bfZ009358; Fri, 22 Jan 2021 19:00:37 GMT (envelope-from git) Date: Fri, 22 Jan 2021 19:00:37 GMT Message-Id: <202101221900.10MJ0bfZ009358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 195cd6ae2481 - main - jail: fix dangling reference bug from 6754ae2572eb MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 195cd6ae2481dd5ad555ed65c226b6f20908d66a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 19:00:37 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=195cd6ae2481dd5ad555ed65c226b6f20908d66a commit 195cd6ae2481dd5ad555ed65c226b6f20908d66a Author: Jamie Gritton AuthorDate: 2021-01-22 18:56:24 +0000 Commit: Jamie Gritton CommitDate: 2021-01-22 18:56:24 +0000 jail: fix dangling reference bug from 6754ae2572eb The change to use refcounts for pr_uref was mishandled in prison_proc_free, so killing a jail's last process could add an extra reference, leaving it an unkillable zombie. --- sys/kern/kern_jail.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 318f81fb13be..064f1afa4133 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -2705,7 +2705,6 @@ prison_proc_hold(struct prison *pr) void prison_proc_free(struct prison *pr) { - int lasturef; /* * Locking is only required when releasing the last reference. @@ -2714,11 +2713,7 @@ prison_proc_free(struct prison *pr) */ KASSERT(refcount_load(&pr->pr_uref) > 0, ("Trying to kill a process in a dead prison (jid=%d)", pr->pr_id)); - if (refcount_release_if_not_last(&pr->pr_uref)) - return; - mtx_lock(&pr->pr_mtx); - lasturef = refcount_release(&pr->pr_uref); - if (lasturef) { + if (!refcount_release_if_not_last(&pr->pr_uref)) { /* * Don't remove the last user reference in this context, * which is expected to be a process that is not only locked, @@ -2726,11 +2721,8 @@ prison_proc_free(struct prison *pr) * prison_free() won't re-submit the task. */ refcount_acquire(&pr->pr_ref); - mtx_unlock(&pr->pr_mtx); taskqueue_enqueue(taskqueue_thread, &pr->pr_task); - return; } - mtx_unlock(&pr->pr_mtx); } /* From owner-dev-commits-src-main@freebsd.org Fri Jan 22 19:08:13 2021 Return-Path: Delivered-To: dev-commits-src-main@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 350044FBF63; Fri, 22 Jan 2021 19:08:13 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMpgd0rQNz3pXl; Fri, 22 Jan 2021 19:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B4DF2354E; Fri, 22 Jan 2021 19:08:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MJ8CtM015162; Fri, 22 Jan 2021 19:08:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MJ8Cbi015161; Fri, 22 Jan 2021 19:08:12 GMT (envelope-from git) Date: Fri, 22 Jan 2021 19:08:12 GMT Message-Id: <202101221908.10MJ8Cbi015161@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 57a543d8b850 - main - gdb: only return signal values for powerpc's gdb_cpu_signal() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 57a543d8b85065f77e0b68162d09a03335970f90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 19:08:13 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=57a543d8b85065f77e0b68162d09a03335970f90 commit 57a543d8b85065f77e0b68162d09a03335970f90 Author: Mitchell Horne AuthorDate: 2021-01-22 18:56:56 +0000 Commit: Mitchell Horne CommitDate: 2021-01-22 19:01:49 +0000 gdb: only return signal values for powerpc's gdb_cpu_signal() Summary: The values returned by this function are reported to the gdb client as the reason for the break in execution, a signal value such as SIGTRAP, SIGEMT, or SIGSEGV. As such, exact vector numbers can be misidentified. Return SIGEMT in the default case instead. Reviewed by: alfredo MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28046 --- sys/powerpc/powerpc/gdb_machdep.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/powerpc/powerpc/gdb_machdep.c b/sys/powerpc/powerpc/gdb_machdep.c index 83b3245f4e69..a7f1de512e31 100644 --- a/sys/powerpc/powerpc/gdb_machdep.c +++ b/sys/powerpc/powerpc/gdb_machdep.c @@ -98,10 +98,7 @@ gdb_cpu_signal(int vector, int dummy __unused) return (SIGTRAP); #endif - if (vector <= 255) - return (vector); - else - return (SIGEMT); + return (SIGEMT); } void From owner-dev-commits-src-main@freebsd.org Fri Jan 22 19:40:29 2021 Return-Path: Delivered-To: dev-commits-src-main@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 86C564FD099; Fri, 22 Jan 2021 19:40:29 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMqNs3S8yz3rfl; Fri, 22 Jan 2021 19:40:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6967B23DD2; Fri, 22 Jan 2021 19:40:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MJeT6b061453; Fri, 22 Jan 2021 19:40:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MJeTcd061452; Fri, 22 Jan 2021 19:40:29 GMT (envelope-from git) Date: Fri, 22 Jan 2021 19:40:29 GMT Message-Id: <202101221940.10MJeTcd061452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 86f33b5fcf60 - main - elfctl: allow features to be specified by value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 86f33b5fcf6087bf4439881011b920ff99e6e300 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 19:40:29 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=86f33b5fcf6087bf4439881011b920ff99e6e300 commit 86f33b5fcf6087bf4439881011b920ff99e6e300 Author: Ed Maste AuthorDate: 2021-01-22 17:22:35 +0000 Commit: Ed Maste CommitDate: 2021-01-22 19:38:52 +0000 elfctl: allow features to be specified by value This will allow elfctl on older releases to set bits that are not yet known there, so that the binary will have the correct settings applied if run on a later FreeBSD version. PR: 252629 (related) Suggested by: kib Reviewed by: gbe (manpage, earlier), kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28284 --- usr.bin/elfctl/elfctl.1 | 15 +++++++++++++-- usr.bin/elfctl/elfctl.c | 25 ++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/usr.bin/elfctl/elfctl.1 b/usr.bin/elfctl/elfctl.1 index f93b558fdf0d..23e2dabea49c 100644 --- a/usr.bin/elfctl/elfctl.1 +++ b/usr.bin/elfctl/elfctl.1 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 12, 2021 +.Dd January 22, 2021 .Dt ELFCTL 1 .Os .Sh NAME @@ -64,7 +64,8 @@ to turn on the features, to turn off the features, .Dq Li = to only turn on the given features. -A comma separated list of feature names follows the operation. +A comma separated list of feature names or numeric values follows the +operation. .El .Pp If @@ -86,6 +87,16 @@ command: elfctl file elfctl -e +aslr file .Ed +.Pp +Features may be specified as numerical values: +.Bd -literal -offset -indent +elfctl -e =0x0001,0x0004 file +.Ed +.Pp +Features may also be specified as a single combined value: +.Bd -literal -offset -indent +elfctl -e =0x5 file +.Ed .Sh HISTORY .Nm first appeared in diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c index 20a2c5b95444..f641b63e32bd 100644 --- a/usr.bin/elfctl/elfctl.c +++ b/usr.bin/elfctl/elfctl.c @@ -33,7 +33,9 @@ #include #include +#include #include +#include #include #include #include @@ -245,9 +247,26 @@ convert_to_feature_val(char *feature_str, uint32_t *feature_val) } } if (i == len) { - warnx("%s is not a valid feature", feature); - if (!iflag) - return (false); + if (isdigit(feature[0])) { + char *eptr; + long val; + + errno = 0; + val = strtol(feature, &eptr, 0); + if (eptr == feature || *eptr != '\0') + errno = EINVAL; + else if (val > UINT_MAX) + errno = ERANGE; + if (errno != 0) { + warn("%s invalid", feature); + return (false); + } + input != val; + } else { + warnx("%s is not a valid feature", feature); + if (!iflag) + return (false); + } } } From owner-dev-commits-src-main@freebsd.org Fri Jan 22 21:21:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 4DDC84FE9D1; Fri, 22 Jan 2021 21:21:49 +0000 (UTC) (envelope-from ml+freebsd@vishwin.info) Received: from varun.vishwin.info (varun.vishwin.info [46.101.93.59]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "varun.vishwin.info", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMsdm64rfz4S5x; Fri, 22 Jan 2021 21:21:48 +0000 (UTC) (envelope-from ml+freebsd@vishwin.info) Received: from varun.vishwin.info ( [fd35:9eae:7575::2]) by varun.vishwin.info (OpenSMTPD) with ESMTP id de3bd8cc; Fri, 22 Jan 2021 16:21:39 -0500 (EST) Received: from [IPv6:2601:98a:601:5140:56ee:75ff:fe50:69b5] ( [2601:98a:601:5140:56ee:75ff:fe50:69b5]) by varun.vishwin.info (OpenSMTPD) with ESMTPSA id e8b42af0 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 22 Jan 2021 16:21:38 -0500 (EST) Subject: Re: git: 86f33b5fcf60 - main - elfctl: allow features to be specified by value To: Ed Maste , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101221940.10MJeTcd061452@gitrepo.freebsd.org> From: Charlie Li Organization: FreeBSD mailing lists Message-ID: <7165ee25-4328-7ac0-5f5a-fc8089c6cc9d@vishwin.info> Date: Fri, 22 Jan 2021 16:21:37 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <202101221940.10MJeTcd061452@gitrepo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lJ2d6u1435yrBaIP6P5SE63slh1EHO00l" X-Rspamd-Queue-Id: 4DMsdm64rfz4S5x X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[freebsd]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 21:21:49 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --lJ2d6u1435yrBaIP6P5SE63slh1EHO00l Content-Type: multipart/mixed; boundary="F0Wtt5Bw4fn0DXabyrBz8sQVisYnKaIqA"; protected-headers="v1" From: Charlie Li To: Ed Maste , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <7165ee25-4328-7ac0-5f5a-fc8089c6cc9d@vishwin.info> Subject: Re: git: 86f33b5fcf60 - main - elfctl: allow features to be specified by value References: <202101221940.10MJeTcd061452@gitrepo.freebsd.org> In-Reply-To: <202101221940.10MJeTcd061452@gitrepo.freebsd.org> --F0Wtt5Bw4fn0DXabyrBz8sQVisYnKaIqA Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable Ed Maste wrote: > diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c > index 20a2c5b95444..f641b63e32bd 100644 > --- a/usr.bin/elfctl/elfctl.c > +++ b/usr.bin/elfctl/elfctl.c > @@ -245,9 +247,26 @@ convert_to_feature_val(char *feature_str, uint32_t= *feature_val) > } > } > if (i =3D=3D len) { > - warnx("%s is not a valid feature", feature); > - if (!iflag) > - return (false); > + if (isdigit(feature[0])) { > + char *eptr; > + long val; > + > + errno =3D 0; > + val =3D strtol(feature, &eptr, 0); > + if (eptr =3D=3D feature || *eptr !=3D '\0') > + errno =3D EINVAL; > + else if (val > UINT_MAX) > + errno =3D ERANGE; > + if (errno !=3D 0) { > + warn("%s invalid", feature); > + return (false); > + } > + input !=3D val; > + } else { > + warnx("%s is not a valid feature", feature); > + if (!iflag) > + return (false); > + } > } > } > =20 Build fails: --- elfctl.o --- /usr/src/usr.bin/elfctl/elfctl.c:264:11: error: inequality comparison result unused [-Werror,-Wunused-comparison] input !=3D val; ~~~~~~^~~~~~ /usr/src/usr.bin/elfctl/elfctl.c:264:11: note: use '|=3D' to turn this inequality comparison into an or-assignment input !=3D val; ^~ |=3D 1 error generated. *** [elfctl.o] Error code 1 make[4]: stopped in /usr/src/usr.bin/elfctl --=20 Charlie Li =E2=80=A6nope, still don't have an exit line. (This email address is for mailing list use; replace local-part with vishwin for off-list communication if possible) --F0Wtt5Bw4fn0DXabyrBz8sQVisYnKaIqA-- --lJ2d6u1435yrBaIP6P5SE63slh1EHO00l Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEE/3/Cqr5a+41PbEb+jnB43vIDq2wFAmALQeEFAwAAAAAACgkQjnB43vIDq2zW iw/7BKTewmqWRtxuxi9mD4htkB7zS5KAwDKtBhKBd+VwiWhMu1Px3V5DUWYXOyvHJIdZyf5V7sUS pJzm+r3+89vqJQqTqHSrytt5fMGBek35udJQM61CNNw7m5QpyspqYd4Kd8eMD19TAFJvXS6ozZpW v5jJg8vhlpjQlm4H9hRLKcra9qHAAzUz/F6wXUx/ZwQJO3YyFnqHWBYZ8KJJlzXAA6tr7BmrTTdI 62ig2zI+EnLcIUexmL06V4khtPzYeCoYz1wmHrKs3QQrtuVodBc3wp8DfgslVcIP9v11RgwjyRYK LhMAaIaOVndfpH/BSsKtIyOwYCbCFiUVdvAfG5t1CpWxZMwyBgjls9KDuojT430ekuQHrcvrp0O4 /y/jNjRpHQv5H0ZK4tWdjck0Lw5Qy3StlyYfSQnbJB6x97Dh0RF2SsR+6TuKBs8V0T2UehM1ZzzD bamDxSNsy2msVq7V2gdmvfZ/GjrF1Dz2BFqzwWEccOqjeLvC5ub1zreDdHreOlsEL/KRnEJwNRYj gBszjwyms+A3hgwR/QCCKA/gamtaIIlyNz5Fbg3GrY+S5pCx1dEO764x0JKrF/y5TMnKGuKjDZ+A jJ8w3b51YeYYKtFbqPA2J2XsbzRye+N3NnuMdv4Ekv6iaXeDzmZ1GTEIHiQChb4HM6SU99OtKbz9 GyQ= =kVX0 -----END PGP SIGNATURE----- --lJ2d6u1435yrBaIP6P5SE63slh1EHO00l-- From owner-dev-commits-src-main@freebsd.org Fri Jan 22 21:35:52 2021 Return-Path: Delivered-To: dev-commits-src-main@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 74DF94FECC3; Fri, 22 Jan 2021 21:35:52 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMsy02y1dz4SqK; Fri, 22 Jan 2021 21:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 584402567D; Fri, 22 Jan 2021 21:35:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10MLZqQC009761; Fri, 22 Jan 2021 21:35:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10MLZq7s009760; Fri, 22 Jan 2021 21:35:52 GMT (envelope-from git) Date: Fri, 22 Jan 2021 21:35:52 GMT Message-Id: <202101222135.10MLZq7s009760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: f302fd1aa673 - main - elfctl: fix typo from last-minute refactoring MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f302fd1aa6730facd53a3f761e0a57302731b03e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2021 21:35:52 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f302fd1aa6730facd53a3f761e0a57302731b03e commit f302fd1aa6730facd53a3f761e0a57302731b03e Author: Ed Maste AuthorDate: 2021-01-22 21:23:12 +0000 Commit: Ed Maste CommitDate: 2021-01-22 21:35:05 +0000 elfctl: fix typo from last-minute refactoring Reported by: jkim Fixes: 86f33b5fcf6087bf4439881011b920ff99e6e300 --- usr.bin/elfctl/elfctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c index f641b63e32bd..300a66eb516e 100644 --- a/usr.bin/elfctl/elfctl.c +++ b/usr.bin/elfctl/elfctl.c @@ -261,7 +261,7 @@ convert_to_feature_val(char *feature_str, uint32_t *feature_val) warn("%s invalid", feature); return (false); } - input != val; + input |= val; } else { warnx("%s is not a valid feature", feature); if (!iflag) From owner-dev-commits-src-main@freebsd.org Sat Jan 23 00:32:11 2021 Return-Path: Delivered-To: dev-commits-src-main@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 10B5A4D9B7F; Sat, 23 Jan 2021 00:32:11 +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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DMxsQ75Ykz4cDJ; Sat, 23 Jan 2021 00:32:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:cc0:f389:d635:b0d2]) (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 790BB23D7; Sat, 23 Jan 2021 00:32:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: ed9b7f441466 - main - armv8crypto: add AES-GCM support To: Oleksandr Tymoshenko , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202101220545.10M5jLcZ070273@gitrepo.freebsd.org> From: John Baldwin Message-ID: <9d92bfd4-c51a-48d3-2676-5e6163c35ffa@FreeBSD.org> Date: Fri, 22 Jan 2021 16:32:09 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <202101220545.10M5jLcZ070273@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 00:32:11 -0000 On 1/21/21 9:45 PM, Oleksandr Tymoshenko wrote: > The branch main has been updated by gonzo: > > URL: https://cgit.FreeBSD.org/src/commit/?id=ed9b7f4414663703e0e9581a730c4bdfaca5687f > > commit ed9b7f4414663703e0e9581a730c4bdfaca5687f > Author: Oleksandr Tymoshenko > AuthorDate: 2021-01-13 06:27:10 +0000 > Commit: Oleksandr Tymoshenko > CommitDate: 2021-01-22 05:41:27 +0000 > > armv8crypto: add AES-GCM support > > Add support for AES-GCM using OpenSSL's accelerated routines. > > Reviewed by: jhb > Differential Revision: https://reviews.freebsd.org/D27454 > Sponsored by: Ampere Computing > Submitted by: Klara, Inc. This probably warranted a Relnotes: yes tag :) Can you add a note to RELNOTES? -- John Baldwin From owner-dev-commits-src-main@freebsd.org Sat Jan 23 02:45:52 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2A01C4E0CE5; Sat, 23 Jan 2021 02:45:52 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from tor1-11.mx.scaleengine.net (tor1-11.mx.scaleengine.net [209.51.186.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DN0qh050Sz4n9f; Sat, 23 Jan 2021 02:45:51 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (Seawolf.HML3.ScaleEngine.net [209.51.186.28]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by tor1-11.mx.scaleengine.net (Postfix) with ESMTPSA id 14B7F13482; Sat, 23 Jan 2021 02:45:43 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 tor1-11.mx.scaleengine.net 14B7F13482 Subject: Re: git: ed9b7f441466 - main - armv8crypto: add AES-GCM support To: Ed Maste , Oleksandr Tymoshenko Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202101220545.10M5jLcZ070273@gitrepo.freebsd.org> From: Allan Jude Message-ID: <8b8c3d7a-06eb-3003-e6c0-a1181bb0e8ae@freebsd.org> Date: Fri, 22 Jan 2021 21:45:42 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DN0qh050Sz4n9f X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 02:45:52 -0000 On 2021-01-22 10:25, Ed Maste wrote: > On Fri, 22 Jan 2021 at 00:45, Oleksandr Tymoshenko wrote: >> >> The branch main has been updated by gonzo: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=ed9b7f4414663703e0e9581a730c4bdfaca5687f >> >> armv8crypto: add AES-GCM support > > Do you intend to bring this into stable/13 also? > Yes we do. Oleksandr has already spoken to re@ about it. -- Allan Jude From owner-dev-commits-src-main@freebsd.org Sat Jan 23 06:45:32 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1F9764E81D6; Sat, 23 Jan 2021 06:45:32 +0000 (UTC) (envelope-from gonzo@freebsd.org) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (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 4DN68D09k5z3KJy; Sat, 23 Jan 2021 06:45:31 +0000 (UTC) (envelope-from gonzo@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bluezbox.com; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=KEO2HOfD5pBf5SqYfygd0vpOUsUHQv9DM8d7gLnUJu4=; b=D6ueFSqZ3V//1aHSiEY8WSpIRv 6NE5VSMYdOZ1/5/g6PV2GNQGZolIDHDBsWokYofbj+pzV02qHxLTDijOw4f8ENcrlI2mii+ZD+Gl0 jQ5w+aoeMM5RLxYyEr8ZQTXbpry7HRIaDfrHJuGpqNjvLSuUYf9SaZo5BmwJR8A92GSk=; Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1l3Cfk-0005Jz-Ok; Fri, 22 Jan 2021 22:45:25 -0800 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id 10N6jOkA020458; Fri, 22 Jan 2021 22:45:24 -0800 (PST) (envelope-from gonzo@freebsd.org) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@freebsd.org using -f Date: Fri, 22 Jan 2021 22:45:24 -0800 From: Oleksandr Tymoshenko To: Ed Maste Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ed9b7f441466 - main - armv8crypto: add AES-GCM support Message-ID: <20210123064524.GA20369@bluezbox.com> References: <202101220545.10M5jLcZ070273@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD/11.2-RELEASE-p10 (amd64) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Ed Maste (emaste@freebsd.org) wrote: > On Fri, 22 Jan 2021 at 00:45, Oleksandr Tymoshenko wrote: > > > > The branch main has been updated by gonzo: > > > > URL: https://cgit.FreeBS [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Rspamd-Queue-Id: 4DN68D09k5z3KJy X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 06:45:32 -0000 Ed Maste (emaste@freebsd.org) wrote: > On Fri, 22 Jan 2021 at 00:45, Oleksandr Tymoshenko wrote: > > > > The branch main has been updated by gonzo: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=ed9b7f4414663703e0e9581a730c4bdfaca5687f > > > > armv8crypto: add AES-GCM support > > Do you intend to bring this into stable/13 also? Merged as a f76393a6305b67c0f3439ba684c5d49a2aafe2a0 -- gonzo From owner-dev-commits-src-main@freebsd.org Sat Jan 23 07:00:06 2021 Return-Path: Delivered-To: dev-commits-src-main@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 953B84E8B82; Sat, 23 Jan 2021 07:00:06 +0000 (UTC) (envelope-from gonzo@freebsd.org) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (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 4DN6T23dWfz3KnL; Sat, 23 Jan 2021 07:00:06 +0000 (UTC) (envelope-from gonzo@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bluezbox.com; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VmNWQdnVGiZCJoJT/0g4KcgazDrL0Ji/bo32fXr5x9g=; b=v4TXccAhW0rcnmo5jtFTalBrZL RDMlAtY65Tgvx2KXZ0Cn72SXAeUMU4oP8cs/e5mm8T8rqqdtJ4ATIbnYPVIvHcgfETXZcNAYFh+bS 4lpKSPiVJAzWUmxAEL01Ov/7Ls9pcmq9YMGmtBKMRcJ7eDO+pJoC30CJOM3rW47AtcTY=; Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94 (FreeBSD)) (envelope-from ) id 1l3Ctx-0005MC-53; Fri, 22 Jan 2021 23:00:05 -0800 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id 10N705WG020595; Fri, 22 Jan 2021 23:00:05 -0800 (PST) (envelope-from gonzo@freebsd.org) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@freebsd.org using -f Date: Fri, 22 Jan 2021 23:00:05 -0800 From: Oleksandr Tymoshenko To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ed9b7f441466 - main - armv8crypto: add AES-GCM support Message-ID: <20210123070005.GB20369@bluezbox.com> References: <202101220545.10M5jLcZ070273@gitrepo.freebsd.org> <9d92bfd4-c51a-48d3-2676-5e6163c35ffa@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9d92bfd4-c51a-48d3-2676-5e6163c35ffa@FreeBSD.org> X-Operating-System: FreeBSD/11.2-RELEASE-p10 (amd64) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: John Baldwin (jhb@FreeBSD.org) wrote: > On 1/21/21 9:45 PM, Oleksandr Tymoshenko wrote: > > The branch main has been updated by gonzo: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=ed9b7f441466 [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Rspamd-Queue-Id: 4DN6T23dWfz3KnL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 07:00:06 -0000 John Baldwin (jhb@FreeBSD.org) wrote: > On 1/21/21 9:45 PM, Oleksandr Tymoshenko wrote: > > The branch main has been updated by gonzo: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=ed9b7f4414663703e0e9581a730c4bdfaca5687f > > > > commit ed9b7f4414663703e0e9581a730c4bdfaca5687f > > Author: Oleksandr Tymoshenko > > AuthorDate: 2021-01-13 06:27:10 +0000 > > Commit: Oleksandr Tymoshenko > > CommitDate: 2021-01-22 05:41:27 +0000 > > > > armv8crypto: add AES-GCM support > > > > Add support for AES-GCM using OpenSSL's accelerated routines. > > > > Reviewed by: jhb > > Differential Revision: https://reviews.freebsd.org/D27454 > > Sponsored by: Ampere Computing > > Submitted by: Klara, Inc. > > This probably warranted a Relnotes: yes tag :) > > Can you add a note to RELNOTES? I guess it will have to be direct commit to stable/13? Here is a phabricator review for the change: https://reviews.freebsd.org/D28297 -- gonzo From owner-dev-commits-src-main@freebsd.org Sat Jan 23 07:30:06 2021 Return-Path: Delivered-To: dev-commits-src-main@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 738D94E971A; Sat, 23 Jan 2021 07:30:06 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DN77f2mWBz3MCY; Sat, 23 Jan 2021 07:30:06 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-ej1-f45.google.com with SMTP id g3so10881239ejb.6; Fri, 22 Jan 2021 23:30:06 -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=AT6MVikYEolNt5Ceuv/gRSeenkcudHV0xoXOD9a6QY0=; b=je0Ethib72HqbjuEHMDeaKiM44gHCP6TrtXol1yuiMozXCJeBQgIA8Y6Leo8O7HCqN z0dUs9QKG/hKkj8mdwdg79gDjElgqqVLgSKnt9sHnndunHNugtb4bI3ONMlXSnnoQxau 91UWCdU8bLtOTtAF0GIVG0axIYqhe2K2tF9G3QeOLZsR56LSHOg7b9y16HiepIVlmSx/ lN5Aom4KF1N0e6l904oMOTvZD2JxA4MX5D2Bhhbg/WieuDUf4IicuUxDyMbVdKiQoR4A /Al/8my52ZQAIUNUpOjiLVTNy6KI337gkWL6g277t0J26NhmXcmxzc7WwUPGzaxvjBmp omEw== X-Gm-Message-State: AOAM531SEasEKEj/waO5+3aGuGJpq2Jzi/gW883uliIs7ZCn/jYEbgx/ /9nbjqJaEWw+Vf0DMtS6XQ1nUYDiUkzuwmkNUxCeFHx/YUE= X-Google-Smtp-Source: ABdhPJxY+TBEBUW0SrZF8f4m+fipd9PpIAvHFt9/Uas2qjxM9kwMuGZRd5bA5nXJDc4Ur/Ii2AvVUiwk+yq6bx4LK18= X-Received: by 2002:a17:906:478a:: with SMTP id cw10mr5239594ejc.533.1611387004580; Fri, 22 Jan 2021 23:30:04 -0800 (PST) MIME-Version: 1.0 References: <202101221940.10MJeTcd061452@gitrepo.freebsd.org> In-Reply-To: <202101221940.10MJeTcd061452@gitrepo.freebsd.org> From: Antoine Brodin Date: Sat, 23 Jan 2021 08:29:55 +0100 Message-ID: Subject: Re: git: 86f33b5fcf60 - main - elfctl: allow features to be specified by value To: Ed Maste Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DN77f2mWBz3MCY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 07:30:06 -0000 On Fri, Jan 22, 2021 at 8:40 PM Ed Maste wrote: > > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=86f33b5fcf6087bf4439881011b920ff99e6e300 > > commit 86f33b5fcf6087bf4439881011b920ff99e6e300 > Author: Ed Maste > AuthorDate: 2021-01-22 17:22:35 +0000 > Commit: Ed Maste > CommitDate: 2021-01-22 19:38:52 +0000 > > elfctl: allow features to be specified by value > > This will allow elfctl on older releases to set bits that are not yet > known there, so that the binary will have the correct settings applied > if run on a later FreeBSD version. > > PR: 252629 (related) > Suggested by: kib > Reviewed by: gbe (manpage, earlier), kib > MFC after: 3 days > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D28284 This fails to build: --- all_subdir_usr.bin --- --- all_subdir_usr.bin/elfctl --- /usr/local/poudriere/jails/main-i386/usr/src/usr.bin/elfctl/elfctl.c:258:18: error: comparison of integers of different signs: 'long' and 'unsigned int' [-Werror,-Wsign-compare] --- all_subdir_lib --- --- powitf2.po --- --- all_subdir_usr.bin --- else if (val > UINT_MAX) ~~~ ^ ~~~~~~~~ --- all_subdir_lib --- Antoine From owner-dev-commits-src-main@freebsd.org Sat Jan 23 08:57:00 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B0C834EBF43; Sat, 23 Jan 2021 08:57:00 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DN93w4hKbz3hGX; Sat, 23 Jan 2021 08:57:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 938D264CA; Sat, 23 Jan 2021 08:57:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10N8v07Y094326; Sat, 23 Jan 2021 08:57:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10N8v06N094325; Sat, 23 Jan 2021 08:57:00 GMT (envelope-from git) Date: Sat, 23 Jan 2021 08:57:00 GMT Message-Id: <202101230857.10N8v06N094325@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Toomas Soome Subject: git: 6c789c55c4ba - main - loader: create built in font from bold font face MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6c789c55c4ba11014bfd1b59942c204615412ba6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 08:57:00 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=6c789c55c4ba11014bfd1b59942c204615412ba6 commit 6c789c55c4ba11014bfd1b59942c204615412ba6 Author: Toomas Soome AuthorDate: 2021-01-22 11:06:58 +0000 Commit: Toomas Soome CommitDate: 2021-01-23 08:53:30 +0000 loader: create built in font from bold font face We did replace full version of default font 8x16v with bold, also use bold version for built in font. --- stand/efi/loader/Makefile | 2 +- stand/i386/loader/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile index f7032c78926d..dd25c940e0e9 100644 --- a/stand/efi/loader/Makefile +++ b/stand/efi/loader/Makefile @@ -87,7 +87,7 @@ VERSION_FILE= ${.CURDIR}/../loader/version CLEANFILES+= 8x16.c -8x16.c: ${SRCTOP}/contrib/terminus/ter-u16v.bdf +8x16.c: ${SRCTOP}/contrib/terminus/ter-u16b.bdf vtfontcvt -f compressed-source -o ${.TARGET} ${.ALLSRC} FILES+= ${LOADER}.efi diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index e80e19dfb9e6..ad95948ec50a 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -70,7 +70,7 @@ CFLAGS+= -I${BOOTSRC}/i386 #CFLAGS+= -g #LDFLAGS+= -g -8x16.c: ${SRCTOP}/contrib/terminus/ter-u16v.bdf +8x16.c: ${SRCTOP}/contrib/terminus/ter-u16b.bdf vtfontcvt -f compressed-source -o ${.TARGET} ${.ALLSRC} ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} From owner-dev-commits-src-main@freebsd.org Sat Jan 23 13:51:37 2021 Return-Path: Delivered-To: dev-commits-src-main@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 125984F454A; Sat, 23 Jan 2021 13:51:37 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNHbr6xDrz4W3W; Sat, 23 Jan 2021 13:51:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0F7212813; Sat, 23 Jan 2021 13:51:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NDpa8V084750; Sat, 23 Jan 2021 13:51:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NDpa5G084749; Sat, 23 Jan 2021 13:51:36 GMT (envelope-from git) Date: Sat, 23 Jan 2021 13:51:36 GMT Message-Id: <202101231351.10NDpa5G084749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: bfd75d455719 - main - axgbe: fix some link related issues MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bfd75d45571958398a043517060d8c3d352e7dbd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 13:51:37 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=bfd75d45571958398a043517060d8c3d352e7dbd commit bfd75d45571958398a043517060d8c3d352e7dbd Author: Vincenzo Maffione AuthorDate: 2021-01-23 13:44:24 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-23 13:51:29 +0000 axgbe: fix some link related issues By default, axgbe driver does a receiver reset after predefined number of retries for the link to come up. However, this receiver reset doesn't always suffice, due to an hardware issue. In that case, as a workaround, a complete phy reset is necessary. This patch introduces a sysctl that can be set to 1 to let the driver reset the phy completely, rather than just doing receiver reset. The workaround will be removed once the issue is fixed by means of firmware update. This patch also fixes the handling of the direct attach cables properly. Submitted by: rajesh1.kumar_amd.com Differential Revision: https://reviews.freebsd.org/D28266 --- sys/dev/axgbe/xgbe-phy-v2.c | 26 ++++++++++++++++++++------ sys/dev/axgbe/xgbe-sysctl.c | 4 ++++ sys/dev/axgbe/xgbe.h | 1 + 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/sys/dev/axgbe/xgbe-phy-v2.c b/sys/dev/axgbe/xgbe-phy-v2.c index 5fb6e960eab5..df8a75a145b9 100644 --- a/sys/dev/axgbe/xgbe-phy-v2.c +++ b/sys/dev/axgbe/xgbe-phy-v2.c @@ -213,6 +213,9 @@ enum xgbe_sfp_speed { #define XGBE_SFP_BASE_EXT_ID 1 #define XGBE_SFP_EXT_ID_SFP 0x04 +#define XGBE_SFP_BASE_CV 2 +#define XGBE_SFP_BASE_CV_CP 0x21 + #define XGBE_SFP_BASE_10GBE_CC 3 #define XGBE_SFP_BASE_10GBE_CC_SR BIT(4) #define XGBE_SFP_BASE_10GBE_CC_LR BIT(5) @@ -380,6 +383,7 @@ struct xgbe_phy_data { }; static enum xgbe_an_mode xgbe_phy_an_mode(struct xgbe_prv_data *pdata); +static int xgbe_phy_reset(struct xgbe_prv_data *pdata); static int xgbe_phy_i2c_xfer(struct xgbe_prv_data *pdata, struct xgbe_i2c_op *i2c_op) @@ -1209,8 +1213,16 @@ xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata) } else phy_data->sfp_cable = XGBE_SFP_CABLE_ACTIVE; - /* Determine the type of SFP */ - if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR) + /* + * Determine the type of SFP. Certain 10G SFP+ modules read as + * 1000BASE-CX. To prevent 10G DAC cables to be recognized as + * 1G, we first check if it is a DAC and the bitrate is 10G. + */ + if (((sfp_base[XGBE_SFP_BASE_CV] & XGBE_SFP_BASE_CV_CP) || + (phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE)) && + xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000)) + phy_data->sfp_base = XGBE_SFP_BASE_10000_CR; + else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_SR) phy_data->sfp_base = XGBE_SFP_BASE_10000_SR; else if (sfp_base[XGBE_SFP_BASE_10GBE_CC] & XGBE_SFP_BASE_10GBE_CC_LR) phy_data->sfp_base = XGBE_SFP_BASE_10000_LR; @@ -1226,9 +1238,6 @@ xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata) phy_data->sfp_base = XGBE_SFP_BASE_1000_CX; else if (sfp_base[XGBE_SFP_BASE_1GBE_CC] & XGBE_SFP_BASE_1GBE_CC_T) phy_data->sfp_base = XGBE_SFP_BASE_1000_T; - else if ((phy_data->sfp_cable == XGBE_SFP_CABLE_PASSIVE) && - xgbe_phy_sfp_bit_rate(sfp_eeprom, XGBE_SFP_SPEED_10000)) - phy_data->sfp_base = XGBE_SFP_BASE_10000_CR; switch (phy_data->sfp_base) { case XGBE_SFP_BASE_1000_T: @@ -2879,7 +2888,12 @@ xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart) axgbe_printf(1, "ENTERED RRC: rrc_count: %d\n", phy_data->rrc_count); phy_data->rrc_count = 0; - xgbe_phy_rrc(pdata); + if (pdata->link_workaround) { + ret = xgbe_phy_reset(pdata); + if (ret) + axgbe_error("Error resetting phy\n"); + } else + xgbe_phy_rrc(pdata); } return (0); diff --git a/sys/dev/axgbe/xgbe-sysctl.c b/sys/dev/axgbe/xgbe-sysctl.c index a3e777e0ca26..f7998b943b16 100644 --- a/sys/dev/axgbe/xgbe-sysctl.c +++ b/sys/dev/axgbe/xgbe-sysctl.c @@ -1618,6 +1618,10 @@ axgbe_sysctl_init(struct xgbe_prv_data *pdata) CTLFLAG_RDTUN, &pdata->sph_enable, 1, "shows the split header feature state (1 - enable, 0 - disable"); + SYSCTL_ADD_UINT(clist, top, OID_AUTO, "link_workaround", + CTLFLAG_RWTUN, &pdata->link_workaround, 0, + "enable the workaround for link issue in coming up"); + SYSCTL_ADD_PROC(clist, top, OID_AUTO, "xgmac_register", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, pdata, 0, sysctl_xgmac_reg_addr_handler, "IU", diff --git a/sys/dev/axgbe/xgbe.h b/sys/dev/axgbe/xgbe.h index 766c0c6f551a..85b4c0c5c5d0 100644 --- a/sys/dev/axgbe/xgbe.h +++ b/sys/dev/axgbe/xgbe.h @@ -1302,6 +1302,7 @@ struct xgbe_prv_data { * This requires a complete restart. */ unsigned int sph_enable; + unsigned int link_workaround; }; struct axgbe_if_softc { From owner-dev-commits-src-main@freebsd.org Sat Jan 23 15:04:56 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D797B4F5841; Sat, 23 Jan 2021 15:04:56 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNKDS5np0z4YdJ; Sat, 23 Jan 2021 15:04:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B59691364F; Sat, 23 Jan 2021 15:04:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NF4uOl076388; Sat, 23 Jan 2021 15:04:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NF4uka076387; Sat, 23 Jan 2021 15:04:56 GMT (envelope-from git) Date: Sat, 23 Jan 2021 15:04:56 GMT Message-Id: <202101231504.10NF4uka076387@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 739ecbcf1c4f - main - cache: add symlink support to lockless lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 739ecbcf1c4fd22b5f6ee0bb180a67644046a3e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 15:04:56 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=739ecbcf1c4fd22b5f6ee0bb180a67644046a3e0 commit 739ecbcf1c4fd22b5f6ee0bb180a67644046a3e0 Author: Mateusz Guzik AuthorDate: 2021-01-23 13:40:48 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-23 15:04:43 +0000 cache: add symlink support to lockless lookup Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D27488 --- sys/fs/deadfs/dead_vnops.c | 1 + sys/kern/vfs_cache.c | 214 ++++++++++++++++++++++++++++++++++++++------- sys/kern/vfs_lookup.c | 11 ++- sys/kern/vfs_subr.c | 13 +++ sys/kern/vnode_if.src | 10 +++ sys/sys/namei.h | 4 +- sys/sys/param.h | 2 +- sys/sys/vnode.h | 9 ++ 8 files changed, 227 insertions(+), 37 deletions(-) diff --git a/sys/fs/deadfs/dead_vnops.c b/sys/fs/deadfs/dead_vnops.c index 49f852791387..09c3c996ee0e 100644 --- a/sys/fs/deadfs/dead_vnops.c +++ b/sys/fs/deadfs/dead_vnops.c @@ -80,6 +80,7 @@ struct vop_vector dead_vnodeops = { .vop_unset_text = dead_unset_text, .vop_write = dead_write, .vop_fplookup_vexec = VOP_EOPNOTSUPP, + .vop_fplookup_symlink = VOP_EAGAIN, }; VFS_VOP_VECTOR_REGISTER(dead_vnodeops); diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index cfa25dc59ee4..770c8ebf061b 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -562,6 +562,36 @@ static uma_zone_t __read_mostly cache_zone_small_ts; static uma_zone_t __read_mostly cache_zone_large; static uma_zone_t __read_mostly cache_zone_large_ts; +char * +cache_symlink_alloc(size_t size, int flags) +{ + + if (size < CACHE_ZONE_SMALL_SIZE) { + return (uma_zalloc_smr(cache_zone_small, flags)); + } + if (size < CACHE_ZONE_LARGE_SIZE) { + return (uma_zalloc_smr(cache_zone_large, flags)); + } + return (NULL); +} + +void +cache_symlink_free(char *string, size_t size) +{ + + MPASS(string != NULL); + + if (size < CACHE_ZONE_SMALL_SIZE) { + uma_zfree_smr(cache_zone_small, string); + return; + } + if (size < CACHE_ZONE_LARGE_SIZE) { + uma_zfree_smr(cache_zone_large, string); + return; + } + __assert_unreachable(); +} + static struct namecache * cache_alloc_uma(int len, bool ts) { @@ -3584,6 +3614,7 @@ cache_fast_lookup_enabled_recalc(void) #ifdef MAC mac_on = mac_vnode_check_lookup_enabled(); + mac_on |= mac_vnode_check_readlink_enabled(); #else mac_on = 0; #endif @@ -3615,6 +3646,7 @@ SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MP * need restoring in case fast path lookup fails. */ struct nameidata_outer { + size_t ni_pathlen; int cn_flags; }; @@ -3656,8 +3688,10 @@ static bool cache_fplookup_is_mp(struct cache_fpl *fpl); static int cache_fplookup_cross_mount(struct cache_fpl *fpl); static int cache_fplookup_partial_setup(struct cache_fpl *fpl); static int cache_fplookup_skip_slashes(struct cache_fpl *fpl); +static int cache_fplookup_preparse(struct cache_fpl *fpl); static void cache_fpl_pathlen_dec(struct cache_fpl *fpl); static void cache_fpl_pathlen_inc(struct cache_fpl *fpl); +static void cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n); static void cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n); static void @@ -3698,6 +3732,7 @@ static void cache_fpl_checkpoint_outer(struct cache_fpl *fpl) { + fpl->snd_outer.ni_pathlen = fpl->ndp->ni_pathlen; fpl->snd_outer.cn_flags = fpl->ndp->ni_cnd.cn_flags; } @@ -3731,6 +3766,7 @@ cache_fpl_restore_abort(struct cache_fpl *fpl) */ fpl->ndp->ni_resflags = 0; fpl->ndp->ni_cnd.cn_nameptr = fpl->ndp->ni_cnd.cn_pnbuf; + fpl->ndp->ni_pathlen = fpl->snd_outer.ni_pathlen; } #ifdef INVARIANTS @@ -3752,6 +3788,7 @@ cache_fpl_assert_status(struct cache_fpl *fpl) case CACHE_FPL_STATUS_UNSET: __assert_unreachable(); break; + case CACHE_FPL_STATUS_DESTROYED: case CACHE_FPL_STATUS_ABORTED: case CACHE_FPL_STATUS_PARTIAL: case CACHE_FPL_STATUS_HANDLED: @@ -3804,6 +3841,11 @@ cache_fpl_aborted_early_impl(struct cache_fpl *fpl, int line) static int __noinline cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) { + struct nameidata *ndp; + struct componentname *cnp; + + ndp = fpl->ndp; + cnp = fpl->cnp; if (fpl->status != CACHE_FPL_STATUS_UNSET) { KASSERT(fpl->status == CACHE_FPL_STATUS_PARTIAL, @@ -3815,6 +3857,14 @@ cache_fpl_aborted_impl(struct cache_fpl *fpl, int line) if (fpl->in_smr) cache_fpl_smr_exit(fpl); cache_fpl_restore_abort(fpl); + /* + * Resolving symlinks overwrites data passed by the caller. + * Let namei know. + */ + if (ndp->ni_loopcnt > 0) { + fpl->status = CACHE_FPL_STATUS_DESTROYED; + cache_fpl_cleanup_cnp(cnp); + } return (CACHE_FPL_FAILED); } @@ -3955,13 +4005,6 @@ cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp) return (0); } -static bool -cache_fplookup_vnode_supported(struct vnode *vp) -{ - - return (vp->v_type != VLNK); -} - static int __noinline cache_fplookup_negative_promote(struct cache_fpl *fpl, struct namecache *oncp, uint32_t hash) @@ -4242,8 +4285,7 @@ cache_fplookup_final_modifying(struct cache_fpl *fpl) * Since we expect this to be the terminal vnode it should * almost never be true. */ - if (__predict_false(!cache_fplookup_vnode_supported(tvp) || - cache_fplookup_is_mp(fpl))) { + if (__predict_false(tvp->v_type == VLNK || cache_fplookup_is_mp(fpl))) { vput(dvp); vput(tvp); return (cache_fpl_aborted(fpl)); @@ -4546,8 +4588,7 @@ cache_fplookup_noentry(struct cache_fpl *fpl) return (cache_fpl_handled(fpl)); } - if (__predict_false(!cache_fplookup_vnode_supported(tvp) || - cache_fplookup_is_mp(fpl))) { + if (__predict_false(tvp->v_type == VLNK || cache_fplookup_is_mp(fpl))) { vput(dvp); vput(tvp); return (cache_fpl_aborted(fpl)); @@ -4688,6 +4729,102 @@ cache_fplookup_neg(struct cache_fpl *fpl, struct namecache *ncp, uint32_t hash) return (cache_fpl_handled_error(fpl, ENOENT)); } +/* + * Resolve a symlink. Called by filesystem-specific routines. + * + * Code flow is: + * ... -> cache_fplookup_symlink -> VOP_FPLOOKUP_SYMLINK -> cache_symlink_resolve + */ +int +cache_symlink_resolve(struct cache_fpl *fpl, const char *string, size_t len) +{ + struct nameidata *ndp; + struct componentname *cnp; + + ndp = fpl->ndp; + cnp = fpl->cnp; + + if (__predict_false(len == 0)) { + return (ENOENT); + } + + ndp->ni_pathlen = fpl->nulchar - cnp->cn_nameptr - cnp->cn_namelen + 1; +#ifdef INVARIANTS + if (ndp->ni_pathlen != fpl->debug.ni_pathlen) { + panic("%s: mismatch (%zu != %zu) nulchar %p nameptr %p [%s] ; full string [%s]\n", + __func__, ndp->ni_pathlen, fpl->debug.ni_pathlen, fpl->nulchar, + cnp->cn_nameptr, cnp->cn_nameptr, cnp->cn_pnbuf); + } +#endif + + if (__predict_false(len + ndp->ni_pathlen > MAXPATHLEN)) { + return (ENAMETOOLONG); + } + + if (__predict_false(ndp->ni_loopcnt++ >= MAXSYMLINKS)) { + return (ELOOP); + } + + if (ndp->ni_pathlen > 1) { + bcopy(ndp->ni_next, cnp->cn_pnbuf + len, ndp->ni_pathlen); + } else { + cnp->cn_pnbuf[len] = '\0'; + } + bcopy(string, cnp->cn_pnbuf, len); + + ndp->ni_pathlen += len; + cache_fpl_pathlen_add(fpl, len); + cnp->cn_nameptr = cnp->cn_pnbuf; + fpl->nulchar = &cnp->cn_nameptr[ndp->ni_pathlen - 1]; + + return (0); +} + +static int __noinline +cache_fplookup_symlink(struct cache_fpl *fpl) +{ + struct nameidata *ndp; + struct componentname *cnp; + struct vnode *dvp, *tvp; + int error; + + ndp = fpl->ndp; + cnp = fpl->cnp; + dvp = fpl->dvp; + tvp = fpl->tvp; + + if (cache_fpl_islastcn(ndp)) { + if ((cnp->cn_flags & FOLLOW) == 0) { + return (cache_fplookup_final(fpl)); + } + } + + error = VOP_FPLOOKUP_SYMLINK(tvp, fpl); + if (__predict_false(error != 0)) { + switch (error) { + case EAGAIN: + return (cache_fpl_partial(fpl)); + case ENOENT: + case ENAMETOOLONG: + case ELOOP: + cache_fpl_smr_exit(fpl); + return (cache_fpl_handled_error(fpl, error)); + default: + return (cache_fpl_aborted(fpl)); + } + } + + if (*(cnp->cn_nameptr) == '/') { + fpl->dvp = cache_fpl_handle_root(fpl); + fpl->dvp_seqc = vn_seqc_read_any(fpl->dvp); + if (seqc_in_modify(fpl->dvp_seqc)) { + return (cache_fpl_aborted(fpl)); + } + } + + return (cache_fplookup_preparse(fpl)); +} + static int cache_fplookup_next(struct cache_fpl *fpl) { @@ -4743,10 +4880,6 @@ cache_fplookup_next(struct cache_fpl *fpl) return (cache_fpl_partial(fpl)); } - if (!cache_fplookup_vnode_supported(tvp)) { - return (cache_fpl_partial(fpl)); - } - counter_u64_add(numposhits, 1); SDT_PROBE3(vfs, namecache, lookup, hit, dvp, ncp->nc_name, tvp); @@ -4931,7 +5064,16 @@ static void cache_fpl_pathlen_inc(struct cache_fpl *fpl) { - fpl->debug.ni_pathlen++; + cache_fpl_pathlen_add(fpl, 1); +} + +static void +cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) +{ + + fpl->debug.ni_pathlen += n; + KASSERT(fpl->debug.ni_pathlen <= PATH_MAX, + ("%s: pathlen overflow to %zd\n", __func__, fpl->debug.ni_pathlen)); } static void @@ -4953,13 +5095,18 @@ cache_fpl_pathlen_inc(struct cache_fpl *fpl) { } +static void +cache_fpl_pathlen_add(struct cache_fpl *fpl, size_t n) +{ +} + static void cache_fpl_pathlen_sub(struct cache_fpl *fpl, size_t n) { } #endif -static int +static int __always_inline cache_fplookup_preparse(struct cache_fpl *fpl) { struct componentname *cnp; @@ -5238,8 +5385,6 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) return (cache_fpl_aborted(fpl)); } - VNPASS(cache_fplookup_vnode_supported(fpl->dvp), fpl->dvp); - error = cache_fplookup_preparse(fpl); if (__predict_false(cache_fpl_terminated(fpl))) { return (error); @@ -5251,8 +5396,6 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) break; } - VNPASS(cache_fplookup_vnode_supported(fpl->dvp), fpl->dvp); - error = VOP_FPLOOKUP_VEXEC(fpl->dvp, cnp->cn_cred); if (__predict_false(error != 0)) { error = cache_fplookup_failed_vexec(fpl, error); @@ -5266,20 +5409,27 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) VNPASS(!seqc_in_modify(fpl->tvp_seqc), fpl->tvp); - if (cache_fpl_islastcn(ndp)) { - error = cache_fplookup_final(fpl); - break; - } + if (fpl->tvp->v_type == VLNK) { + error = cache_fplookup_symlink(fpl); + if (cache_fpl_terminated(fpl)) { + break; + } + } else { + if (cache_fpl_islastcn(ndp)) { + error = cache_fplookup_final(fpl); + break; + } - if (!vn_seqc_consistent(fpl->dvp, fpl->dvp_seqc)) { - error = cache_fpl_aborted(fpl); - break; - } + if (!vn_seqc_consistent(fpl->dvp, fpl->dvp_seqc)) { + error = cache_fpl_aborted(fpl); + break; + } - fpl->dvp = fpl->tvp; - fpl->dvp_seqc = fpl->tvp_seqc; + fpl->dvp = fpl->tvp; + fpl->dvp_seqc = fpl->tvp_seqc; + cache_fplookup_parse_advance(fpl); + } - cache_fplookup_parse_advance(fpl); cache_fpl_checkpoint(fpl); } diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index b6529623ecbb..ad65ab11bb1d 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -578,6 +578,7 @@ namei(struct nameidata *ndp) ndp->ni_startdir->v_type == VBAD); ndp->ni_lcf = 0; + ndp->ni_loopcnt = 0; ndp->ni_vp = NULL; error = namei_getpath(ndp); @@ -611,8 +612,16 @@ namei(struct nameidata *ndp) TAILQ_INIT(&ndp->ni_cap_tracker); dp = ndp->ni_startdir; break; + case CACHE_FPL_STATUS_DESTROYED: + ndp->ni_loopcnt = 0; + error = namei_getpath(ndp); + if (__predict_false(error != 0)) { + return (error); + } + /* FALLTHROUGH */ case CACHE_FPL_STATUS_ABORTED: TAILQ_INIT(&ndp->ni_cap_tracker); + MPASS(ndp->ni_lcf == 0); error = namei_setup(ndp, &dp, &pwd); if (error != 0) { namei_cleanup_cnp(cnp); @@ -621,8 +630,6 @@ namei(struct nameidata *ndp) break; } - ndp->ni_loopcnt = 0; - /* * Locked lookup. */ diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 8461fd0d49b5..047e4c54f0c5 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -5452,6 +5452,19 @@ vop_fplookup_vexec_debugpost(void *ap __unused, int rc __unused) VFS_SMR_ASSERT_ENTERED(); } +void +vop_fplookup_symlink_debugpre(void *ap __unused) +{ + + VFS_SMR_ASSERT_ENTERED(); +} + +void +vop_fplookup_symlink_debugpost(void *ap __unused, int rc __unused) +{ + + VFS_SMR_ASSERT_ENTERED(); +} void vop_strategy_debugpre(void *ap) { diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index ed6f3bf9d61b..5d15d4a0c863 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -156,6 +156,16 @@ vop_fplookup_vexec { }; +%% fplookup_symlink vp - - - +%! fplookup_symlink debugpre vop_fplookup_symlink_debugpre +%! fplookup_symlink debugpost vop_fplookup_symlink_debugpost + +vop_fplookup_symlink { + IN struct vnode *vp; + IN struct cache_fpl *fpl; +}; + + %% access vp L L L vop_access { diff --git a/sys/sys/namei.h b/sys/sys/namei.h index c045bc7c6bc5..1f9bae9e2753 100644 --- a/sys/sys/namei.h +++ b/sys/sys/namei.h @@ -116,8 +116,8 @@ struct nameidata { #ifdef _KERNEL -enum cache_fpl_status { CACHE_FPL_STATUS_ABORTED, CACHE_FPL_STATUS_PARTIAL, - CACHE_FPL_STATUS_HANDLED, CACHE_FPL_STATUS_UNSET }; +enum cache_fpl_status { CACHE_FPL_STATUS_DESTROYED, CACHE_FPL_STATUS_ABORTED, + CACHE_FPL_STATUS_PARTIAL, CACHE_FPL_STATUS_HANDLED, CACHE_FPL_STATUS_UNSET }; int cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, struct pwd **pwdp); diff --git a/sys/sys/param.h b/sys/sys/param.h index 19d6d3fb2d35..f540b240e848 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400000 /* Master, propagated to newvers */ +#define __FreeBSD_version 1400001 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 0eadfec02313..ffd0bdad940d 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -66,6 +66,7 @@ enum vgetstate { VGET_NONE, VGET_HOLDCNT, VGET_USECOUNT }; */ struct namecache; +struct cache_fpl; struct vpollinfo { struct mtx vpi_lock; /* lock to protect below */ @@ -646,6 +647,10 @@ void cache_purge(struct vnode *vp); void cache_purge_vgone(struct vnode *vp); void cache_purge_negative(struct vnode *vp); void cache_purgevfs(struct mount *mp); +char *cache_symlink_alloc(size_t size, int flags); +void cache_symlink_free(char *string, size_t size); +int cache_symlink_resolve(struct cache_fpl *fpl, const char *string, + size_t len); void cache_vop_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp); void cache_vop_rmdir(struct vnode *dvp, struct vnode *vp); @@ -900,6 +905,8 @@ int vop_sigdefer(struct vop_vector *vop, struct vop_generic_args *a); #ifdef DEBUG_VFS_LOCKS void vop_fplookup_vexec_debugpre(void *a); void vop_fplookup_vexec_debugpost(void *a, int rc); +void vop_fplookup_symlink_debugpre(void *a); +void vop_fplookup_symlink_debugpost(void *a, int rc); void vop_strategy_debugpre(void *a); void vop_lock_debugpre(void *a); void vop_lock_debugpost(void *a, int rc); @@ -910,6 +917,8 @@ void vop_mkdir_debugpost(void *a, int rc); #else #define vop_fplookup_vexec_debugpre(x) do { } while (0) #define vop_fplookup_vexec_debugpost(x, y) do { } while (0) +#define vop_fplookup_symlink_debugpre(x) do { } while (0) +#define vop_fplookup_symlink_debugpost(x, y) do { } while (0) #define vop_strategy_debugpre(x) do { } while (0) #define vop_lock_debugpre(x) do { } while (0) #define vop_lock_debugpost(x, y) do { } while (0) From owner-dev-commits-src-main@freebsd.org Sat Jan 23 15:04:57 2021 Return-Path: Delivered-To: dev-commits-src-main@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 EFC0F4F591E; Sat, 23 Jan 2021 15:04:57 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNKDT6RwDz4Ynr; Sat, 23 Jan 2021 15:04:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CED34130F9; Sat, 23 Jan 2021 15:04:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NF4vQC076407; Sat, 23 Jan 2021 15:04:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NF4vPX076406; Sat, 23 Jan 2021 15:04:57 GMT (envelope-from git) Date: Sat, 23 Jan 2021 15:04:57 GMT Message-Id: <202101231504.10NF4vPX076406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: c892d60a1d3e - main - ufs: denote lack of support for lockless symlink lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c892d60a1d3e11c7e0651705bc4167b218a7415c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 15:04:58 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c892d60a1d3e11c7e0651705bc4167b218a7415c commit c892d60a1d3e11c7e0651705bc4167b218a7415c Author: Mateusz Guzik AuthorDate: 2021-01-23 13:42:16 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-23 15:04:43 +0000 ufs: denote lack of support for lockless symlink lookup It is unclear without investigating if it can be provided without using extra memory, so for the time being just don't. --- sys/ufs/ufs/ufs_vnops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index a3f790e16685..0e7ec7ae5453 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2963,6 +2963,7 @@ struct vop_vector ufs_vnodeops = { .vop_accessx = ufs_accessx, .vop_bmap = ufs_bmap, .vop_fplookup_vexec = ufs_fplookup_vexec, + .vop_fplookup_symlink = VOP_EAGAIN, .vop_cachedlookup = ufs_lookup, .vop_close = ufs_close, .vop_create = ufs_create, From owner-dev-commits-src-main@freebsd.org Sat Jan 23 15:04:59 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2D06B4F536C; Sat, 23 Jan 2021 15:04:59 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNKDW0cqJz4YZZ; Sat, 23 Jan 2021 15:04:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 073E313363; Sat, 23 Jan 2021 15:04:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NF4w5c076429; Sat, 23 Jan 2021 15:04:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NF4wQP076428; Sat, 23 Jan 2021 15:04:58 GMT (envelope-from git) Date: Sat, 23 Jan 2021 15:04:58 GMT Message-Id: <202101231504.10NF4wQP076428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 618029af508b - main - tmpfs: add support for lockless symlink lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 618029af508be2c01a84162c1bad02bfd000db27 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 15:04:59 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=618029af508be2c01a84162c1bad02bfd000db27 commit 618029af508be2c01a84162c1bad02bfd000db27 Author: Mateusz Guzik AuthorDate: 2021-01-23 13:45:01 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-23 15:04:43 +0000 tmpfs: add support for lockless symlink lookup Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D27488 --- sys/fs/tmpfs/tmpfs.h | 8 ++++++-- sys/fs/tmpfs/tmpfs_subr.c | 50 ++++++++++++++++++++++++++++++++++++++++++---- sys/fs/tmpfs/tmpfs_vnops.c | 30 +++++++++++++++++++++++++++- 3 files changed, 81 insertions(+), 7 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 811df5b2936f..28493a550252 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -277,7 +277,10 @@ struct tmpfs_node { /* Valid when tn_type == VLNK. */ /* The link's target, allocated from a string pool. */ - char * tn_link; /* (c) */ + struct tn_link { + char * tn_link_target; /* (c) */ + char tn_link_smr; /* (c) */ + } tn_link; /* Valid when tn_type == VREG. */ struct tn_reg { @@ -300,7 +303,8 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); #define tn_rdev tn_spec.tn_rdev #define tn_dir tn_spec.tn_dir -#define tn_link tn_spec.tn_link +#define tn_link_target tn_spec.tn_link.tn_link_target +#define tn_link_smr tn_spec.tn_link.tn_link_smr #define tn_reg tn_spec.tn_reg #define tn_fifo tn_spec.tn_fifo diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index c74981db0f58..07e7ea11ad6e 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -252,6 +252,8 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, { struct tmpfs_node *nnode; vm_object_t obj; + char *symlink; + char symlink_smr; /* If the root directory of the 'tmp' file system is not yet * allocated, this must be the request to do it. */ @@ -327,9 +329,41 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount *tmp, enum vtype type, case VLNK: MPASS(strlen(target) < MAXPATHLEN); nnode->tn_size = strlen(target); - nnode->tn_link = malloc(nnode->tn_size, M_TMPFSNAME, - M_WAITOK); - memcpy(nnode->tn_link, target, nnode->tn_size); + + symlink = NULL; + if (!tmp->tm_nonc) { + symlink = cache_symlink_alloc(nnode->tn_size + 1, M_WAITOK); + symlink_smr = true; + } + if (symlink == NULL) { + symlink = malloc(nnode->tn_size + 1, M_TMPFSNAME, M_WAITOK); + symlink_smr = false; + } + memcpy(symlink, target, nnode->tn_size + 1); + + /* + * Allow safe symlink resolving for lockless lookup. + * tmpfs_fplookup_symlink references this comment. + * + * 1. nnode is not yet visible to the world + * 2. both tn_link_target and tn_link_smr get populated + * 3. release fence publishes their content + * 4. tn_link_target content is immutable until node destruction, + * where the pointer gets set to NULL + * 5. tn_link_smr is never changed once set + * + * As a result it is sufficient to issue load consume on the node + * pointer to also get the above content in a stable manner. + * Worst case tn_link_smr flag may be set to true despite being stale, + * while the target buffer is already cleared out. + * + * TODO: Since there is no load consume primitive provided + * right now, the load is performed with an acquire fence. + */ + atomic_store_ptr((uintptr_t *)&nnode->tn_link_target, + (uintptr_t)symlink); + atomic_store_char((char *)&nnode->tn_link_smr, symlink_smr); + atomic_thread_fence_rel(); break; case VREG: @@ -382,6 +416,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node, bool detach) { vm_object_t uobj; + char *symlink; bool last; TMPFS_MP_ASSERT_LOCKED(tmp); @@ -417,7 +452,14 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node, break; case VLNK: - free(node->tn_link, M_TMPFSNAME); + symlink = node->tn_link_target; + atomic_store_ptr((uintptr_t *)&node->tn_link_target, + (uintptr_t)NULL); + if (atomic_load_char(&node->tn_link_smr)) { + cache_symlink_free(symlink, node->tn_size + 1); + } else { + free(symlink, M_TMPFSNAME); + } break; case VREG: diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 66568e07b4d7..c716b393efdd 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1444,13 +1444,40 @@ tmpfs_readlink(struct vop_readlink_args *v) node = VP_TO_TMPFS_NODE(vp); - error = uiomove(node->tn_link, MIN(node->tn_size, uio->uio_resid), + error = uiomove(node->tn_link_target, MIN(node->tn_size, uio->uio_resid), uio); tmpfs_set_accessed(VFS_TO_TMPFS(vp->v_mount), node); return (error); } +/* + * VOP_FPLOOKUP_SYMLINK routines are subject to special circumstances, see + * the comment above cache_fplookup for details. + * + * Check tmpfs_alloc_node for tmpfs-specific synchronisation notes. + */ +static int +tmpfs_fplookup_symlink(struct vop_fplookup_symlink_args *v) +{ + struct vnode *vp; + struct tmpfs_node *node; + char *symlink; + + vp = v->a_vp; + node = VP_TO_TMPFS_NODE_SMR(vp); + atomic_thread_fence_acq(); + if (__predict_false(node == NULL)) + return (EAGAIN); + if (!atomic_load_char(&node->tn_link_smr)) + return (EAGAIN); + symlink = atomic_load_ptr(&node->tn_link_target); + if (symlink == NULL) + return (EAGAIN); + + return (cache_symlink_resolve(v->a_fpl, symlink, node->tn_size)); +} + static int tmpfs_inactive(struct vop_inactive_args *v) { @@ -1807,6 +1834,7 @@ struct vop_vector tmpfs_vnodeop_entries = { .vop_open = tmpfs_open, .vop_close = tmpfs_close, .vop_fplookup_vexec = tmpfs_fplookup_vexec, + .vop_fplookup_symlink = tmpfs_fplookup_symlink, .vop_access = tmpfs_access, .vop_stat = tmpfs_stat, .vop_getattr = tmpfs_getattr, From owner-dev-commits-src-main@freebsd.org Sat Jan 23 15:05:00 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D0AAB4F58A3; Sat, 23 Jan 2021 15:05:00 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNKDX48FDz4Z2d; Sat, 23 Jan 2021 15:05:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18865133E4; Sat, 23 Jan 2021 15:05:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NF5000076451; Sat, 23 Jan 2021 15:05:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NF50Ko076450; Sat, 23 Jan 2021 15:05:00 GMT (envelope-from git) Date: Sat, 23 Jan 2021 15:05:00 GMT Message-Id: <202101231505.10NF50Ko076450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 3110d4ebd6c0 - main - zfs: add support for lockless symlink lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3110d4ebd6c0848cf5e25890d01791bb407e2a9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 15:05:01 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3110d4ebd6c0848cf5e25890d01791bb407e2a9b commit 3110d4ebd6c0848cf5e25890d01791bb407e2a9b Author: Mateusz Guzik AuthorDate: 2021-01-23 13:46:32 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-23 15:04:43 +0000 zfs: add support for lockless symlink lookup Reviewed by: kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D27488 --- .../include/os/freebsd/zfs/sys/zfs_znode_impl.h | 1 + .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 81 +++++++++++++++++++++- .../openzfs/module/os/freebsd/zfs/zfs_znode.c | 7 ++ 3 files changed, 86 insertions(+), 3 deletions(-) diff --git a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h index ac2625d9a8ab..091186f23174 100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h @@ -53,6 +53,7 @@ extern "C" { #define ZNODE_OS_FIELDS \ struct zfsvfs *z_zfsvfs; \ vnode_t *z_vnode; \ + char *z_cached_symlink; \ uint64_t z_uid; \ uint64_t z_gid; \ uint64_t z_gen; \ diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c index 2e8eadb5e16e..365c64a9479c 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c @@ -4463,6 +4463,31 @@ zfs_freebsd_fplookup_vexec(struct vop_fplookup_vexec_args *v) } #endif +#if __FreeBSD_version >= 1400001 +static int +zfs_freebsd_fplookup_symlink(struct vop_fplookup_symlink_args *v) +{ + vnode_t *vp; + znode_t *zp; + char *target; + + vp = v->a_vp; + zp = VTOZ_SMR(vp); + if (__predict_false(zp == NULL)) { + return (EAGAIN); + } + + /* + * FIXME: Load consume would be sufficient but there is no primitive to do it. + */ + target = (char *)atomic_load_acq_ptr((uintptr_t *)&zp->z_cached_symlink); + if (target == NULL) { + return (EAGAIN); + } + return (cache_symlink_resolve(v->a_fpl, target, strlen(target))); +} +#endif + #ifndef _SYS_SYSPROTO_H_ struct vop_access_args { struct vnode *a_vp; @@ -4949,6 +4974,8 @@ zfs_freebsd_symlink(struct vop_symlink_args *ap) struct componentname *cnp = ap->a_cnp; vattr_t *vap = ap->a_vap; znode_t *zp = NULL; + char *symlink; + size_t symlink_len; int rc; ASSERT(cnp->cn_flags & SAVENAME); @@ -4959,8 +4986,19 @@ zfs_freebsd_symlink(struct vop_symlink_args *ap) rc = zfs_symlink(VTOZ(ap->a_dvp), cnp->cn_nameptr, vap, ap->a_target, &zp, cnp->cn_cred, 0 /* flags */); - if (rc == 0) + if (rc == 0) { *ap->a_vpp = ZTOV(zp); + ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); + MPASS(zp->z_cached_symlink == NULL); + symlink_len = strlen(ap->a_target); + symlink = cache_symlink_alloc(symlink_len + 1, M_WAITOK); + if (symlink != NULL) { + memcpy(symlink, ap->a_target, symlink_len); + symlink[symlink_len] = '\0'; + atomic_store_rel_ptr((uintptr_t *)&zp->z_cached_symlink, + (uintptr_t)symlink); + } + } return (rc); } @@ -4975,8 +5013,36 @@ struct vop_readlink_args { static int zfs_freebsd_readlink(struct vop_readlink_args *ap) { - - return (zfs_readlink(ap->a_vp, ap->a_uio, ap->a_cred, NULL)); + znode_t *zp = VTOZ(ap->a_vp); + struct uio *auio; + char *symlink, *base; + size_t symlink_len; + int error; + bool trycache; + + auio = ap->a_uio; + trycache = false; + if (auio->uio_segflg == UIO_SYSSPACE && auio->uio_iovcnt == 1) { + base = auio->uio_iov->iov_base; + symlink_len = auio->uio_iov->iov_len; + trycache = true; + } + error = zfs_readlink(ap->a_vp, auio, ap->a_cred, NULL); + if (atomic_load_ptr(&zp->z_cached_symlink) != NULL || + error != 0 || !trycache) { + return (error); + } + symlink_len -= auio->uio_resid; + symlink = cache_symlink_alloc(symlink_len + 1, M_WAITOK); + if (symlink != NULL) { + memcpy(symlink, base, symlink_len); + symlink[symlink_len] = '\0'; + if (!atomic_cmpset_rel_ptr((uintptr_t *)&zp->z_cached_symlink, + (uintptr_t)NULL, (uintptr_t)symlink)) { + cache_symlink_free(symlink, symlink_len + 1); + } + } + return (error); } #ifndef _SYS_SYSPROTO_H_ @@ -5733,6 +5799,9 @@ struct vop_vector zfs_vnodeops = { .vop_reclaim = zfs_freebsd_reclaim, #if __FreeBSD_version >= 1300102 .vop_fplookup_vexec = zfs_freebsd_fplookup_vexec, +#endif +#if __FreeBSD_version >= 1400001 + .vop_fplookup_symlink = zfs_freebsd_fplookup_symlink, #endif .vop_access = zfs_freebsd_access, .vop_allocate = VOP_EINVAL, @@ -5782,6 +5851,9 @@ struct vop_vector zfs_fifoops = { .vop_fsync = zfs_freebsd_fsync, #if __FreeBSD_version >= 1300102 .vop_fplookup_vexec = zfs_freebsd_fplookup_vexec, +#endif +#if __FreeBSD_version >= 1400001 + .vop_fplookup_symlink = zfs_freebsd_fplookup_symlink, #endif .vop_access = zfs_freebsd_access, .vop_getattr = zfs_freebsd_getattr, @@ -5805,6 +5877,9 @@ struct vop_vector zfs_shareops = { .vop_default = &default_vnodeops, #if __FreeBSD_version >= 1300121 .vop_fplookup_vexec = VOP_EAGAIN, +#endif +#if __FreeBSD_version >= 1400001 + .vop_fplookup_symlink = VOP_EAGAIN, #endif .vop_access = zfs_freebsd_access, .vop_inactive = zfs_freebsd_inactive, diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c index 6a21623c5f67..f9a0820eda2d 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c @@ -444,6 +444,7 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz, zp->z_blksz = blksz; zp->z_seq = 0x7A4653; zp->z_sync_cnt = 0; + atomic_store_ptr((uintptr_t *)&zp->z_cached_symlink, (uintptr_t)NULL); vp = ZTOV(zp); @@ -1237,6 +1238,7 @@ void zfs_znode_free(znode_t *zp) { zfsvfs_t *zfsvfs = zp->z_zfsvfs; + char *symlink; ASSERT(zp->z_sa_hdl == NULL); zp->z_vnode = NULL; @@ -1245,6 +1247,11 @@ zfs_znode_free(znode_t *zp) list_remove(&zfsvfs->z_all_znodes, zp); zfsvfs->z_nr_znodes--; mutex_exit(&zfsvfs->z_znodes_lock); + symlink = atomic_load_ptr(&zp->z_cached_symlink); + if (symlink != NULL) { + atomic_store_rel_ptr((uintptr_t *)&zp->z_cached_symlink, (uintptr_t)NULL); + cache_symlink_free(symlink, strlen(symlink) + 1); + } if (zp->z_acl_cached) { zfs_acl_free(zp->z_acl_cached); From owner-dev-commits-src-main@freebsd.org Sat Jan 23 15:25:36 2021 Return-Path: Delivered-To: dev-commits-src-main@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 C4C254F5DDE; Sat, 23 Jan 2021 15:25:36 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNKhJ5CCCz4b0W; Sat, 23 Jan 2021 15:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A12C313B85; Sat, 23 Jan 2021 15:25:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NFPa6h002368; Sat, 23 Jan 2021 15:25:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NFPa3V002367; Sat, 23 Jan 2021 15:25:36 GMT (envelope-from git) Date: Sat, 23 Jan 2021 15:25:36 GMT Message-Id: <202101231525.10NFPa3V002367@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa8c1f8d84d2638a354e71f9593e978d00878243 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 15:25:36 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=aa8c1f8d84d2638a354e71f9593e978d00878243 commit aa8c1f8d84d2638a354e71f9593e978d00878243 Author: Konstantin Belousov AuthorDate: 2021-01-22 21:47:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-23 15:24:32 +0000 nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write Otherwise writing thread might wait on sbusy state of the pages which were busied by itself, similarly to nfs_read(). But also we need to clear NVNSETSZKSIP flag possibly set by ncl_pager_setsize(), to not undo extension done by write. Reported by: bdrewery Reviewed by: rmacklem Tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28306 --- sys/fs/nfsclient/nfs_clbio.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 09fedaa47eb8..7d0ff0abff3d 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -893,7 +893,7 @@ ncl_write(struct vop_write_args *ap) struct nfsmount *nmp = VFSTONFS(vp->v_mount); daddr_t lbn; int bcount, noncontig_write, obcount; - int bp_cached, n, on, error = 0, error1, wouldcommit; + int bp_cached, n, on, error = 0, error1, save2, wouldcommit; size_t orig_resid, local_resid; off_t orig_size, tmp_off; @@ -985,6 +985,7 @@ ncl_write(struct vop_write_args *ap) if (vn_rlimit_fsize(vp, uio, td)) return (EFBIG); + save2 = curthread_pflags2_set(TDP2_SBPAGES); biosize = vp->v_bufobj.bo_bsize; /* * Find all of this file's B_NEEDCOMMIT buffers. If our writes @@ -1023,7 +1024,7 @@ ncl_write(struct vop_write_args *ap) error = ncl_vinvalbuf(vp, V_SAVE | ((ioflag & IO_VMIO) != 0 ? V_VMIO : 0), td, 1); if (error != 0) - return (error); + goto out; wouldcommit = biosize; } } @@ -1063,6 +1064,7 @@ again: NFSLOCKNODE(np); np->n_size = uio->uio_offset + n; np->n_flag |= NMODIFIED; + np->n_flag &= ~NVNSETSZSKIP; vnode_pager_setsize(vp, np->n_size); NFSUNLOCKNODE(np); @@ -1092,6 +1094,7 @@ again: if (uio->uio_offset + n > np->n_size) { np->n_size = uio->uio_offset + n; np->n_flag |= NMODIFIED; + np->n_flag &= ~NVNSETSZSKIP; vnode_pager_setsize(vp, np->n_size); } NFSUNLOCKNODE(np); @@ -1281,6 +1284,13 @@ again: } } +out: + curthread_pflags2_restore(save2); + if ((curthread->td_pflags2 & TDP2_SBPAGES) == 0) { + NFSLOCKNODE(np); + ncl_pager_setsize(vp, NULL); + } + return (error); } From owner-dev-commits-src-main@freebsd.org Sat Jan 23 15:25:37 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D3F384F5E32; Sat, 23 Jan 2021 15:25:37 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNKhK5jlWz4b2m; Sat, 23 Jan 2021 15:25:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7356138B0; Sat, 23 Jan 2021 15:25:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NFPbBG002391; Sat, 23 Jan 2021 15:25:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NFPbIh002389; Sat, 23 Jan 2021 15:25:37 GMT (envelope-from git) Date: Sat, 23 Jan 2021 15:25:37 GMT Message-Id: <202101231525.10NFPbIh002389@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9940ac808de7 - main - elfctl: Fix type errors. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9940ac808de7b7d4ed0408c3e739f667dca06d3b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 15:25:37 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9940ac808de7b7d4ed0408c3e739f667dca06d3b commit 9940ac808de7b7d4ed0408c3e739f667dca06d3b Author: Konstantin Belousov AuthorDate: 2021-01-23 10:45:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-23 15:24:32 +0000 elfctl: Fix type errors. Target value for val has uint32_t type, not uint, adjust used constant. Change val type to unsigned so that left and right sides of comparision operator do not expose different signed types of same range [*]. Switch to unsigned long long and strtoll(3) so that 0x80000000 is accepted by conversion function [**]. Reported by: kargl [*] Noted by: emaste [**] Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28301 --- usr.bin/elfctl/elfctl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c index 300a66eb516e..bcdd1be394a9 100644 --- a/usr.bin/elfctl/elfctl.c +++ b/usr.bin/elfctl/elfctl.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -249,13 +250,13 @@ convert_to_feature_val(char *feature_str, uint32_t *feature_val) if (i == len) { if (isdigit(feature[0])) { char *eptr; - long val; + unsigned long long val; errno = 0; - val = strtol(feature, &eptr, 0); + val = strtoll(feature, &eptr, 0); if (eptr == feature || *eptr != '\0') errno = EINVAL; - else if (val > UINT_MAX) + else if (val > UINT32_MAX) errno = ERANGE; if (errno != 0) { warn("%s invalid", feature); From owner-dev-commits-src-main@freebsd.org Sat Jan 23 16:02:31 2021 Return-Path: Delivered-To: dev-commits-src-main@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 2337C4F6EC3; Sat, 23 Jan 2021 16:02:31 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNLVv0XY9z4dp4; Sat, 23 Jan 2021 16:02:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0552C141AE; Sat, 23 Jan 2021 16:02:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NG2Uv3053940; Sat, 23 Jan 2021 16:02:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NG2Ucx053939; Sat, 23 Jan 2021 16:02:30 GMT (envelope-from git) Date: Sat, 23 Jan 2021 16:02:30 GMT Message-Id: <202101231602.10NG2Ucx053939@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 519b64e27fdd - main - Revert "Define PNP info after defining driver modules" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 519b64e27fddf10c0b7f6a615edbad730b8c6c45 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 16:02:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=519b64e27fddf10c0b7f6a615edbad730b8c6c45 commit 519b64e27fddf10c0b7f6a615edbad730b8c6c45 Author: Mark Johnston AuthorDate: 2021-01-23 15:55:09 +0000 Commit: Mark Johnston CommitDate: 2021-01-23 15:59:41 +0000 Revert "Define PNP info after defining driver modules" This reverts commit aa37baf3d7cf51da92fd367476182802e71838ae. The reverted commit was motivated by a problem observed on stable/12, but it turns out that a better solution was committed in r348309 but not MFCed. So, revert this change since it is unnecessary and not really correct: it assumes that the order in which module metadata records is defined determines their order in the output linker set. While this seems to hold in my testing, it is not guaranteed. Reported by: cem Discussed with: imp MFC after: 3 days --- sys/arm/ti/am335x/am335x_dmtpps.c | 2 +- sys/arm/ti/am335x/am335x_ehrpwm.c | 2 +- sys/dev/gpio/gpioiic.c | 8 ++------ sys/dev/gpio/gpiopps.c | 2 +- sys/dev/gpio/gpioths.c | 6 ++---- sys/dev/iicbus/ads111x.c | 4 +--- sys/dev/iicbus/mux/iic_gpiomux.c | 8 ++------ sys/dev/iicbus/mux/ltc430x.c | 4 +++- sys/dev/iicbus/mux/pca9547.c | 2 +- sys/dev/ow/owc_gpiobus.c | 6 ++---- sys/dev/pwm/pwmc.c | 6 +++--- 11 files changed, 19 insertions(+), 31 deletions(-) diff --git a/sys/arm/ti/am335x/am335x_dmtpps.c b/sys/arm/ti/am335x/am335x_dmtpps.c index 414800fd011e..24d83f248eef 100644 --- a/sys/arm/ti/am335x/am335x_dmtpps.c +++ b/sys/arm/ti/am335x/am335x_dmtpps.c @@ -96,6 +96,7 @@ static struct ofw_compat_data compat_data[] = { {"ti,am335x-timer-1ms", 1}, {NULL, 0}, }; +SIMPLEBUS_PNP_INFO(compat_data); /* * A table relating pad names to the hardware timer number they can be mux'd to. @@ -617,5 +618,4 @@ static driver_t dmtpps_driver = { static devclass_t dmtpps_devclass; DRIVER_MODULE(am335x_dmtpps, simplebus, dmtpps_driver, dmtpps_devclass, 0, 0); -SIMPLEBUS_PNP_INFO(compat_data); MODULE_DEPEND(am335x_dmtpps, ti_sysc, 1, 1, 1); diff --git a/sys/arm/ti/am335x/am335x_ehrpwm.c b/sys/arm/ti/am335x/am335x_ehrpwm.c index 6fd709d120e6..619fdae2bcdb 100644 --- a/sys/arm/ti/am335x/am335x_ehrpwm.c +++ b/sys/arm/ti/am335x/am335x_ehrpwm.c @@ -199,6 +199,7 @@ static struct ofw_compat_data compat_data[] = { {"ti,am33xx-ehrpwm", true}, {NULL, false}, }; +SIMPLEBUS_PNP_INFO(compat_data); static void am335x_ehrpwm_cfg_duty(struct am335x_ehrpwm_softc *sc, u_int chan, u_int duty) @@ -712,7 +713,6 @@ static driver_t am335x_ehrpwm_driver = { static devclass_t am335x_ehrpwm_devclass; DRIVER_MODULE(am335x_ehrpwm, am335x_pwmss, am335x_ehrpwm_driver, am335x_ehrpwm_devclass, 0, 0); -SIMPLEBUS_PNP_INFO(compat_data); MODULE_VERSION(am335x_ehrpwm, 1); MODULE_DEPEND(am335x_ehrpwm, am335x_pwmss, 1, 1, 1); MODULE_DEPEND(am335x_ehrpwm, pwmbus, 1, 1, 1); diff --git a/sys/dev/gpio/gpioiic.c b/sys/dev/gpio/gpioiic.c index f387252098e2..6d62a6d04d95 100644 --- a/sys/dev/gpio/gpioiic.c +++ b/sys/dev/gpio/gpioiic.c @@ -65,6 +65,8 @@ static struct ofw_compat_data compat_data[] = { {"gpioiic", true}, /* Deprecated old freebsd compat string */ {NULL, false} }; +OFWBUS_PNP_INFO(compat_data); +SIMPLEBUS_PNP_INFO(compat_data); static phandle_t gpioiic_get_node(device_t bus, device_t dev) @@ -368,13 +370,7 @@ static driver_t gpioiic_driver = { }; DRIVER_MODULE(gpioiic, gpiobus, gpioiic_driver, gpioiic_devclass, 0, 0); -#ifdef FDT -OFWBUS_PNP_INFO(compat_data); -#endif DRIVER_MODULE(gpioiic, simplebus, gpioiic_driver, gpioiic_devclass, 0, 0); -#ifdef FDT -SIMPLEBUS_PNP_INFO(compat_data); -#endif DRIVER_MODULE(iicbb, gpioiic, iicbb_driver, iicbb_devclass, 0, 0); MODULE_DEPEND(gpioiic, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER); MODULE_DEPEND(gpioiic, gpiobus, 1, 1, 1); diff --git a/sys/dev/gpio/gpiopps.c b/sys/dev/gpio/gpiopps.c index ea2644088c5d..8a6f1a6a3f6b 100644 --- a/sys/dev/gpio/gpiopps.c +++ b/sys/dev/gpio/gpiopps.c @@ -47,6 +47,7 @@ static struct ofw_compat_data compat_data[] = { {"pps-gpio", 1}, {NULL, 0} }; +SIMPLEBUS_PNP_INFO(compat_data); #endif /* FDT */ static devclass_t pps_devclass; @@ -290,6 +291,5 @@ static driver_t pps_fdt_driver = { }; DRIVER_MODULE(gpiopps, simplebus, pps_fdt_driver, pps_devclass, 0, 0); -SIMPLEBUS_PNP_INFO(compat_data); #endif /* FDT */ diff --git a/sys/dev/gpio/gpioths.c b/sys/dev/gpio/gpioths.c index 97831db881ae..c08d772ddb9b 100644 --- a/sys/dev/gpio/gpioths.c +++ b/sys/dev/gpio/gpioths.c @@ -72,6 +72,8 @@ static struct ofw_compat_data compat_data[] = { {"dht11", true}, {NULL, false} }; +OFWBUS_PNP_INFO(compat_data); +SIMPLEBUS_PNP_INFO(compat_data); #endif /* FDT */ #define PIN_IDX 0 /* Use the first/only configured pin. */ @@ -409,11 +411,7 @@ DEFINE_CLASS_0(gpioths, gpioths_driver, gpioths_methods, sizeof(struct gpioths_s #ifdef FDT DRIVER_MODULE(gpioths, simplebus, gpioths_driver, gpioths_devclass, 0, 0); -SIMPLEBUS_PNP_INFO(compat_data); #endif DRIVER_MODULE(gpioths, gpiobus, gpioths_driver, gpioths_devclass, 0, 0); -#ifdef FDT -OFWBUS_PNP_INFO(compat_data); -#endif MODULE_DEPEND(gpioths, gpiobus, 1, 1, 1); diff --git a/sys/dev/iicbus/ads111x.c b/sys/dev/iicbus/ads111x.c index 0464de1800c0..5d7057d99b91 100644 --- a/sys/dev/iicbus/ads111x.c +++ b/sys/dev/iicbus/ads111x.c @@ -152,6 +152,7 @@ static struct ofw_compat_data compat_data[] = { {"ti,ads1115", (uintptr_t)&ads111x_chip_infos[5]}, {NULL, (uintptr_t)NULL}, }; +IICBUS_FDT_PNP_INFO(compat_data); #endif struct ads111x_softc { @@ -608,8 +609,5 @@ static driver_t ads111x_driver = { static devclass_t ads111x_devclass; DRIVER_MODULE(ads111x, iicbus, ads111x_driver, ads111x_devclass, NULL, NULL); -#ifdef FDT -IICBUS_FDT_PNP_INFO(compat_data); -#endif MODULE_VERSION(ads111x, 1); MODULE_DEPEND(ads111x, iicbus, 1, 1, 1); diff --git a/sys/dev/iicbus/mux/iic_gpiomux.c b/sys/dev/iicbus/mux/iic_gpiomux.c index 9d34d21c6572..8e064d84619d 100644 --- a/sys/dev/iicbus/mux/iic_gpiomux.c +++ b/sys/dev/iicbus/mux/iic_gpiomux.c @@ -58,6 +58,8 @@ 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 @@ -253,13 +255,7 @@ 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); -#ifdef FDT -SIMPLEBUS_PNP_INFO(compat_data); -#endif DRIVER_MODULE(iic_gpiomux, ofw_simplebus, iic_gpiomux_driver, gpiomux_devclass, 0, 0); -#ifdef FDT -OFWBUS_PNP_INFO(compat_data); -#endif #ifdef FDT DRIVER_MODULE(ofw_iicbus, iic_gpiomux, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); diff --git a/sys/dev/iicbus/mux/ltc430x.c b/sys/dev/iicbus/mux/ltc430x.c index 77f1fafe6fe1..fab791ed3174 100644 --- a/sys/dev/iicbus/mux/ltc430x.c +++ b/sys/dev/iicbus/mux/ltc430x.c @@ -63,6 +63,7 @@ static struct ofw_compat_data compat_data[] = { {"lltc,ltc4306", CHIP_LTC4306}, {NULL, CHIP_NONE} }; +IICBUS_FDT_PNP_INFO(compat_data); #endif #include @@ -245,8 +246,8 @@ static devclass_t ltc430x_devclass; DEFINE_CLASS_1(ltc430x, ltc430x_driver, ltc430x_methods, sizeof(struct ltc430x_softc), iicmux_driver); DRIVER_MODULE(ltc430x, iicbus, ltc430x_driver, ltc430x_devclass, 0, 0); + #ifdef FDT -IICBUS_FDT_PNP_INFO(compat_data); DRIVER_MODULE(ofw_iicbus, ltc430x, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); #else DRIVER_MODULE(iicbus, ltc430x, iicbus_driver, iicbus_devclass, 0, 0); @@ -254,3 +255,4 @@ DRIVER_MODULE(iicbus, ltc430x, iicbus_driver, iicbus_devclass, 0, 0); MODULE_DEPEND(ltc430x, iicmux, 1, 1, 1); MODULE_DEPEND(ltc430x, iicbus, 1, 1, 1); + diff --git a/sys/dev/iicbus/mux/pca9547.c b/sys/dev/iicbus/mux/pca9547.c index 2bdc6cb2e867..ac57f26dbb04 100644 --- a/sys/dev/iicbus/mux/pca9547.c +++ b/sys/dev/iicbus/mux/pca9547.c @@ -50,6 +50,7 @@ static struct ofw_compat_data compat_data[] = { {"nxp,pca9547", 1}, {NULL, 0} }; +IICBUS_FDT_PNP_INFO(compat_data); #include @@ -154,7 +155,6 @@ static devclass_t pca9547_devclass; DEFINE_CLASS_1(iicmux, pca9547_driver, pca9547_methods, sizeof(struct pca9547_softc), iicmux_driver); DRIVER_MODULE(pca_iicmux, iicbus, pca9547_driver, pca9547_devclass, 0, 0); -IICBUS_FDT_PNP_INFO(compat_data); DRIVER_MODULE(iicbus, iicmux, iicbus_driver, iicbus_devclass, 0, 0); DRIVER_MODULE(ofw_iicbus, iicmux, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); diff --git a/sys/dev/ow/owc_gpiobus.c b/sys/dev/ow/owc_gpiobus.c index 8ed73e10862b..4b8b2ab6f99e 100644 --- a/sys/dev/ow/owc_gpiobus.c +++ b/sys/dev/ow/owc_gpiobus.c @@ -49,6 +49,8 @@ static struct ofw_compat_data compat_data[] = { {"w1-gpio", true}, {NULL, false} }; +OFWBUS_PNP_INFO(compat_data); +SIMPLEBUS_PNP_INFO(compat_data); #endif /* FDT */ #define OW_PIN 0 @@ -392,13 +394,9 @@ static driver_t owc_gpiobus_driver = { #ifdef FDT DRIVER_MODULE(owc_gpiobus, simplebus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0); -SIMPLEBUS_PNP_INFO(compat_data); #endif DRIVER_MODULE(owc_gpiobus, gpiobus, owc_gpiobus_driver, owc_gpiobus_devclass, 0, 0); -#ifdef FDT -OFWBUS_PNP_INFO(compat_data); -#endif MODULE_DEPEND(owc_gpiobus, ow, 1, 1, 1); MODULE_DEPEND(owc_gpiobus, gpiobus, 1, 1, 1); MODULE_VERSION(owc_gpiobus, 1); diff --git a/sys/dev/pwm/pwmc.c b/sys/dev/pwm/pwmc.c index b39460edc9c9..c49d1e894488 100644 --- a/sys/dev/pwm/pwmc.c +++ b/sys/dev/pwm/pwmc.c @@ -52,6 +52,9 @@ static struct ofw_compat_data compat_data[] = { {"freebsd,pwmc", true}, {NULL, false}, }; + +PWMBUS_FDT_PNP_INFO(compat_data); + #endif struct pwmc_softc { @@ -203,8 +206,5 @@ static driver_t pwmc_driver = { static devclass_t pwmc_devclass; DRIVER_MODULE(pwmc, pwmbus, pwmc_driver, pwmc_devclass, 0, 0); -#ifdef FDT -PWMBUS_FDT_PNP_INFO(compat_data); -#endif MODULE_DEPEND(pwmc, pwmbus, 1, 1, 1); MODULE_VERSION(pwmc, 1); From owner-dev-commits-src-main@freebsd.org Sat Jan 23 18:03:04 2021 Return-Path: Delivered-To: dev-commits-src-main@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 1CC3F4D937C; Sat, 23 Jan 2021 18:03:04 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNPB00DBnz4lwM; Sat, 23 Jan 2021 18:03:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEA83153DC; Sat, 23 Jan 2021 18:03:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NI33jN010595; Sat, 23 Jan 2021 18:03:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NI332d010594; Sat, 23 Jan 2021 18:03:03 GMT (envelope-from git) Date: Sat, 23 Jan 2021 18:03:03 GMT Message-Id: <202101231803.10NI332d010594@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: d7dd28bb09fa - main - netgraph/ng_source: If queue is full, don't enqueue MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7dd28bb09fa51b9958a5dc288d2aeef56a67491 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 18:03:04 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=d7dd28bb09fa51b9958a5dc288d2aeef56a67491 commit d7dd28bb09fa51b9958a5dc288d2aeef56a67491 Author: Lutz Donnerhacke AuthorDate: 2021-01-23 17:54:47 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-01-23 17:54:47 +0000 netgraph/ng_source: If queue is full, don't enqueue Submitted by: nc Reviewed by: donner, kp Approved by: kp (mentor) Differential Revision: https://reviews.freebsd.org/D23477 --- sys/netgraph/ng_source.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_source.c b/sys/netgraph/ng_source.c index 401548da65d0..4bde62e5898a 100644 --- a/sys/netgraph/ng_source.c +++ b/sys/netgraph/ng_source.c @@ -284,7 +284,7 @@ ng_source_constructor(node_p node) NG_NODE_SET_PRIVATE(node, sc); sc->node = node; - sc->snd_queue.ifq_maxlen = 2048; /* XXX not checked */ + sc->snd_queue.ifq_maxlen = 2048; ng_callout_init(&sc->intr_ch); return (0); @@ -567,8 +567,11 @@ ng_source_rcvdata(hook_p hook, item_p item) } KASSERT(hook == sc->input, ("%s: no hook!", __func__)); - /* Enqueue packet. */ - /* XXX should we check IF_QFULL() ? */ + /* Enqueue packet if the queue isn't full. */ + if (_IF_QFULL(&sc->snd_queue)) { + NG_FREE_M(m); + return (ENOBUFS); + } _IF_ENQUEUE(&sc->snd_queue, m); sc->queueOctets += m->m_pkthdr.len; sc->last_packet = m; From owner-dev-commits-src-main@freebsd.org Sat Jan 23 18:10:20 2021 Return-Path: Delivered-To: dev-commits-src-main@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 EFFD54D9CCF; Sat, 23 Jan 2021 18:10:20 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNPLN62M0z4m8c; Sat, 23 Jan 2021 18:10:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBA1F15A90; Sat, 23 Jan 2021 18:10:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NIAK8P018770; Sat, 23 Jan 2021 18:10:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NIAKXd018767; Sat, 23 Jan 2021 18:10:20 GMT (envelope-from git) Date: Sat, 23 Jan 2021 18:10:20 GMT Message-Id: <202101231810.10NIAKXd018767@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 02ec31bdf60f - main - cache: add back target entry on rename MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 18:10:21 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d commit 02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d Author: Mateusz Guzik AuthorDate: 2021-01-23 17:21:42 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-23 18:10:16 +0000 cache: add back target entry on rename --- sys/kern/vfs_cache.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 770c8ebf061b..03bafc75acaa 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -367,6 +367,10 @@ static bool __read_frequently cache_fast_revlookup = true; SYSCTL_BOOL(_vfs, OID_AUTO, cache_fast_revlookup, CTLFLAG_RW, &cache_fast_revlookup, 0, ""); +static bool __read_mostly cache_rename_add = true; +SYSCTL_BOOL(_vfs, OID_AUTO, cache_rename_add, CTLFLAG_RW, + &cache_rename_add, 0, ""); + static u_int __exclusive_cache_line neg_cycle; #define ncneghash 3 @@ -2731,6 +2735,21 @@ cache_vop_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, } else { cache_remove_cnp(tdvp, tcnp); } + + /* + * TODO + * + * Historically renaming was always purging all revelang entries, + * but that's quite wasteful. In particular turns out that in many cases + * the target file is immediately accessed after rename, inducing a cache + * miss. + * + * Recode this to reduce relocking and reuse the existing entry (if any) + * instead of just removing it above and allocating a new one here. + */ + if (cache_rename_add) { + cache_enter(tdvp, fvp, tcnp); + } } void From owner-dev-commits-src-main@freebsd.org Sat Jan 23 19:24:26 2021 Return-Path: Delivered-To: dev-commits-src-main@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 81FB84DB970; Sat, 23 Jan 2021 19:24:26 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNQzt3DgXz4r3Q; Sat, 23 Jan 2021 19:24:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61E231673E; Sat, 23 Jan 2021 19:24:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NJOQMY015874; Sat, 23 Jan 2021 19:24:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NJOQiE015873; Sat, 23 Jan 2021 19:24:26 GMT (envelope-from git) Date: Sat, 23 Jan 2021 19:24:26 GMT Message-Id: <202101231924.10NJOQiE015873@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 0d528e635414 - main - hcons: Fix manpage typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0d528e6354141dd097f8719e858b3ae3686d2062 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 19:24:26 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=0d528e6354141dd097f8719e858b3ae3686d2062 commit 0d528e6354141dd097f8719e858b3ae3686d2062 Author: Vladimir Kondratyev AuthorDate: 2021-01-23 19:19:50 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-01-23 19:19:50 +0000 hcons: Fix manpage typo Submitted by: Shunchao Hu Reviewed by: wulf, gbe MFC after: 1 week Differential revision: https://reviews.freebsd.org/D28294 --- share/man/man4/hcons.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/hcons.4 b/share/man/man4/hcons.4 index a8fe22983453..68a920fba9d8 100644 --- a/share/man/man4/hcons.4 +++ b/share/man/man4/hcons.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2020 +.Dd January 23, 2021 .Dt HCONS 4 .Os .Sh NAME @@ -45,7 +45,7 @@ Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -hgame_load="YES" +hcons_load="YES" .Ed .Sh DESCRIPTION The From owner-dev-commits-src-main@freebsd.org Sat Jan 23 20:10:44 2021 Return-Path: Delivered-To: dev-commits-src-main@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 552334DCA61; Sat, 23 Jan 2021 20:10:44 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from maybe.home.utahime.org (gate.home.utahime.org [183.180.29.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNS1J0gLcz4t6n; Sat, 23 Jan 2021 20:10:43 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from eastasia.home.utahime.org (eastasia.home.utahime.org [192.168.174.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by maybe.home.utahime.org (Postfix) with ESMTPS id 8FBC74D252; Sun, 24 Jan 2021 05:10:39 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=utahime.org; s=maybe2019112701; t=1611432639; bh=30OC5dJutuAt8cxX7VdszdGTZofxBgRK1LimXFdNU0s=; h=Date:To:Cc:Subject:From:In-Reply-To:References; b=RLpcYTGtJqt2ebbBbzHybYZ5RJ5tkBx53OzJJEJF7YjEdpEtw7g6gaoDbyQNJ6OVJ R051J1zEZE4ykC09Iq4NcVftEW5bRPOoCs5/U37uXHIA/22NTjn5jZ5dVexRqFeEs0 THEnzXEDS7ro1OSJuEIRSkyXv53CmFpdTOpwM8Gvit7PJW5tgQM/0KxUG7P8JlliIG PXb1Z8Qh5hbreGwavA6L7QXcMRr7D+OzBMKmXl6G9YuE/IsTAhQkbXRU4dgCL6l1wf rFFEbCtcIYh7nMRKyeTa3wpIxh5ooiMzPxkl4aeqThDHi2TNmSzGrd1PqX/yTNudGu Xz9lo77TdgRIg== Received: from localhost (rolling.home.utahime.org [192.168.174.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by eastasia.home.utahime.org (Postfix) with ESMTPSA id B12544BD19; Sun, 24 Jan 2021 05:10:38 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.0 at eastasia.home.utahime.org Date: Sun, 24 Jan 2021 05:08:52 +0900 (JST) Message-Id: <20210124.050852.1053381322070533315.yasu@utahime.org> To: kib@FreeBSD.org Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write From: Yasuhiro Kimura In-Reply-To: <202101231525.10NFPa3V002367@gitrepo.freebsd.org> References: <202101231525.10NFPa3V002367@gitrepo.freebsd.org> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DNS1J0gLcz4t6n X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 20:10:44 -0000 From: Konstantin Belousov Subject: git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write Date: Sat, 23 Jan 2021 15:25:36 GMT > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=aa8c1f8d84d2638a354e71f9593e978d00878243 > > commit aa8c1f8d84d2638a354e71f9593e978d00878243 > Author: Konstantin Belousov > AuthorDate: 2021-01-22 21:47:06 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-01-23 15:24:32 +0000 > > nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write > > Otherwise writing thread might wait on sbusy state of the pages which were > busied by itself, similarly to nfs_read(). But also we need to clear > NVNSETSZKSIP flag possibly set by ncl_pager_setsize(), to not undo > extension done by write. > > Reported by: bdrewery > Reviewed by: rmacklem > Tested by: pho > MFC after: 1 week > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D28306 On my 14-CURRENT amd64 environment this commit causes the problem that garbage date are written to file mounted with NFS. I use NFSv4 and autofs to mount home directory on my 12.2-RELEASE amd64 server. And I use zsh as login shell and configure it so command history is written to history file each time any command is executed. After update to 519b64e27fddf10c0b7f6a615edbad730b8c6c45, I see following error message if I try to execute any command. ---------------------------------------------------------------------- yasu@rolling-vm-freebsd1[1009]% ls zsh: corrupt history file /home/yasu/.zhistory yasu@rolling-vm-freebsd1[1010]% ---------------------------------------------------------------------- I logged in the server and check the content of history file. Then some garbase data are written to history file. I confirmed the problem disappears by reverting this commit. --- Yasuhiro Kimura From owner-dev-commits-src-main@freebsd.org Sat Jan 23 20:21:09 2021 Return-Path: Delivered-To: dev-commits-src-main@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 D4C9B4DCE28; Sat, 23 Jan 2021 20:21:09 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DNSFK5Thrz4tYl; Sat, 23 Jan 2021 20:21:09 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-ot1-x32f.google.com with SMTP id d1so8740574otl.13; Sat, 23 Jan 2021 12:21:09 -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=+GrODjKlfi+Rm3eh4gFBvmNljNwRtTVrCd0WR6o8nME=; b=PK5fePdXOmfGVFvnkMboOQQfNg+r9KYFqAj93O/OTA2Sx7urlWQJUqNYr1zigkGePN DFmIIa9fQROkGr3gKrlu4Gn6emxMTAK+IzAhnuU4xoK6pn0XEQHdBLUp87Mf6RjNWXn+ 0XJALTXX23wabON6tfTwRPCfGB7zBudEqjfsTMIWBvgRrvKp/ZpbcBWglRi5siSp2W5/ WuewJMyWU8PIa+mRNtKaFteo7T+4xpCSV2NM7i/6E1wG4mZO7h8u1AHlApVGT3D9Quul So7Z5t8jlIzW9dkXspvOihCNIFvsQs08h3d8dCmXZphel6k2hWPUrA45YsqqgxuQg2CB 6C0Q== 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=+GrODjKlfi+Rm3eh4gFBvmNljNwRtTVrCd0WR6o8nME=; b=Mi5zUWjNnV6KNW3OhMQsM15MUoL9Wypksxn7KC/eVJ/95zQb1eOKt+WJP0zLVFRNJ8 0jNxKOWZ83BbFchC9xG/0qPUlqsNiKZ5TLoF/haeGgtolnbndYZsESeL7guIoLJ/yS6i l5wfVvbPoeFhLTh/e2oCR0fHLFVHSFAJ8t2CL10OF5rtxdljC4c1B9mOROFQFW50euEC qZGgSrBjjGJHXUECIxeoXWRycrYqUpZg/abZU8/dCDaOi+oWy7F7yHzVfxQstdVXByxG yQCuzifdOr4lyCE8uN/JyI8zD9Zqc2C2WNZnlxsJJ54Z8xOgw9W5fL4vgmH8+FlWUnvr ue+Q== X-Gm-Message-State: AOAM533Y1Ei7tprbSf0e4zuSaCTGB0/M6TLVNE4trSj/G3p+tWc8z+fe kkoPJYleeWTFTdp1vyXTJX5gAt04BDGN1SN6fKplQ19e X-Google-Smtp-Source: ABdhPJyIiFOQX9pVwID09Cp/NaNlBl0udzVBvcx6GHLqoxs5kf3T1+EiPSj4zABq8ykDTPwnWaDoghZvzRm9irHa1vU= X-Received: by 2002:a9d:3985:: with SMTP id y5mr7506955otb.202.1611433268293; Sat, 23 Jan 2021 12:21:08 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a4a:a187:0:0:0:0:0 with HTTP; Sat, 23 Jan 2021 12:21:07 -0800 (PST) In-Reply-To: <202101231810.10NIAKXd018767@gitrepo.freebsd.org> References: <202101231810.10NIAKXd018767@gitrepo.freebsd.org> From: Oliver Pinter Date: Sat, 23 Jan 2021 21:21:07 +0100 Message-ID: Subject: Re: git: 02ec31bdf60f - main - cache: add back target entry on rename To: Mateusz Guzik Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4DNSFK5Thrz4tYl X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 20:21:09 -0000 On Saturday, January 23, 2021, Mateusz Guzik wrote: > The branch main has been updated by mjg: > > URL: https://cgit.FreeBSD.org/src/commit/?id= > 02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d > > commit 02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d > Author: Mateusz Guzik > AuthorDate: 2021-01-23 17:21:42 +0000 > Commit: Mateusz Guzik > CommitDate: 2021-01-23 18:10:16 +0000 > > cache: add back target entry on rename > --- > sys/kern/vfs_cache.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c > index 770c8ebf061b..03bafc75acaa 100644 > --- a/sys/kern/vfs_cache.c > +++ b/sys/kern/vfs_cache.c > @@ -367,6 +367,10 @@ static bool __read_frequently cache_fast_revlookup = > true; > SYSCTL_BOOL(_vfs, OID_AUTO, cache_fast_revlookup, CTLFLAG_RW, > &cache_fast_revlookup, 0, ""); > > +static bool __read_mostly cache_rename_add = true; > +SYSCTL_BOOL(_vfs, OID_AUTO, cache_rename_add, CTLFLAG_RW, > + &cache_rename_add, 0, ""); It would be really if the description were filled with proper info. + > static u_int __exclusive_cache_line neg_cycle; > > #define ncneghash 3 > @@ -2731,6 +2735,21 @@ cache_vop_rename(struct vnode *fdvp, struct vnode > *fvp, struct vnode *tdvp, > } else { > cache_remove_cnp(tdvp, tcnp); > } > + > + /* > + * TODO > + * > + * Historically renaming was always purging all revelang entries, > + * but that's quite wasteful. In particular turns out that in many > cases > + * the target file is immediately accessed after rename, inducing > a cache > + * miss. > + * > + * Recode this to reduce relocking and reuse the existing entry > (if any) > + * instead of just removing it above and allocating a new one here. > + */ > + if (cache_rename_add) { > + cache_enter(tdvp, fvp, tcnp); > + } > } > > void > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all- > unsubscribe@freebsd.org" > From owner-dev-commits-src-main@freebsd.org Sat Jan 23 20:22:15 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BC2064DD2C8; Sat, 23 Jan 2021 20:22:15 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4DNSGZ3Fqrz4tv7; Sat, 23 Jan 2021 20:22:14 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x433.google.com with SMTP id a1so8409345wrq.6; Sat, 23 Jan 2021 12:22:14 -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=7crC98+hqVezOnNSUZB6SrvASDknqcFDpWG49hpAhBM=; b=Utd0pG+znqmhRpls0Zo9rqu1TpRzSK+99zkxduP1RUi0MpZ0kaRcswydCNWQnSpu2L LF2Q3Zn6h6wIu7NNNcv80Jqtgi5JsI6Ox461WLNv8nd7W2bDlFhd7bDsyktN8mygsvQM ZXoCiwn6t60562VSJ8HEUykmcxctyKehEzWMmYi0OcdDz7YuljWPcOv3VC5e/RD0Bq/0 arik1Eto+4LAJYZLAcUZ+fLRsMQvxZTHeAeJMnChxnAJg/oTXGM6Ecp8wSSqjSUXYh2v ZZRRBvii8N7idm8WdQ96pDYqPvBNO5jBjdu1/DLsnVHITnNPyVJHFIwJ/tDPotn0weh+ ENDA== 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=7crC98+hqVezOnNSUZB6SrvASDknqcFDpWG49hpAhBM=; b=KSwJw76qvQOXl7En1DyzVeatei1Qyty/wIdDqSCQyKWuQsDAxhuETMHb25ZdNXu0uU tG4mEdxn4rE6WVGbGdMZ+UHodSzHsiLco2FIWRJNHSlbIopeb5f7qNI+fzqPG4oYX0kt FP+8O7/WnQpDb+nIfCftZCXrgjB2p+/z+3jgieLecj8miWrG18AffQqBtZ7R4IYBlf9N VTYBUJavPDolgnGd3yOxZH7LieZh6V8gf0J4EuEMPAOOKi70AwtI4l/z6jZXWGc7v2Im C9ZOeE8Q8hbxFFTVuqJ37DzUaxI+fk8H2uRzUjCXGu7TI9ZqiPSo/3Dn/ACF3hU20TT/ Prsw== X-Gm-Message-State: AOAM532fhcRfoMtUU9nTo+5dUHR4EqWAXbdyDQoMTSedEa9a8k4eOZR3 mKwiTBgWb4Z3qDMjDv6QDx266hM+aBqAdjCqMGMzqSLmYQ4= X-Google-Smtp-Source: ABdhPJyUJ3rTRI5x73LhBG0L/Wldsabe4AqN4V9Sb1urHqA/lRDqupY1zW1WHgHYn/UNnt/L1C/UHR2N1FoL3z52Lzs= X-Received: by 2002:a5d:4e92:: with SMTP id e18mr186960wru.66.1611433333226; Sat, 23 Jan 2021 12:22:13 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:464c:0:0:0:0:0 with HTTP; Sat, 23 Jan 2021 12:22:12 -0800 (PST) In-Reply-To: References: <202101231810.10NIAKXd018767@gitrepo.freebsd.org> From: Mateusz Guzik Date: Sat, 23 Jan 2021 21:22:12 +0100 Message-ID: Subject: Re: git: 02ec31bdf60f - main - cache: add back target entry on rename To: Oliver Pinter Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DNSGZ3Fqrz4tv7 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Utd0pG+z; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::433 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.73 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-0.73)[-0.733]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::433:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; 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]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::433:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::433:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 20:22:15 -0000 The sysctl at hand is temporary in case someone reports trouble -- then they can flip it. I don't expect it to survive more than a month. On 1/23/21, Oliver Pinter wrote: > On Saturday, January 23, 2021, Mateusz Guzik wrote: > >> The branch main has been updated by mjg: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id= >> 02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d >> >> commit 02ec31bdf60fa3a8530544cb3c8c4ec1df6cde0d >> Author: Mateusz Guzik >> AuthorDate: 2021-01-23 17:21:42 +0000 >> Commit: Mateusz Guzik >> CommitDate: 2021-01-23 18:10:16 +0000 >> >> cache: add back target entry on rename >> --- >> sys/kern/vfs_cache.c | 19 +++++++++++++++++++ >> 1 file changed, 19 insertions(+) >> >> diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c >> index 770c8ebf061b..03bafc75acaa 100644 >> --- a/sys/kern/vfs_cache.c >> +++ b/sys/kern/vfs_cache.c >> @@ -367,6 +367,10 @@ static bool __read_frequently cache_fast_revlookup = >> true; >> SYSCTL_BOOL(_vfs, OID_AUTO, cache_fast_revlookup, CTLFLAG_RW, >> &cache_fast_revlookup, 0, ""); >> >> +static bool __read_mostly cache_rename_add = true; >> +SYSCTL_BOOL(_vfs, OID_AUTO, cache_rename_add, CTLFLAG_RW, >> + &cache_rename_add, 0, ""); > > > It would be really if the description were filled with proper info. > > + >> static u_int __exclusive_cache_line neg_cycle; >> >> #define ncneghash 3 >> @@ -2731,6 +2735,21 @@ cache_vop_rename(struct vnode *fdvp, struct vnode >> *fvp, struct vnode *tdvp, >> } else { >> cache_remove_cnp(tdvp, tcnp); >> } >> + >> + /* >> + * TODO >> + * >> + * Historically renaming was always purging all revelang entries, >> + * but that's quite wasteful. In particular turns out that in >> many >> cases >> + * the target file is immediately accessed after rename, inducing >> a cache >> + * miss. >> + * >> + * Recode this to reduce relocking and reuse the existing entry >> (if any) >> + * instead of just removing it above and allocating a new one >> here. >> + */ >> + if (cache_rename_add) { >> + cache_enter(tdvp, fvp, tcnp); >> + } >> } >> >> void >> _______________________________________________ >> dev-commits-src-all@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all >> To unsubscribe, send any mail to "dev-commits-src-all- >> unsubscribe@freebsd.org" >> > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Sat Jan 23 20:29:46 2021 Return-Path: Delivered-To: dev-commits-src-main@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 441F74DD241; Sat, 23 Jan 2021 20:29:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNSRG00x3z4vMY; Sat, 23 Jan 2021 20:29:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 10NKTb8B054021 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 23 Jan 2021 22:29:40 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 10NKTb8B054021 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 10NKTaJv054020; Sat, 23 Jan 2021 22:29:36 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 23 Jan 2021 22:29:36 +0200 From: Konstantin Belousov To: Yasuhiro Kimura Cc: dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write Message-ID: References: <202101231525.10NFPa3V002367@gitrepo.freebsd.org> <20210124.050852.1053381322070533315.yasu@utahime.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210124.050852.1053381322070533315.yasu@utahime.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DNSRG00x3z4vMY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 20:29:46 -0000 On Sun, Jan 24, 2021 at 05:08:52AM +0900, Yasuhiro Kimura wrote: > From: Konstantin Belousov > Subject: git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write > Date: Sat, 23 Jan 2021 15:25:36 GMT > > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=aa8c1f8d84d2638a354e71f9593e978d00878243 > > > > commit aa8c1f8d84d2638a354e71f9593e978d00878243 > > Author: Konstantin Belousov > > AuthorDate: 2021-01-22 21:47:06 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-01-23 15:24:32 +0000 > > > > nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write > > > > Otherwise writing thread might wait on sbusy state of the pages which were > > busied by itself, similarly to nfs_read(). But also we need to clear > > NVNSETSZKSIP flag possibly set by ncl_pager_setsize(), to not undo > > extension done by write. > > > > Reported by: bdrewery > > Reviewed by: rmacklem > > Tested by: pho > > MFC after: 1 week > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D28306 > > On my 14-CURRENT amd64 environment this commit causes the problem that > garbage date are written to file mounted with NFS. > > I use NFSv4 and autofs to mount home directory on my 12.2-RELEASE > amd64 server. And I use zsh as login shell and configure it so command > history is written to history file each time any command is executed. > > After update to 519b64e27fddf10c0b7f6a615edbad730b8c6c45, I see > following error message if I try to execute any command. > > ---------------------------------------------------------------------- > yasu@rolling-vm-freebsd1[1009]% ls > zsh: corrupt history file /home/yasu/.zhistory > yasu@rolling-vm-freebsd1[1010]% > ---------------------------------------------------------------------- > > I logged in the server and check the content of history file. Then > some garbase data are written to history file. > > I confirmed the problem disappears by reverting this commit. Try this. Does the problem disappear with the following patch applied? diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 7d0ff0abff3d..ba72c728ca1e 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -1286,11 +1286,11 @@ ncl_write(struct vop_write_args *ap) out: curthread_pflags2_restore(save2); - if ((curthread->td_pflags2 & TDP2_SBPAGES) == 0) { +/* if ((curthread->td_pflags2 & TDP2_SBPAGES) == 0) { NFSLOCKNODE(np); ncl_pager_setsize(vp, NULL); } - +*/ return (error); } From owner-dev-commits-src-main@freebsd.org Sat Jan 23 21:00:07 2021 Return-Path: Delivered-To: dev-commits-src-main@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 83F8D4DDFF1; Sat, 23 Jan 2021 21:00:07 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNT6H3NdNz3CLW; Sat, 23 Jan 2021 21:00:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6736717B3C; Sat, 23 Jan 2021 21:00:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10NL07qb035932; Sat, 23 Jan 2021 21:00:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10NL07s8035929; Sat, 23 Jan 2021 21:00:07 GMT (envelope-from git) Date: Sat, 23 Jan 2021 21:00:07 GMT Message-Id: <202101232100.10NL07s8035929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: d6327ae8c11b - main - Fix cross-build support for Ubuntu 16.04 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d6327ae8c11b73765f100981baca49166b558b70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 21:00:07 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=d6327ae8c11b73765f100981baca49166b558b70 commit d6327ae8c11b73765f100981baca49166b558b70 Author: Jessica Clarke AuthorDate: 2021-01-23 20:59:15 +0000 Commit: Jessica Clarke CommitDate: 2021-01-23 20:59:15 +0000 Fix cross-build support for Ubuntu 16.04 Older glibc headers did some very nasty things that have since been sanitised. We could also fix this by adding a linux/getopt.h wrapper alongside the existing common/getopt.h that #undef's __need_getopt, but that seems a little more hacky and complicated. Reviewed by: arichardson --- tools/build/cross-build/include/linux/unistd.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/build/cross-build/include/linux/unistd.h b/tools/build/cross-build/include/linux/unistd.h index 9d1bd1bf4025..ea131f1ab732 100644 --- a/tools/build/cross-build/include/linux/unistd.h +++ b/tools/build/cross-build/include/linux/unistd.h @@ -41,9 +41,17 @@ /* Ensure that unistd.h pulls in getopt */ #define __USE_POSIX2 #endif +/* + * Before version 2.25, glibc's unistd.h would define the POSIX subset of + * getopt.h by defining __need_getopt, including getopt.h (which would + * disable the header guard) and then undefining it so later including + * getopt.h explicitly would define the extensions. However, we wrap getopt, + * and so the wrapper's #pragma once breaks that. Thus getopt.h must be + * included before the real unistd.h to ensure we get all the extensions. + */ +#include #include_next #include -#include #include #include #include From owner-dev-commits-src-main@freebsd.org Sat Jan 23 21:00:42 2021 Return-Path: Delivered-To: dev-commits-src-main@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 399B04DE157; Sat, 23 Jan 2021 21:00:42 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from maybe.home.utahime.org (gate.home.utahime.org [183.180.29.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNT6x72hLz3Cw6; Sat, 23 Jan 2021 21:00:41 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from eastasia.home.utahime.org (eastasia.home.utahime.org [192.168.174.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by maybe.home.utahime.org (Postfix) with ESMTPS id 0ECA04D33D; Sun, 24 Jan 2021 06:00:39 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=utahime.org; s=maybe2019112701; t=1611435639; bh=GZ7UTg4z/o1hTQMPqADlISATGP0ONWq1q9k+AO7a1eI=; h=Date:To:Cc:Subject:From:In-Reply-To:References; b=jqa89xS8qigc83HtP9HwDbVzszjPwyQiqmrr1qIkshEbrZWK7KC+e+Pp0F+t/SMSc j61X2eDFIiHGTkD5MSsvXh6LeBvDaHf9aTUUDY3W0GNXC0Rd8AUdWsx3rldnpmFjSq LcYphxyfvEOp4iQCult/7BFWj1O4+YLnFBd9dbEJVGu3RlTAH1RaLr0aN+e7lomMeX +bHRfqDpLjH7A+996z3iW9Beyebbl3KGcU2wELOnyMoUEhyTtbbt7jZ3DdIUH50Wu7 f5C1arRKLMbOGiZulMNgo5J+z8Ff4YmLSnZfLWFWFji5rfHcFQ3bL4TAOCk4gEbCw6 ZcYinB9idUVQQ== Received: from localhost (rolling.home.utahime.org [192.168.174.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by eastasia.home.utahime.org (Postfix) with ESMTPSA id 6F7194BDAE; Sun, 24 Jan 2021 06:00:38 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.0 at eastasia.home.utahime.org Date: Sun, 24 Jan 2021 06:00:07 +0900 (JST) Message-Id: <20210124.060007.1107438771141721048.yasu@utahime.org> To: kostikbel@gmail.com Cc: dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write From: Yasuhiro Kimura In-Reply-To: References: <202101231525.10NFPa3V002367@gitrepo.freebsd.org> <20210124.050852.1053381322070533315.yasu@utahime.org> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DNT6x72hLz3Cw6 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 21:00:42 -0000 From: Konstantin Belousov Subject: Re: git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write Date: Sat, 23 Jan 2021 22:29:36 +0200 > Try this. Does the problem disappear with the following patch applied? This fixes the problem. Thank you for quick response. --- Yasuhiro Kimura From owner-dev-commits-src-main@freebsd.org Sat Jan 23 23:42:49 2021 Return-Path: Delivered-To: dev-commits-src-main@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 52C8C4E289F; Sat, 23 Jan 2021 23:42:49 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-QB1-obe.outbound.protection.outlook.com (mail-qb1can01on0629.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5c::629]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNXk113Tkz3NVp; Sat, 23 Jan 2021 23:42:48 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eu09zPCNnGKxyrGNkXm7tmScV+zFtIz9uhL2EVIv9Zl/tpw+V1LGH6qdlix9OlhQDuZ9f9Y4LiUD1yQz3UJkWJakDxJN4IzTUo0dxCdLZ03jubd3TUiOAt/0bf2W8ViefRAw6nA9u6ezpgd2cVi5InKRxL3yJdMLiWOaoGkXP9YMYb9xuUgIBOXF79WvPphM2noICKRUn0Rx2nF0yQu+PGSKeI7bUFry6HCjGc07FC9p39qVgIg5c3ZezTm43Ae+s3KwdGx6NfkMecXsqPWy/gfuapo6VxkvEhuhav2GS9i11XRzRJhrt6AMdlCgL8EAme0+LstDhxlzHYXzlu6UJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=950NHLEE34FNVvZ34CqSVZ5eH/p5PiwIH2LDwvqVaK4=; b=AnuJ5cbiw7wP1E09m6MN5KTf8J/4m/7VmlDoea8dUBuLLNDtl9kydt7JzGbTCw5/BElD8MIeKdLu7/EjiCYO3EwRnKJCEDcsILzECHZvhsAlYH+7Ns47CvW+zOyYvs74JOiYjMV4rx8qyiBfQVy3Qna6EWJUfZ65jwcGU2gA7enyrbcFXtVTaRcfbpm/LYskYoyWhQJ0WArs14bZTlDup0K0UJz8S2QjN6TbslzX+k1OauHgOOdO8UtRipx4Q6XUt1+HdHj9vjoRITF430MYKfTfLmVow8RsxRYrGusQQd9/5BVE5huzo9nbwcqjfNvggefd/imJV9vFMY837d8wRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uoguelph.ca; dmarc=pass action=none header.from=uoguelph.ca; dkim=pass header.d=uoguelph.ca; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uoguelph.ca; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=950NHLEE34FNVvZ34CqSVZ5eH/p5PiwIH2LDwvqVaK4=; b=Hg9iW5M65p2xbPabu8sRMiVEXE0U/brpHnMSckX6r8H7ASMrSHdYN7HLDllpH595xyk0/cZwqQQOnvSeSOT9ya6ij0Zox19QXkXAIl5w7mSbOGzoQ/wrGPhnONU7eyhyzUgEVNMadyAr6IspIHqjqhgQX21VGxZhpunq1FLnnX38WhckeNoAL0TOY5BQYskWJ4Y5xUYywgoWsW0zC1R1T94jsBiWewZ1U6u3Qc71+yGsOSAoNZGAPAEUkI23oAK0T5+m4Vom0NtHw7F8hf4SfqFNDWUkO4DIFuUPAMorHuLMxe4dTSRHPyuP/LafkRtosEIt17M+oWJt5bEuynjikg== Received: from YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:19::29) by YQXPR01MB4216.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Sat, 23 Jan 2021 23:42:46 +0000 Received: from YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM ([fe80::3d86:c7f9:bc4c:40c0]) by YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM ([fe80::3d86:c7f9:bc4c:40c0%6]) with mapi id 15.20.3763.018; Sat, 23 Jan 2021 23:42:46 +0000 From: Rick Macklem To: Yasuhiro Kimura , "kib@FreeBSD.org" CC: "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" Subject: Re: git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write Thread-Topic: git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write Thread-Index: AQHW8cPeOsgYE2Xs40qbZA3x4cusm6o13IYQ Date: Sat, 23 Jan 2021 23:42:46 +0000 Message-ID: References: <202101231525.10NFPa3V002367@gitrepo.freebsd.org>, <20210124.050852.1053381322070533315.yasu@utahime.org> In-Reply-To: <20210124.050852.1053381322070533315.yasu@utahime.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 76ff098a-56e4-4900-4134-08d8bff89634 x-ms-traffictypediagnostic: YQXPR01MB4216: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5516; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: SNaRM3zJwrGSK0r+QoEqw3lz8nETdzmTpMkQQCfMbQgdu6URWxEpcpcBvBsnqdOoYCloeHg8rPS5z8YLQ14wee5sGM0ibhDr30HsLzm8r7iAX/49Yc5ULsAph+bCSQK77qwjAAvsv8knGTQPtf8BC74QeN6s+a4gll6WfW2v3wGC73zZt3fYw5jVrRODADhKyCNRLnvXji3UBjo/YVkQwacfCMmLdUkqYP3SAqP5j+mRmuVUAO7L9jzPW5W2N/4h53w4G2Rri3Kh/dRDhzNkT4VGvKGtCkWtEljDNOFwBVCnzDyRqtSgpQUYTugiZXU5UCX+5zNy1GmXfgz3wcdrWvqpvIm70ur5QevbDtthzZe2KFcS1ZNsFZDjJ+7Y19cYkKdWdHOSCW2X4VYdMMplKYcqWvx/pIfieTf93wiuZEs9+eFDnSnbMnYFP7EsCGJOlABn9ufk//Dw1h4EZHwQuQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(136003)(346002)(366004)(396003)(376002)(39850400004)(8676002)(86362001)(786003)(316002)(478600001)(186003)(5660300002)(2906002)(71200400001)(4326008)(64756008)(76116006)(66476007)(110136005)(66556008)(66446008)(52536014)(83380400001)(54906003)(33656002)(966005)(9686003)(55016002)(7696005)(66946007)(91956017)(6506007)(8936002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?CtSwaZuCgIScYjRDMSy1S/ML+iKTbAMK5l99imfzpQ70GhSeZvt6m7Jesb?= =?iso-8859-1?Q?N2L4yKgBipB3g4CxJc9+wfMLibsJzN1mW+0B7ZTTVBcAprVFfnjLmr/Qrf?= =?iso-8859-1?Q?OK8NLEvfOYcl4E612qzhz7kDS3FqcGLRfrnxbuJS6BulXxFpQGficm6CZQ?= =?iso-8859-1?Q?pVWr3fCZdi+RgkVV52RwHjd6KYcw2wEH6p4xrpckRelA3iuZjMfv08olJS?= =?iso-8859-1?Q?pqar77bm0PxDRzlf3/qpWNLyTki7fzMGgJJKTJ2QWJWZOKGiotwyngyuxu?= =?iso-8859-1?Q?uh9ISek8M2CyjnNu8GgcyfPZKOV3igJ4yLpbnUZ8+Z8zGeHvm7NWSz0fik?= =?iso-8859-1?Q?tRB+WrlA4MlEvPlogpC9xNV4TVdBIdacSiNv9C+MLh/bSqRhKeuOAz7bNp?= =?iso-8859-1?Q?Ad0X7o5IOVk+ABD4B9r7JHzUWcWc/zXMQkX/4W4IDdCdBU207zfhPfxVzG?= =?iso-8859-1?Q?FOU14nxN+/dG9506lYKR58W8Hb/ne5NkfPkce3wZQwpL9oxYz0KdX18yo4?= =?iso-8859-1?Q?kqFNjSI5A/DgAl7Cgl/go8+QbjgTA2t5ezeiKZ1JskhSo34NLtEscjBUdB?= =?iso-8859-1?Q?RGBXotJVQhEmWoF0CxSlGecWg9adGqAjB+K1iNtioFKPsw1eLAGabgnLvx?= =?iso-8859-1?Q?8PAQmg3ygkeQHBwRmlhJpMKdz7INJGp8oeQcYvUQ9RJrPZzQ36BDtscVzQ?= =?iso-8859-1?Q?kUSluCVkQApn2uv3UtgTFeFOSEuLOeP4wY1Kj9nmY9yFTzyfILeJVwuHb1?= =?iso-8859-1?Q?KtaFRCjZAHYMNeV22DePIG6R74YYXyBRAUpJig0VHirhHKMYRqf9sKdGj1?= =?iso-8859-1?Q?eBn3DjnXE0P6hK9SpaWzcwMnnidu9kXKdEtn2SPzk+jRp28nQxKPKqBVMa?= =?iso-8859-1?Q?qShYMmN64iWtPeHfCs71oF/FHsCRx3Moy5fanHLNj/zom1UY8Da8qwhqmx?= =?iso-8859-1?Q?DrtJLY0X7waFgrz0hA7ioa+Ryb+ILYUrLKGsRAYyvo1e6aY1jC8zEn+hB4?= =?iso-8859-1?Q?Ane6EjGTWFzc8l45U6zu6oXsrVxksiHC0InG8sEljoveTIlQt+QGXtR3z5?= =?iso-8859-1?Q?Pxd0aVkjYEbmS2sgefuD7s+CA3t8FsD2st0/mqAa5fsfe5CDWC4+51NJB4?= =?iso-8859-1?Q?R5eHoQR2Vnlo3ey5iU7Y77LGofVe0jkAiKxwBXuzz78fkxeseF?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 76ff098a-56e4-4900-4134-08d8bff89634 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jan 2021 23:42:46.4557 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: hBCrudkbwwGlPhGIx/vmT1bvrmfY0GT0MwxL0OiVXILSnAKDCwDsFMpNg02GlOcgWdPSPxk7Vj77lI+2XJBibQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQXPR01MB4216 X-Rspamd-Queue-Id: 4DNXk113Tkz3NVp X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2021 23:42:49 -0000 Yasuhiro Kimura wrote:=0A= >> The branch main has been updated by kib:=0A= >>=0A= >> URL: https://cgit.FreeBSD.org/src/commit/?id=3Daa8c1f8d84d2638a354e71f95= 93e978d00878243=0A= >>=0A= >> commit aa8c1f8d84d2638a354e71f9593e978d00878243=0A= >> Author: Konstantin Belousov =0A= >> AuthorDate: 2021-01-22 21:47:06 +0000=0A= >> Commit: Konstantin Belousov =0A= >> CommitDate: 2021-01-23 15:24:32 +0000=0A= >>=0A= >> nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcac= he in nfs_write=0A= >>=0A= >> Otherwise writing thread might wait on sbusy state of the pages whic= h were=0A= >> busied by itself, similarly to nfs_read(). But also we need to clea= r=0A= >> NVNSETSZKSIP flag possibly set by ncl_pager_setsize(), to not undo= =0A= >> extension done by write.=0A= >>=0A= >> Reported by: bdrewery=0A= >> Reviewed by: rmacklem=0A= >> Tested by: pho=0A= >> MFC after: 1 week=0A= >> Sponsored by: The FreeBSD Foundation=0A= >> Differential Revision: https://reviews.freebsd.org/D28306=0A= >=0A= >On my 14-CURRENT amd64 environment this commit causes the problem that=0A= >garbage date are written to file mounted with NFS.=0A= >=0A= >I use NFSv4 and autofs to mount home directory on my 12.2-RELEASE=0A= >amd64 server. And I use zsh as login shell and configure it so command=0A= >history is written to history file each time any command is executed.=0A= >=0A= >After update to 519b64e27fddf10c0b7f6a615edbad730b8c6c45, I see=0A= >following error message if I try to execute any command.=0A= >=0A= >----------------------------------------------------------------------=0A= >yasu@rolling-vm-freebsd1[1009]% ls=0A= >zsh: corrupt history file /home/yasu/.zhistory=0A= >yasu@rolling-vm-freebsd1[1010]%=0A= >----------------------------------------------------------------------=0A= >=0A= >I logged in the server and check the content of history file. Then=0A= >some garbase data are written to history file.=0A= >=0A= >I confirmed the problem disappears by reverting this commit.=0A= I was also able to reproduce a problem (a truncated file) during=0A= testing.=0A= For my case, setting the size to n_size instead of va_size fixed=0A= the problem I reproduced, but I do not know if this achieves=0A= what Kostik intended.=0A= =0A= My variant of the patch is in D28318.=0A= Maybe you could test this, although you might want to wait=0A= until Kostik comments on this variant of the patch.=0A= =0A= rick=0A= =0A= ---=0A= Yasuhiro Kimura=0A= =0A= From owner-dev-commits-src-main@freebsd.org Sun Jan 24 09:16:23 2021 Return-Path: Delivered-To: dev-commits-src-main@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 330F14F3AE4; Sun, 24 Jan 2021 09:16:23 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNnRq0yqhz4jrL; Sun, 24 Jan 2021 09:16:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FE5F21123; Sun, 24 Jan 2021 09:16:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10O9GMjB097503; Sun, 24 Jan 2021 09:16:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10O9GMkn097502; Sun, 24 Jan 2021 09:16:22 GMT (envelope-from git) Date: Sun, 24 Jan 2021 09:16:22 GMT Message-Id: <202101240916.10O9GMkn097502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 7a051c0a7890 - main - sctp: improve consistency MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a051c0a7890dc8e490ebe125bfc70a28e89ddaf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 09:16:23 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=7a051c0a7890dc8e490ebe125bfc70a28e89ddaf commit 7a051c0a7890dc8e490ebe125bfc70a28e89ddaf Author: Michael Tuexen AuthorDate: 2021-01-23 19:56:45 +0000 Commit: Michael Tuexen CommitDate: 2021-01-23 23:07:41 +0000 sctp: improve consistency No functional change intended. MFC: 1 week --- sys/netinet/sctp_input.c | 2 +- sys/netinet/sctp_output.c | 18 +++++++++--------- sys/netinet/sctp_structs.h | 32 ++++++++++++++++---------------- sys/netinet/sctputil.c | 6 +++--- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 1606e4d9d1cf..43a2b06d1c79 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -1871,9 +1871,9 @@ sctp_process_cookie_existing(struct mbuf *m, int iphlen, int offset, asoc->strmout[i].abandoned_sent[0] = 0; asoc->strmout[i].abandoned_unsent[0] = 0; #endif - stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].next_mid_ordered = 0; stcb->asoc.strmout[i].next_mid_unordered = 0; + stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; } TAILQ_FOREACH_SAFE(strrst, &asoc->resetHead, next_resp, nstrrst) { diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index d8cf063c6b53..67b1aad32f1c 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -3629,9 +3629,8 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er } for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); + stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); stcb->asoc.strmout[i].chunks_on_queues = 0; - stcb->asoc.strmout[i].next_mid_ordered = 0; - stcb->asoc.strmout[i].next_mid_unordered = 0; #if defined(SCTP_DETAILED_STR_STATS) for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { stcb->asoc.strmout[i].abandoned_sent[j] = 0; @@ -3641,10 +3640,11 @@ sctp_process_cmsgs_for_init(struct sctp_tcb *stcb, struct mbuf *control, int *er stcb->asoc.strmout[i].abandoned_sent[0] = 0; stcb->asoc.strmout[i].abandoned_unsent[0] = 0; #endif + stcb->asoc.strmout[i].next_mid_ordered = 0; + stcb->asoc.strmout[i].next_mid_unordered = 0; stcb->asoc.strmout[i].sid = i; stcb->asoc.strmout[i].last_msg_incomplete = 0; stcb->asoc.strmout[i].state = SCTP_STREAM_OPENING; - stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); } } break; @@ -12136,18 +12136,18 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1); for (i = 0; i < stcb->asoc.streamoutcnt; i++) { TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); - stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; - stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered; - stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; - stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; - stcb->asoc.strmout[i].sid = i; - stcb->asoc.strmout[i].state = oldstream[i].state; /* FIX ME FIX ME */ /* * This should be a SS_COPY operation FIX ME STREAM * SCHEDULER EXPERT */ stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); + stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; + stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered; + stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; + stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; + stcb->asoc.strmout[i].sid = i; + stcb->asoc.strmout[i].state = oldstream[i].state; /* now anything on those queues? */ TAILQ_FOREACH_SAFE(sp, &oldstream[i].outqueue, next, nsp) { TAILQ_REMOVE(&oldstream[i].outqueue, sp, next); diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index 52fe30098ad7..a22dac047971 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -548,6 +548,20 @@ struct sctp_stream_in { TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out); TAILQ_HEAD(sctplist_listhead, sctp_stream_queue_pending); +/* + * This union holds all data necessary for + * different stream schedulers. + */ +struct scheduling_data { + struct sctp_stream_out *locked_on_sending; + /* circular looking for output selection */ + struct sctp_stream_out *last_out_stream; + union { + struct sctpwheel_listhead wheel; + struct sctplist_listhead list; + } out; +}; + /* Round-robin schedulers */ struct ss_rr { /* next link in wheel */ @@ -570,20 +584,6 @@ struct ss_fb { int32_t rounds; }; -/* - * This union holds all data necessary for - * different stream schedulers. - */ -struct scheduling_data { - struct sctp_stream_out *locked_on_sending; - /* circular looking for output selection */ - struct sctp_stream_out *last_out_stream; - union { - struct sctpwheel_listhead wheel; - struct sctplist_listhead list; - } out; -}; - /* * This union holds all parameters per stream * necessary for different stream schedulers. @@ -601,8 +601,6 @@ union scheduling_parameters { #define SCTP_STREAM_RESET_PENDING 0x03 #define SCTP_STREAM_RESET_IN_FLIGHT 0x04 -#define SCTP_MAX_STREAMS_AT_ONCE_RESET 200 - /* This struct is used to track the traffic on outbound streams */ struct sctp_stream_out { struct sctp_streamhead outqueue; @@ -627,6 +625,8 @@ struct sctp_stream_out { uint8_t state; }; +#define SCTP_MAX_STREAMS_AT_ONCE_RESET 200 + /* used to keep track of the addresses yet to try to add/delete */ TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr); struct sctp_asconf_addr { diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 7772ebd57327..084b7bd6af72 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1291,9 +1291,8 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, * that were dropped must be notified to the upper layer as * failed to send. */ - asoc->strmout[i].next_mid_ordered = 0; - asoc->strmout[i].next_mid_unordered = 0; TAILQ_INIT(&asoc->strmout[i].outqueue); + asoc->ss_functions.sctp_ss_init_stream(stcb, &asoc->strmout[i], NULL); asoc->strmout[i].chunks_on_queues = 0; #if defined(SCTP_DETAILED_STR_STATS) for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { @@ -1304,10 +1303,11 @@ sctp_init_asoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, asoc->strmout[i].abandoned_sent[0] = 0; asoc->strmout[i].abandoned_unsent[0] = 0; #endif + asoc->strmout[i].next_mid_ordered = 0; + asoc->strmout[i].next_mid_unordered = 0; asoc->strmout[i].sid = i; asoc->strmout[i].last_msg_incomplete = 0; asoc->strmout[i].state = SCTP_STREAM_OPENING; - asoc->ss_functions.sctp_ss_init_stream(stcb, &asoc->strmout[i], NULL); } asoc->ss_functions.sctp_ss_init(stcb, asoc, 0); From owner-dev-commits-src-main@freebsd.org Sun Jan 24 10:18:19 2021 Return-Path: Delivered-To: dev-commits-src-main@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 EFF814F62F3; Sun, 24 Jan 2021 10:18:19 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNpqH6Vhgz4nf0; Sun, 24 Jan 2021 10:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1FA221D97; Sun, 24 Jan 2021 10:18:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OAIJHl075532; Sun, 24 Jan 2021 10:18:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OAIJi4075531; Sun, 24 Jan 2021 10:18:19 GMT (envelope-from git) Date: Sun, 24 Jan 2021 10:18:19 GMT Message-Id: <202101241018.10OAIJi4075531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 0f7573ffd614 - main - sctp: fix PR-SCTP stats when adding addtional streams MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f7573ffd6141b19419c9a6238246b9ba0e6dce6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 10:18:20 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=0f7573ffd6141b19419c9a6238246b9ba0e6dce6 commit 0f7573ffd6141b19419c9a6238246b9ba0e6dce6 Author: Michael Tuexen AuthorDate: 2021-01-23 23:50:33 +0000 Commit: Michael Tuexen CommitDate: 2021-01-23 23:50:33 +0000 sctp: fix PR-SCTP stats when adding addtional streams MFC after: 1 week --- sys/netinet/sctp_output.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 67b1aad32f1c..d58ebf785238 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12143,6 +12143,15 @@ sctp_send_str_reset_req(struct sctp_tcb *stcb, */ stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; +#if defined(SCTP_DETAILED_STR_STATS) + for (j = 0; j < SCTP_PR_SCTP_MAX + 1; j++) { + stcb->asoc.strmout[i].abandoned_sent[j] = oldstream[i].abandoned_sent[j]; + stcb->asoc.strmout[i].abandoned_unsent[j] = oldstream[i].abandoned_unsent[j]; + } +#else + stcb->asoc.strmout[i].abandoned_sent[0] = oldstream[i].abandoned_sent[0]; + stcb->asoc.strmout[i].abandoned_unsent[0] = oldstream[i].abandoned_unsent[0]; +#endif stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered; stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; From owner-dev-commits-src-main@freebsd.org Sun Jan 24 11:06:50 2021 Return-Path: Delivered-To: dev-commits-src-main@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 A62754F7977; Sun, 24 Jan 2021 11:06:50 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNqvG4L2wz4rN2; Sun, 24 Jan 2021 11:06:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8374322823; Sun, 24 Jan 2021 11:06:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OB6of8040766; Sun, 24 Jan 2021 11:06:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OB6oFI040765; Sun, 24 Jan 2021 11:06:50 GMT (envelope-from git) Date: Sun, 24 Jan 2021 11:06:50 GMT Message-Id: <202101241106.10OB6oFI040765@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 97a463120bf9 - main - libc: skip spurious stat in _gettemp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97a463120bf99819fcb21a781e410fb43dde2a43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 11:06:50 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=97a463120bf99819fcb21a781e410fb43dde2a43 commit 97a463120bf99819fcb21a781e410fb43dde2a43 Author: Mateusz Guzik AuthorDate: 2021-01-24 04:15:13 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-24 11:06:36 +0000 libc: skip spurious stat in _gettemp It was only done to catch ENOTDIR, but the kernel already returns the error where appropriate. --- lib/libc/stdio/mktemp.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index f08d92cc3ec7..f64eda748d0b 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -121,7 +121,6 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) char *start, *trv, *suffp, *carryp; char *pad; struct stat sbuf; - int rval; uint32_t rand; char carrybuf[MAXPATHLEN]; @@ -156,26 +155,6 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) /* save first combination of random characters */ memcpy(carrybuf, start, suffp - start); - /* - * check the target directory. - */ - if (doopen != NULL || domkdir) { - for (; trv > path; --trv) { - if (*trv == '/') { - *trv = '\0'; - rval = fstatat(dfd, path, &sbuf, 0); - *trv = '/'; - if (rval != 0) - return (0); - if (!S_ISDIR(sbuf.st_mode)) { - errno = ENOTDIR; - return (0); - } - break; - } - } - } - oflags |= O_CREAT | O_EXCL | O_RDWR; for (;;) { if (doopen) { From owner-dev-commits-src-main@freebsd.org Sun Jan 24 11:06:53 2021 Return-Path: Delivered-To: dev-commits-src-main@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 DB6244F7B57; Sun, 24 Jan 2021 11:06:53 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNqvK29Yfz4rcD; Sun, 24 Jan 2021 11:06:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CADEC2244C; Sun, 24 Jan 2021 11:06:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OB6qea040807; Sun, 24 Jan 2021 11:06:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OB6qgU040806; Sun, 24 Jan 2021 11:06:52 GMT (envelope-from git) Date: Sun, 24 Jan 2021 11:06:52 GMT Message-Id: <202101241106.10OB6qgU040806@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: b22fdf45ff8e - main - libc: try to skip memcpy in _gettemp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b22fdf45ff8ef1d1f9a6c28f1d7f59ca4b012da6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 11:06:54 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=b22fdf45ff8ef1d1f9a6c28f1d7f59ca4b012da6 commit b22fdf45ff8ef1d1f9a6c28f1d7f59ca4b012da6 Author: Mateusz Guzik AuthorDate: 2021-01-24 04:34:22 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-24 11:06:36 +0000 libc: try to skip memcpy in _gettemp --- lib/libc/stdio/mktemp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index c47e0221e5cd..0ede3058a3d5 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -123,6 +123,7 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) struct stat sbuf; uint32_t rand; char carrybuf[MAXPATHLEN]; + int saved; if ((doopen != NULL && domkdir) || slen < 0 || (oflags & ~(O_APPEND | O_DIRECT | O_SHLOCK | O_EXLOCK | O_SYNC | @@ -151,9 +152,7 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) } start = trv + 1; - /* save first combination of random characters */ - memcpy(carrybuf, start, suffp - start); - + saved = 0; oflags |= O_CREAT | O_EXCL | O_RDWR; for (;;) { if (doopen) { @@ -170,6 +169,12 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) } else if (lstat(path, &sbuf)) return (errno == ENOENT); + /* save first combination of random characters */ + if (!saved) { + memcpy(carrybuf, start, suffp - start); + saved = 1; + } + /* If we have a collision, cycle through the space of filenames */ for (trv = start, carryp = carrybuf;;) { /* have we tried all possible permutations? */ From owner-dev-commits-src-main@freebsd.org Sun Jan 24 11:06:51 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BD26D4F7D92; Sun, 24 Jan 2021 11:06:51 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNqvH4hPxz4rTX; Sun, 24 Jan 2021 11:06:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93A7D22A80; Sun, 24 Jan 2021 11:06:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OB6pdY040785; Sun, 24 Jan 2021 11:06:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OB6pTt040783; Sun, 24 Jan 2021 11:06:51 GMT (envelope-from git) Date: Sun, 24 Jan 2021 11:06:51 GMT Message-Id: <202101241106.10OB6pTt040783@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 6fe328ace8f4 - main - libc: remove open-coded strlen in _gettemp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6fe328ace8f418bab0ab7f78c6fa1f2e757dd8a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 11:06:51 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=6fe328ace8f418bab0ab7f78c6fa1f2e757dd8a9 commit 6fe328ace8f418bab0ab7f78c6fa1f2e757dd8a9 Author: Mateusz Guzik AuthorDate: 2021-01-24 04:32:46 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-24 11:06:36 +0000 libc: remove open-coded strlen in _gettemp --- lib/libc/stdio/mktemp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c index f64eda748d0b..c47e0221e5cd 100644 --- a/lib/libc/stdio/mktemp.c +++ b/lib/libc/stdio/mktemp.c @@ -131,8 +131,7 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags) return (0); } - for (trv = path; *trv != '\0'; ++trv) - ; + trv = path + strlen(path); if (trv - path >= MAXPATHLEN) { errno = ENAMETOOLONG; return (0); From owner-dev-commits-src-main@freebsd.org Sun Jan 24 14:03:37 2021 Return-Path: Delivered-To: dev-commits-src-main@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 44A754FD00E; Sun, 24 Jan 2021 14:03:37 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNvqF1Tl5z3KZZ; Sun, 24 Jan 2021 14:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2438324C3A; Sun, 24 Jan 2021 14:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OE3bjV074106; Sun, 24 Jan 2021 14:03:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OE3bOD074105; Sun, 24 Jan 2021 14:03:37 GMT (envelope-from git) Date: Sun, 24 Jan 2021 14:03:37 GMT Message-Id: <202101241403.10OE3bOD074105@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gordon Bergling Subject: git: 1f73236b0302 - main - Add a manual page for axp(4) / AMD 10G Ethernet driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f73236b0302cdf47630c99687c2dfd4e514ab54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 14:03:37 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1f73236b0302cdf47630c99687c2dfd4e514ab54 commit 1f73236b0302cdf47630c99687c2dfd4e514ab54 Author: Gordon Bergling AuthorDate: 2021-01-24 13:57:16 +0000 Commit: Gordon Bergling CommitDate: 2021-01-24 13:57:16 +0000 Add a manual page for axp(4) / AMD 10G Ethernet driver Submitted by: Rajesh Kumar Reviewed by: bcr, brueffer, rpokala MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27800 --- share/man/man4/Makefile | 1 + share/man/man4/axp.4 | 225 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 226 insertions(+) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index ffc7a08292e9..10034a72d608 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -69,6 +69,7 @@ MAN= aac.4 \ aue.4 \ axe.4 \ axge.4 \ + axp.4 \ bce.4 \ bcma.4 \ bfe.4 \ diff --git a/share/man/man4/axp.4 b/share/man/man4/axp.4 new file mode 100644 index 000000000000..598e6a968e7a --- /dev/null +++ b/share/man/man4/axp.4 @@ -0,0 +1,225 @@ +.\" Copyright (c) 2020, Advanced Micro Devices Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright notice, +.\" this list of conditions and the following disclaimer. +.\" +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" 3. Neither the name of Advanced Micro Devices Inc., nor the names of its +.\" contributors may be used to endorse or promote products derived from +.\" this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. +.\" +.\" * Other names and brands may be claimed as the property of others. +.\" +.Dd January 24, 2021 +.Dt AXP 4 +.Os +.Sh NAME +.Nm axp +.Nd "Advanced Micro Devices 10G Ethernet driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device iflib" +.Cd "device axp" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_axp_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver enables PCI-E based 10G Ethernet controller inbuilt in the +AMD EPYC processors. +.Pp +The following features are supported. +.Pp +.Bl -bullet -compact +.It +1G/10G SFP+ Link +.It +Jumbo frames (9000 Bytes) +.It +Transmit and Receive checksum offload +.It +TCP segmentation offload (TSO) +.It +VLAN tag insertion/extraction +.It +VLAN checksum offload +.It +VLAN TSO +.It +Receive side steering (RSS) +.It +IPV4 and IPV6 capable +.It +MSI-X interrupts +.It +Split header +.El +.Pp +All the above mentioned features are enabled by default. +.Pp +For hardware related questions, please refer the documentation supplied +along with AMD EPYC processors. +.Sh SYSCTL VARIABLES +The following variables are available as +.Xr sysctl 8 +variables: +.Bl -tag -width indent +.It Va dev.ax.X.mac_stats +Dumps the transmit and receive statistics counter values for the controller. +This includes statistics specific to each transmit and receive queue. +.It Va dev.ax.X.channels_info +Dumps the permissible and default configured transmit and receive channel +information. +.It Va dev.ax.X.ringparam_info +Dumps the permissible and default configured descriptor information for the +transmit and receive queue. +.It Va dev.ax.X.link_ksettings_info +Dumps the current link setting like link mode, speed, duplex settings. +.It Va dev.ax.X.pauseparam_info +Dumps the current flow-control settings. +.It Va dev.ax.X.coalesce_info +Dumps the current interrupt coalescing settings. +.It Va dev.ax.X.link_info +Dumps the current state of the Link. +.It Va dev.ax.X.drv_info +Dumps the driver and controller firmware version information. +.It Va dev.ax.X.YYYY_register +.It Va dev.ax.X.YYYY_register_values +Sysctl to dump a specific register from a specific block of the controller. +YYYY specifies the block. +The following blocks are supported. +.Bl -bullet -compact +.It +xpcs +.It +xgmac +.It +xprop +.It +xi2c +.El +.Pp +Set the offset of the register to the first variable, and then read the value +of the register by reading the second variable. +.It Va dev.ax.X.axgbe_debug_level +Configure the log-level for the driver. +Default is 0. +Supports 0-3. +.It Va dev.ax.X.single_fl +This variable must be set before loading the driver, either via +.Xr loader.conf 5 +or through the use of +.Xr kenv 1 . +This cannot be modified when driver is loaded. +.Pp +Setting this variable in +.Xr loader.conf 5 +needs the system to be restarted to take effect. +When using +.Xr kenv 1 , +use the wrapper variable +.Va dev.ax.single_fl\&, +which will configure all AMD interfaces with single freelist per receive queue. +Default is 2 freelist per receive queue. +.Pp +This variable is to configure the interface when single freelist is needed. +(For Eg. netmap). +Basically, this will control the software behavior of how the receive +descriptors are used. +.Pp +Setting this variable to 1, will use 1 Freelist per receive queue. +.Pp +Setting this variable to 0, will use 2 Freelist per receive queue. +.Pp +Based on the setting, the receive buffers are programmed accordingly on the +received descriptors. +.Pp +By default, this variable will be set to 0, meaning the interfaces will be +configured for regular data traffic (not netmap traffic). +.It Va dev.ax.X.sph_enabled +This variable must be set before loading the driver, either via +.Xr loader.conf 5 +or through the use of +.Xr kenv 1 . +This cannot be modified when driver is loaded. +.Pp +Setting this variable in +.Xr loader.conf 5 +needs the system to be restarted to take effect. +When using +.Xr kenv 1 , +use the wrapper variable +.Va dev.ax.sph_enable\&, +which will configure(enable/disable) split header support in all +AMD interfaces. +.Pp +This variable is to control enable/disable of the split header feature in +the interface. +.Pp +Setting this variable to 1, will enable split header feature. +.Pp +Setting this variable to 0, will disable split header feature. +.Pp +By default, this variable will be set to 1, meaning the Split header support be +enabled. +.Pp +NOTE: It is recommended to use this variable only when +.Va single_fl\& +is configured. +Otherwise let it be default value. +.El +.Sh SEE ALSO +.Xr arp 4 , +.Xr iflib 4 , +.Xr netmap 4 , +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 13.0 . +.Pp +Another version of the driver is already present in +.Fx . +This driver was named as "axgbe" earlier, which is renamed as "axa" now. +This driver is for the ACPI based Ethernet controllers in the previous/older +version of the hardware. +This driver is authored by +.Aq Mt andrew@FreeBSD.org . +.Sh AUTHORS +The +.Nm +device driver was written by +.An Advanced Micro Devices Inc . +.Pp +For any issues and support requirements, email the details to +.Aq Mt rajesh1.kumar@amd.com . From owner-dev-commits-src-main@freebsd.org Sun Jan 24 15:22:57 2021 Return-Path: Delivered-To: dev-commits-src-main@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 5EC414FEEFD; Sun, 24 Jan 2021 15:22:57 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DNxZn2F01z3Qt0; Sun, 24 Jan 2021 15:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F64425D1B; Sun, 24 Jan 2021 15:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OFMvwV078623; Sun, 24 Jan 2021 15:22:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OFMvew078622; Sun, 24 Jan 2021 15:22:57 GMT (envelope-from git) Date: Sun, 24 Jan 2021 15:22:57 GMT Message-Id: <202101241522.10OFMvew078622@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 25611bc0abf8 - main - cxgbetool: correct utilties typo MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25611bc0abf8a21f90cf3a702d6163b23bb7bed5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 15:22:57 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=25611bc0abf8a21f90cf3a702d6163b23bb7bed5 commit 25611bc0abf8a21f90cf3a702d6163b23bb7bed5 Author: Ed Maste AuthorDate: 2021-01-24 15:21:53 +0000 Commit: Ed Maste CommitDate: 2021-01-24 15:21:53 +0000 cxgbetool: correct utilties typo --- usr.sbin/cxgbetool/tcb_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/cxgbetool/tcb_common.c b/usr.sbin/cxgbetool/tcb_common.c index b17889f94a88..c6c3fed19c3e 100644 --- a/usr.sbin/cxgbetool/tcb_common.c +++ b/usr.sbin/cxgbetool/tcb_common.c @@ -169,7 +169,7 @@ tcb_startswith_nc(char *cs, char *ct) /***:----------------------------------------------------------------------- - ***: print utilties + ***: print utilities ***:----------------------------------------------------------------------- */ From owner-dev-commits-src-main@freebsd.org Sun Jan 24 17:25:35 2021 Return-Path: Delivered-To: dev-commits-src-main@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 CB6724D3052; Sun, 24 Jan 2021 17:25:35 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP0JH5MhFz3qR9; Sun, 24 Jan 2021 17:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABB35274BB; Sun, 24 Jan 2021 17:25:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OHPZbb034744; Sun, 24 Jan 2021 17:25:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OHPZXg034743; Sun, 24 Jan 2021 17:25:35 GMT (envelope-from git) Date: Sun, 24 Jan 2021 17:25:35 GMT Message-Id: <202101241725.10OHPZXg034743@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 7680431a38cc - main - Regen src.conf.5 after LLD description updates MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7680431a38cc2624f7415012fb9d21d7bdb3f8c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 17:25:35 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=7680431a38cc2624f7415012fb9d21d7bdb3f8c9 commit 7680431a38cc2624f7415012fb9d21d7bdb3f8c9 Author: Ed Maste AuthorDate: 2021-01-24 17:25:04 +0000 Commit: Ed Maste CommitDate: 2021-01-24 17:25:04 +0000 Regen src.conf.5 after LLD description updates --- share/man/man5/src.conf.5 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 63495c7c9477..adee40aa3088 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd January 22, 2021 +.Dd January 24, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -879,10 +879,14 @@ amd64/amd64, arm64/aarch64 and i386/i386. .It Va WITHOUT_LLD_BOOTSTRAP Set to not build the LLD linker during the bootstrap phase of the build. -To be able to build the system, either Binutils or LLD bootstrap must be -enabled unless an alternate linker is provided via XLD. +To be able to build the system an alternate linker must be provided via XLD. .It Va WITHOUT_LLD_IS_LD -Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. +Do not install a +.Pa /usr/bin/ld symlink +to +.Pa ld.lld . +The system will not have a usable tool chain unless a linker is provided +some other way. .It Va WITHOUT_LLVM_ASSERTIONS Set to disable debugging assertions in LLVM. .It Va WITHOUT_LLVM_COV From owner-dev-commits-src-main@freebsd.org Sun Jan 24 17:25:34 2021 Return-Path: Delivered-To: dev-commits-src-main@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 B976B4D332A; Sun, 24 Jan 2021 17:25:34 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP0JG4RhZz3qR8; Sun, 24 Jan 2021 17:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B9FA27436; Sun, 24 Jan 2021 17:25:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OHPYeg034721; Sun, 24 Jan 2021 17:25:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OHPYXc034720; Sun, 24 Jan 2021 17:25:34 GMT (envelope-from git) Date: Sun, 24 Jan 2021 17:25:34 GMT Message-Id: <202101241725.10OHPYXc034720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: b23665f3169b - main - Remove Binutils from src.conf(5) option descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b23665f3169b7b0364416060855541b450204d6d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 17:25:34 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b23665f3169b7b0364416060855541b450204d6d commit b23665f3169b7b0364416060855541b450204d6d Author: Ed Maste AuthorDate: 2021-01-24 17:22:01 +0000 Commit: Ed Maste CommitDate: 2021-01-24 17:22:01 +0000 Remove Binutils from src.conf(5) option descriptions All binutils remnants have been removed before FreeBSD 13. PR: 252842 MFC after: 3 days Sponsored by: The FreeBSD Foundation --- tools/build/options/WITHOUT_LLD_BOOTSTRAP | 3 +-- tools/build/options/WITHOUT_LLD_IS_LD | 7 ++++++- tools/build/options/WITH_LLD_IS_LD | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/build/options/WITHOUT_LLD_BOOTSTRAP b/tools/build/options/WITHOUT_LLD_BOOTSTRAP index 646edd341c35..d9824c51b23c 100644 --- a/tools/build/options/WITHOUT_LLD_BOOTSTRAP +++ b/tools/build/options/WITHOUT_LLD_BOOTSTRAP @@ -1,5 +1,4 @@ .\" $FreeBSD$ Set to not build the LLD linker during the bootstrap phase of the build. -To be able to build the system, either Binutils or LLD bootstrap must be -enabled unless an alternate linker is provided via XLD. +To be able to build the system an alternate linker must be provided via XLD. diff --git a/tools/build/options/WITHOUT_LLD_IS_LD b/tools/build/options/WITHOUT_LLD_IS_LD index 0d48f205d85d..8ca789dfdc45 100644 --- a/tools/build/options/WITHOUT_LLD_IS_LD +++ b/tools/build/options/WITHOUT_LLD_IS_LD @@ -1,2 +1,7 @@ .\" $FreeBSD$ -Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. +Do not install a +.Pa /usr/bin/ld symlink +to +.Pa ld.lld . +The system will not have a usable tool chain unless a linker is provided +some other way. diff --git a/tools/build/options/WITH_LLD_IS_LD b/tools/build/options/WITH_LLD_IS_LD index a291b099bf06..9a07c71fdeda 100644 --- a/tools/build/options/WITH_LLD_IS_LD +++ b/tools/build/options/WITH_LLD_IS_LD @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to use LLVM's LLD as the system linker, instead of GNU binutils ld. +Set to use LLVM's LLD as the system linker. From owner-dev-commits-src-main@freebsd.org Sun Jan 24 19:12:50 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E8EA54D6939; Sun, 24 Jan 2021 19:12:50 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP2h26BHbz4Rjc; Sun, 24 Jan 2021 19:12:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C77E5BAE; Sun, 24 Jan 2021 19:12:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OJCoi6077097; Sun, 24 Jan 2021 19:12:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OJCode077096; Sun, 24 Jan 2021 19:12:50 GMT (envelope-from git) Date: Sun, 24 Jan 2021 19:12:50 GMT Message-Id: <202101241912.10OJCode077096@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: b31dae0caa02 - main - Exclude reserved iSCSI Target Transfer Tag. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b31dae0caa0286820805951842fa871f71b33d75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 19:12:51 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=b31dae0caa0286820805951842fa871f71b33d75 commit b31dae0caa0286820805951842fa871f71b33d75 Author: Alexander Motin AuthorDate: 2021-01-24 18:58:29 +0000 Commit: Alexander Motin CommitDate: 2021-01-24 18:58:29 +0000 Exclude reserved iSCSI Target Transfer Tag. RFC 7143 (11.7.4): The Target Transfer Tag values are not specified by this protocol, except that the value 0xffffffff is reserved and means that the Target Transfer Tag is not supplied. MFC after: 1 month --- sys/cam/ctl/ctl_frontend_iscsi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 996ab4e44fc0..8b0effcaf393 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -2693,6 +2693,10 @@ cfiscsi_datamove_out(union ctl_io *io) target_transfer_tag = atomic_fetchadd_32(&cs->cs_target_transfer_tag, 1); + if (target_transfer_tag == 0xffffffff) { + target_transfer_tag = + atomic_fetchadd_32(&cs->cs_target_transfer_tag, 1); + } cdw = cfiscsi_data_wait_new(cs, io, bhssc->bhssc_initiator_task_tag, &target_transfer_tag); if (cdw == NULL) { From owner-dev-commits-src-main@freebsd.org Sun Jan 24 19:24:58 2021 Return-Path: Delivered-To: dev-commits-src-main@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 7384A4D752C; Sun, 24 Jan 2021 19:24:58 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP2y22pY8z4Sr6; Sun, 24 Jan 2021 19:24:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 528DC974; Sun, 24 Jan 2021 19:24:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OJOwSH090892; Sun, 24 Jan 2021 19:24:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OJOwHq090890; Sun, 24 Jan 2021 19:24:58 GMT (envelope-from git) Date: Sun, 24 Jan 2021 19:24:58 GMT Message-Id: <202101241924.10OJOwHq090890@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 9bee9a98ff7f - main - Exclude reserved iSCSI Initiator Task Tag. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9bee9a98ff7f9de093314abaf7c46ca89c4020d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 19:24:58 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=9bee9a98ff7f9de093314abaf7c46ca89c4020d9 commit 9bee9a98ff7f9de093314abaf7c46ca89c4020d9 Author: Alexander Motin AuthorDate: 2021-01-24 19:23:04 +0000 Commit: Alexander Motin CommitDate: 2021-01-24 19:23:04 +0000 Exclude reserved iSCSI Initiator Task Tag. RFC 7143 (11.2.1.8): An ITT value of 0xffffffff is reserved and MUST NOT be assigned for a task by the initiator. The only instance in which it may be seen on the wire is in a target-initiated NOP-In PDU (Section 11.19) and in the initiator response to that PDU, if necessary. MFC after: 1 month --- sys/dev/iscsi/iscsi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index eaaf84de9594..5e6c80255bff 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -2194,6 +2194,8 @@ iscsi_action_abort(struct iscsi_session *is, union ccb *ccb) } initiator_task_tag = is->is_initiator_task_tag++; + if (initiator_task_tag == 0xffffffff) + initiator_task_tag = is->is_initiator_task_tag++; io = iscsi_outstanding_add(is, request, NULL, &initiator_task_tag); if (io == NULL) { @@ -2254,6 +2256,9 @@ iscsi_action_scsiio(struct iscsi_session *is, union ccb *ccb) } initiator_task_tag = is->is_initiator_task_tag++; + if (initiator_task_tag == 0xffffffff) + initiator_task_tag = is->is_initiator_task_tag++; + io = iscsi_outstanding_add(is, request, ccb, &initiator_task_tag); if (io == NULL) { icl_pdu_free(request); From owner-dev-commits-src-main@freebsd.org Sun Jan 24 19:41:13 2021 Return-Path: Delivered-To: dev-commits-src-main@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 0DE774D77E9; Sun, 24 Jan 2021 19:41:13 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP3Jm70bhz4V4m; Sun, 24 Jan 2021 19:41:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E32731207; Sun, 24 Jan 2021 19:41:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OJfCfc013082; Sun, 24 Jan 2021 19:41:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OJfCGA013081; Sun, 24 Jan 2021 19:41:12 GMT (envelope-from git) Date: Sun, 24 Jan 2021 19:41:12 GMT Message-Id: <202101241941.10OJfCGA013081@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 5fe433a6e4d8 - main - netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5fe433a6e4d8cab6b64284698301afc0c55a9db2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 19:41:13 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=5fe433a6e4d8cab6b64284698301afc0c55a9db2 commit 5fe433a6e4d8cab6b64284698301afc0c55a9db2 Author: Neel Chauhan AuthorDate: 2021-01-24 19:23:39 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-01-24 19:38:35 +0000 netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support This extends upon the RFC 6598 support to libalias/ipfw in r357092. Reviewed By: manpages (bcr), donner, adrian, kp Approved by: kp (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D23461 --- share/man/man4/ng_nat.4 | 8 +++++++- sys/netgraph/ng_nat.c | 2 ++ sys/netgraph/ng_nat.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/share/man/man4/ng_nat.4 b/share/man/man4/ng_nat.4 index b7c65fe89b20..e9c0f2acbcee 100644 --- a/share/man/man4/ng_nat.4 +++ b/share/man/man4/ng_nat.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2018 +.Dd January 24, 2021 .Dt NG_NAT 4 .Os .Sh NAME @@ -75,7 +75,13 @@ struct ng_nat_mode { #define NG_NAT_RESET_ON_ADDR_CHANGE 0x20 #define NG_NAT_PROXY_ONLY 0x40 #define NG_NAT_REVERSE 0x80 +#define NG_NAT_UNREGISTERED_CGN 0x100 .Ed +.Pp +The corresponding libalias flags can be found by replacing the +.Vt "NG_NAT" +prefix with +.Vt "PKT_ALIAS" . .It Dv NGM_NAT_SET_TARGET Pq Ic settarget Configure target address for a node. When an incoming packet not associated with any pre-existing aliasing diff --git a/sys/netgraph/ng_nat.c b/sys/netgraph/ng_nat.c index a5c776ef6db6..cd3442914311 100644 --- a/sys/netgraph/ng_nat.c +++ b/sys/netgraph/ng_nat.c @@ -961,6 +961,8 @@ ng_nat_translate_flags(unsigned int x) res |= PKT_ALIAS_PROXY_ONLY; if (x & NG_NAT_REVERSE) res |= PKT_ALIAS_REVERSE; + if (x & NG_NAT_UNREGISTERED_CGN) + res |= PKT_ALIAS_UNREGISTERED_CGN; return (res); } diff --git a/sys/netgraph/ng_nat.h b/sys/netgraph/ng_nat.h index 46c9609772ff..b56d45c10671 100644 --- a/sys/netgraph/ng_nat.h +++ b/sys/netgraph/ng_nat.h @@ -54,6 +54,7 @@ struct ng_nat_mode { #define NG_NAT_RESET_ON_ADDR_CHANGE 0x20 #define NG_NAT_PROXY_ONLY 0x40 #define NG_NAT_REVERSE 0x80 +#define NG_NAT_UNREGISTERED_CGN 0x100 #define NG_NAT_DESC_LENGTH 64 #define NG_NAT_REDIRPROTO_ADDR (IPPROTO_MAX + 3) /* LibAlias' LINK_ADDR, also unused in in.h */ From owner-dev-commits-src-main@freebsd.org Sun Jan 24 19:46:57 2021 Return-Path: Delivered-To: dev-commits-src-main@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 E15554D815C; Sun, 24 Jan 2021 19:46:57 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::19]) (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 4DP3RP4ZnJz4VZD; Sun, 24 Jan 2021 19:46:57 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 10OJke5f027025 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 24 Jan 2021 20:46:40 +0100 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 10OJkeEv006623; Sun, 24 Jan 2021 20:46:40 +0100 Date: Sun, 24 Jan 2021 20:46:40 +0100 From: Lutz Donnerhacke To: Lutz Donnerhacke Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 5fe433a6e4d8 - main - netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support Message-ID: <20210124194640.GA6527@belenus.iks-jena.de> References: <202101241941.10OJfCGA013081@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202101241941.10OJfCGA013081@gitrepo.freebsd.org> X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4DP3RP4ZnJz4VZD X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 19:46:57 -0000 On Sun, Jan 24, 2021 at 07:41:12PM +0000, Lutz Donnerhacke wrote: > commit 5fe433a6e4d8cab6b64284698301afc0c55a9db2 > Author: Neel Chauhan > AuthorDate: 2021-01-24 19:23:39 +0000 > Commit: Lutz Donnerhacke > CommitDate: 2021-01-24 19:38:35 +0000 > > netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support > > This extends upon the RFC 6598 support to libalias/ipfw in r357092. > > Reviewed By: manpages (bcr), donner, adrian, kp > Approved by: kp (mentor) > MFC after: 1 month > Differential Revision: https://reviews.freebsd.org/D23461 git allows us to distinguish between Author and Committer. I used this (after a discussion with my mentor) to attribute a foreign submission (nc has no src bit) directly to the Autor instead of setting "Submitted by:" (as used under subversion) Question: What is the prefered method to commit for an other person? traditional: > Author: committer > Commit: committer > > patch > Submitted by: author or (as above): > Author: author > Commit: committer > > patch Any opinions? From owner-dev-commits-src-main@freebsd.org Sun Jan 24 19:51:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 8384D4D83D6; Sun, 24 Jan 2021 19:51:45 +0000 (UTC) (envelope-from kevans@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP3Xx3K65z4VxN; Sun, 24 Jan 2021 19:51:45 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 601DD2652F; Sun, 24 Jan 2021 19:51:45 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f46.google.com with SMTP id cu2so5264499qvb.12; Sun, 24 Jan 2021 11:51:45 -0800 (PST) X-Gm-Message-State: AOAM533ky41SNheNDSWKbcp1Y5Q2ywv/4DvKNk0dM2vCGXb07iSTKvYD eTx3sLcuT67NqEmCQqHHgLpHAiY750Ih/0ePvE8= X-Google-Smtp-Source: ABdhPJxxRnzeAhmBlZ4RI14CZVFEOkeGU7nVuxAhb3hdsCnDbtHFEtmUZk1Esh3apituvOYlsw8uUAfKxxjPp+VYttA= X-Received: by 2002:a0c:f601:: with SMTP id r1mr595118qvm.39.1611517904940; Sun, 24 Jan 2021 11:51:44 -0800 (PST) MIME-Version: 1.0 References: <202101241941.10OJfCGA013081@gitrepo.freebsd.org> <20210124194640.GA6527@belenus.iks-jena.de> In-Reply-To: <20210124194640.GA6527@belenus.iks-jena.de> From: Kyle Evans Date: Sun, 24 Jan 2021 13:51:31 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 5fe433a6e4d8 - main - netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support To: Lutz Donnerhacke Cc: Lutz Donnerhacke , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 19:51:45 -0000 On Sun, Jan 24, 2021 at 1:47 PM Lutz Donnerhacke wrote: > > On Sun, Jan 24, 2021 at 07:41:12PM +0000, Lutz Donnerhacke wrote: > > commit 5fe433a6e4d8cab6b64284698301afc0c55a9db2 > > Author: Neel Chauhan > > AuthorDate: 2021-01-24 19:23:39 +0000 > > Commit: Lutz Donnerhacke > > CommitDate: 2021-01-24 19:38:35 +0000 > > > > netgraph/ng_nat: Add RFC 6598/Carrier Grade NAT support > > > > This extends upon the RFC 6598 support to libalias/ipfw in r357092. > > > > Reviewed By: manpages (bcr), donner, adrian, kp > > Approved by: kp (mentor) > > MFC after: 1 month > > Differential Revision: https://reviews.freebsd.org/D23461 > > git allows us to distinguish between Author and Committer. > > I used this (after a discussion with my mentor) to attribute a foreign > submission (nc has no src bit) directly to the Autor instead of setting > "Submitted by:" (as used under subversion) > > Question: What is the prefered method to commit for an other person? > > traditional: > > Author: committer > > Commit: committer > > > > patch > > Submitted by: author > > or (as above): > > Author: author > > Commit: committer > > > > patch > > Any opinions? We switched up the recommendations[0][1] to advocate for what you've done here ~2 weeks ago -- so yes, this is good. :-) Thanks, Kyle Evans [0] https://github.com/bsdimp/freebsd-git-docs/blob/main/meta.md [1] https://github.com/bsdimp/freebsd-git-docs/blob/main/pull-request.md From owner-dev-commits-src-main@freebsd.org Sun Jan 24 20:00:12 2021 Return-Path: Delivered-To: dev-commits-src-main@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 18D1A4D85CB; Sun, 24 Jan 2021 20:00:12 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP3kh0G5tz4W4P; Sun, 24 Jan 2021 20:00:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFC0CFF7; Sun, 24 Jan 2021 20:00:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OK0Bdk033527; Sun, 24 Jan 2021 20:00:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OK0BO7033516; Sun, 24 Jan 2021 20:00:11 GMT (envelope-from git) Date: Sun, 24 Jan 2021 20:00:11 GMT Message-Id: <202101242000.10OK0BO7033516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 576562856efb - main - lualoader: improve loader.conf var processing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 576562856efbec31520aca6a1f72f2b11298e9a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 20:00:12 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=576562856efbec31520aca6a1f72f2b11298e9a7 commit 576562856efbec31520aca6a1f72f2b11298e9a7 Author: Kyle Evans AuthorDate: 2021-01-24 19:25:34 +0000 Commit: Kyle Evans CommitDate: 2021-01-24 19:54:47 +0000 lualoader: improve loader.conf var processing lualoader was previously not processing \ as escapes; this commit fixes that and does better error checking on the value as well. Additionally, loader.conf had some odd restrictions on values that make little sense. Previously, lines like: kernel=foo Would simply be discarded with a malformed line complaint you might not see unless you disable beastie. lualoader tries to process these as well as it can and manipulates the environment, while forthloader did minimal processing and constructed a `set` command to do the heavy lifting instead. The lua approach was re-envisioned from building a `set` command so that we can appropriately reset the environment when, for example, boot environments change. Lift the previous restrictions to allow unquoted values on the right hand side of an expression. Note that an unquoted value is effectively: [A-Za-z0-9-][A-Za-z0-9-_.]* This commit also stops trying to weirdly limit what it can handle in a quoted value. Previously it only allowed spaces, alphanumeric, and punctuation, which is kind of weird. Change it here to grab as much as it can between two sets of quotes, then let processEnvVar() do the needful and complain if it finds something malformed looking. My extremely sophisticated test suite is as follows: < Delivered-To: dev-commits-src-main@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 293064DB880; Sun, 24 Jan 2021 21:21:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP5Xn0jWPz4cty; Sun, 24 Jan 2021 21:21:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B39C2792; Sun, 24 Jan 2021 21:21:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OLLiVU046358; Sun, 24 Jan 2021 21:21:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OLLiVm046357; Sun, 24 Jan 2021 21:21:44 GMT (envelope-from git) Date: Sun, 24 Jan 2021 21:21:44 GMT Message-Id: <202101242121.10OLLiVm046357@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: aceaccab659c - main - iflib: netmap: add support for NS_MOREFRAG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aceaccab659c9eb846fb21ff99be34434a9616c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 21:21:45 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=aceaccab659c9eb846fb21ff99be34434a9616c7 commit aceaccab659c9eb846fb21ff99be34434a9616c7 Author: Vincenzo Maffione AuthorDate: 2021-01-24 21:12:41 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-24 21:20:59 +0000 iflib: netmap: add support for NS_MOREFRAG The NS_MOREFRAG flag can be set in a netmap slot to represent a multi-fragment packet. Only the last fragment of a packet does not have the flag set. On TX rings, the flag may be set by the userspace application. The kernel will look at the flag and use it to properly set up the NIC TX descriptors. On RX rings, the kernel may set the flag if the packet received was split across multiple netmap buffers. The userspace application should look at the flag to know when the packet is complete. Submitted by: rajesh1.kumar_amd.com Reviewed by: vmaffione MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27799 --- sys/net/iflib.c | 82 ++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 24 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index ea2c5789a7b5..0d4124599419 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -1005,6 +1005,8 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) nm_i = kring->nr_hwcur; if (nm_i != head) { /* we have new packets to send */ + uint32_t pkt_len = 0, seg_idx = 0; + int nic_i_start = -1, flags = 0; pkt_info_zero(&pi); pi.ipi_segs = txq->ift_segs; pi.ipi_qsidx = kring->ring_id; @@ -1019,22 +1021,40 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) u_int len = slot->len; uint64_t paddr; void *addr = PNMB(na, slot, &paddr); - int flags = (slot->flags & NS_REPORT || + + flags |= (slot->flags & NS_REPORT || nic_i == 0 || nic_i == report_frequency) ? IPI_TX_INTR : 0; - /* device-specific */ - pi.ipi_len = len; - pi.ipi_segs[0].ds_addr = paddr; - pi.ipi_segs[0].ds_len = len; - pi.ipi_nsegs = 1; - pi.ipi_ndescs = 0; - pi.ipi_pidx = nic_i; - pi.ipi_flags = flags; + /* + * If this is the first packet fragment, save the + * index of the first NIC slot for later. + */ + if (nic_i_start < 0) + nic_i_start = nic_i; + + pi.ipi_segs[seg_idx].ds_addr = paddr; + pi.ipi_segs[seg_idx].ds_len = len; + if (len) { + pkt_len += len; + seg_idx++; + } - /* Fill the slot in the NIC ring. */ - ctx->isc_txd_encap(ctx->ifc_softc, &pi); - DBG_COUNTER_INC(tx_encap); + if (!(slot->flags & NS_MOREFRAG)) { + pi.ipi_len = pkt_len; + pi.ipi_nsegs = seg_idx; + pi.ipi_pidx = nic_i_start; + pi.ipi_ndescs = 0; + pi.ipi_flags = flags; + + /* Prepare the NIC TX ring. */ + ctx->isc_txd_encap(ctx->ifc_softc, &pi); + DBG_COUNTER_INC(tx_encap); + + /* Reinit per-packet info for the next one. */ + flags = seg_idx = pkt_len = 0; + nic_i_start = -1; + } /* prefetch for next round */ __builtin_prefetch(&ring->slot[nm_i + 1]); @@ -1053,7 +1073,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) txq->ift_sds.ifsd_map[nic_i], BUS_DMASYNC_PREWRITE); - slot->flags &= ~(NS_REPORT | NS_BUF_CHANGED); + slot->flags &= ~(NS_REPORT | NS_BUF_CHANGED | NS_MOREFRAG); nm_i = nm_next(nm_i, lim); nic_i = nm_next(nic_i, lim); } @@ -1116,6 +1136,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) u_int n; u_int const lim = kring->nkr_num_slots - 1; int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; + int i = 0; if_ctx_t ctx = ifp->if_softc; if_shared_ctx_t sctx = ctx->ifc_sctx; @@ -1177,17 +1198,30 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) ri.iri_cidx = *cidxp; error = ctx->isc_rxd_pkt_get(ctx->ifc_softc, &ri); - ring->slot[nm_i].len = error ? 0 : ri.iri_len - crclen; - ring->slot[nm_i].flags = 0; - if (have_rxcq) { - *cidxp = ri.iri_cidx; - while (*cidxp >= scctx->isc_nrxd[0]) - *cidxp -= scctx->isc_nrxd[0]; + for (i = 0; i < ri.iri_nfrags; i++) { + if (error) { + ring->slot[nm_i].len = 0; + ring->slot[nm_i].flags = 0; + } else { + ring->slot[nm_i].len = ri.iri_frags[i].irf_len; + if (i == (ri.iri_nfrags - 1)) { + ring->slot[nm_i].len -= crclen; + ring->slot[nm_i].flags = 0; + } else + ring->slot[nm_i].flags = NS_MOREFRAG; + } + + if (have_rxcq) { + *cidxp = ri.iri_cidx; + while (*cidxp >= scctx->isc_nrxd[0]) + *cidxp -= scctx->isc_nrxd[0]; + } + + bus_dmamap_sync(fl->ifl_buf_tag, + fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); + nm_i = nm_next(nm_i, lim); + fl->ifl_cidx = nic_i = nm_next(nic_i, lim); } - bus_dmamap_sync(fl->ifl_buf_tag, - fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); - nm_i = nm_next(nm_i, lim); - fl->ifl_cidx = nic_i = nm_next(nic_i, lim); } if (n) { /* update the state variables */ if (netmap_no_pendintr && !force_update) { @@ -1234,7 +1268,7 @@ iflib_netmap_attach(if_ctx_t ctx) bzero(&na, sizeof(na)); na.ifp = ctx->ifc_ifp; - na.na_flags = NAF_BDG_MAYSLEEP; + na.na_flags = NAF_BDG_MAYSLEEP | NAF_MOREFRAG; MPASS(ctx->ifc_softc_ctx.isc_ntxqsets); MPASS(ctx->ifc_softc_ctx.isc_nrxqsets); From owner-dev-commits-src-main@freebsd.org Sun Jan 24 21:40:47 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BEFD94DC19F; Sun, 24 Jan 2021 21:40:47 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP5yl54xjz4dcS; Sun, 24 Jan 2021 21:40:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1C782C0D; Sun, 24 Jan 2021 21:40:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OLelwg068885; Sun, 24 Jan 2021 21:40:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OLelNo068884; Sun, 24 Jan 2021 21:40:47 GMT (envelope-from git) Date: Sun, 24 Jan 2021 21:40:47 GMT Message-Id: <202101242140.10OLelNo068884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: f80efe5016ba - main - iflib: netmap: move per-packet operation out of fragments loop MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f80efe5016ba01b2948ca1f0eb8fe34adab5b864 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 21:40:47 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=f80efe5016ba01b2948ca1f0eb8fe34adab5b864 commit f80efe5016ba01b2948ca1f0eb8fe34adab5b864 Author: Vincenzo Maffione AuthorDate: 2021-01-24 21:38:59 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-24 21:38:59 +0000 iflib: netmap: move per-packet operation out of fragments loop MFC after: 1 week --- sys/net/iflib.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 0d4124599419..d10c11f865fe 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -1211,17 +1211,18 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) ring->slot[nm_i].flags = NS_MOREFRAG; } - if (have_rxcq) { - *cidxp = ri.iri_cidx; - while (*cidxp >= scctx->isc_nrxd[0]) - *cidxp -= scctx->isc_nrxd[0]; - } - bus_dmamap_sync(fl->ifl_buf_tag, fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); fl->ifl_cidx = nic_i = nm_next(nic_i, lim); } + + if (have_rxcq) { + *cidxp = ri.iri_cidx; + while (*cidxp >= scctx->isc_nrxd[0]) + *cidxp -= scctx->isc_nrxd[0]; + } + } if (n) { /* update the state variables */ if (netmap_no_pendintr && !force_update) { From owner-dev-commits-src-main@freebsd.org Sun Jan 24 21:59:45 2021 Return-Path: Delivered-To: dev-commits-src-main@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 BC6E94DCB81; Sun, 24 Jan 2021 21:59:45 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP6Nd50ZDz4fnP; Sun, 24 Jan 2021 21:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E88729FF; Sun, 24 Jan 2021 21:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10OLxj1O086784; Sun, 24 Jan 2021 21:59:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10OLxj5V086783; Sun, 24 Jan 2021 21:59:45 GMT (envelope-from git) Date: Sun, 24 Jan 2021 21:59:45 GMT Message-Id: <202101242159.10OLxj5V086783@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: ee0005f11f2b - main - netmap: simplify parameter passing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee0005f11f2b38a714bc66b7d79832108f6fee77 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 21:59:45 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=ee0005f11f2b38a714bc66b7d79832108f6fee77 commit ee0005f11f2b38a714bc66b7d79832108f6fee77 Author: Vincenzo Maffione AuthorDate: 2021-01-24 21:59:02 +0000 Commit: Vincenzo Maffione CommitDate: 2021-01-24 21:59:02 +0000 netmap: simplify parameter passing Changes imported from the netmap github. --- sys/dev/netmap/netmap.c | 78 ++++++++++++++++++++++------------------- sys/dev/netmap/netmap_bdg.c | 3 +- sys/dev/netmap/netmap_kern.h | 5 ++- sys/dev/netmap/netmap_monitor.c | 3 +- 4 files changed, 45 insertions(+), 44 deletions(-) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index 62d00f0bffc7..b711e0d2497e 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -1843,13 +1843,15 @@ netmap_ring_reinit(struct netmap_kring *kring) * */ int -netmap_interp_ringid(struct netmap_priv_d *priv, uint32_t nr_mode, - uint16_t nr_ringid, uint64_t nr_flags) +netmap_interp_ringid(struct netmap_priv_d *priv, struct nmreq_header *hdr) { struct netmap_adapter *na = priv->np_na; + struct nmreq_register *reg = (struct nmreq_register *)hdr->nr_body; int excluded_direction[] = { NR_TX_RINGS_ONLY, NR_RX_RINGS_ONLY }; enum txrx t; u_int j; + u_int nr_flags = reg->nr_flags, nr_mode = reg->nr_mode, + nr_ringid = reg->nr_ringid; for_rx_tx(t) { if (nr_flags & excluded_direction[t]) { @@ -1943,19 +1945,19 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint32_t nr_mode, * for all rings is the same as a single ring. */ static int -netmap_set_ringid(struct netmap_priv_d *priv, uint32_t nr_mode, - uint16_t nr_ringid, uint64_t nr_flags) +netmap_set_ringid(struct netmap_priv_d *priv, struct nmreq_header *hdr) { struct netmap_adapter *na = priv->np_na; + struct nmreq_register *reg = (struct nmreq_register *)hdr->nr_body; int error; enum txrx t; - error = netmap_interp_ringid(priv, nr_mode, nr_ringid, nr_flags); + error = netmap_interp_ringid(priv, hdr); if (error) { return error; } - priv->np_txpoll = (nr_flags & NR_NO_TX_POLL) ? 0 : 1; + priv->np_txpoll = (reg->nr_flags & NR_NO_TX_POLL) ? 0 : 1; /* optimization: count the users registered for more than * one ring, which are the ones sleeping on the global queue. @@ -1985,6 +1987,19 @@ netmap_unset_ringid(struct netmap_priv_d *priv) priv->np_kloop_state = 0; } +#define within_sel(p_, t_, i_) \ + ((i_) < (p_)->np_qlast[(t_)]) +#define nonempty_sel(p_, t_) \ + (within_sel((p_), (t_), (p_)->np_qfirst[(t_)])) +#define foreach_selected_ring(p_, t_, i_, kring_) \ + for ((t_) = nonempty_sel((p_), NR_RX) ? NR_RX : NR_TX, \ + (i_) = (p_)->np_qfirst[(t_)]; \ + (t_ == NR_RX || \ + (t == NR_TX && within_sel((p_), (t_), (i_)))) && \ + ((kring_) = NMR((p_)->np_na, (t_))[(i_)]); \ + (i_) = within_sel((p_), (t_), (i_) + 1) ? (i_) + 1 : \ + (++(t_) < NR_TXRX ? (p_)->np_qfirst[(t_)] : (i_))) + /* Set the nr_pending_mode for the requested rings. * If requested, also try to get exclusive access to the rings, provided @@ -2011,29 +2026,23 @@ netmap_krings_get(struct netmap_priv_d *priv) * are neither alread exclusively owned, nor we * want exclusive ownership when they are already in use */ - for_rx_tx(t) { - for (i = priv->np_qfirst[t]; i < priv->np_qlast[t]; i++) { - kring = NMR(na, t)[i]; - if ((kring->nr_kflags & NKR_EXCLUSIVE) || - (kring->users && excl)) - { - nm_prdis("ring %s busy", kring->name); - return EBUSY; - } + foreach_selected_ring(priv, t, i, kring) { + if ((kring->nr_kflags & NKR_EXCLUSIVE) || + (kring->users && excl)) + { + nm_prdis("ring %s busy", kring->name); + return EBUSY; } } /* second round: increment usage count (possibly marking them * as exclusive) and set the nr_pending_mode */ - for_rx_tx(t) { - for (i = priv->np_qfirst[t]; i < priv->np_qlast[t]; i++) { - kring = NMR(na, t)[i]; - kring->users++; - if (excl) - kring->nr_kflags |= NKR_EXCLUSIVE; - kring->nr_pending_mode = NKR_NETMAP_ON; - } + foreach_selected_ring(priv, t, i, kring) { + kring->users++; + if (excl) + kring->nr_kflags |= NKR_EXCLUSIVE; + kring->nr_pending_mode = NKR_NETMAP_ON; } return 0; @@ -2046,7 +2055,6 @@ netmap_krings_get(struct netmap_priv_d *priv) static void netmap_krings_put(struct netmap_priv_d *priv) { - struct netmap_adapter *na = priv->np_na; u_int i; struct netmap_kring *kring; int excl = (priv->np_flags & NR_EXCLUSIVE); @@ -2059,15 +2067,12 @@ netmap_krings_put(struct netmap_priv_d *priv) priv->np_qfirst[NR_RX], priv->np_qlast[MR_RX]); - for_rx_tx(t) { - for (i = priv->np_qfirst[t]; i < priv->np_qlast[t]; i++) { - kring = NMR(na, t)[i]; - if (excl) - kring->nr_kflags &= ~NKR_EXCLUSIVE; - kring->users--; - if (kring->users == 0) - kring->nr_pending_mode = NKR_NETMAP_OFF; - } + foreach_selected_ring(priv, t, i, kring) { + if (excl) + kring->nr_kflags &= ~NKR_EXCLUSIVE; + kring->users--; + if (kring->users == 0) + kring->nr_pending_mode = NKR_NETMAP_OFF; } } @@ -2300,7 +2305,7 @@ netmap_buf_size_validate(const struct netmap_adapter *na, unsigned mtu) { */ int netmap_do_regif(struct netmap_priv_d *priv, struct netmap_adapter *na, - uint32_t nr_mode, uint16_t nr_ringid, uint64_t nr_flags) + struct nmreq_header *hdr) { struct netmap_if *nifp = NULL; int error; @@ -2325,7 +2330,7 @@ netmap_do_regif(struct netmap_priv_d *priv, struct netmap_adapter *na, } /* compute the range of tx and rx rings to monitor */ - error = netmap_set_ringid(priv, nr_mode, nr_ringid, nr_flags); + error = netmap_set_ringid(priv, hdr); if (error) goto err_put_lut; @@ -2566,8 +2571,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, break; } - error = netmap_do_regif(priv, na, req->nr_mode, - req->nr_ringid, req->nr_flags); + error = netmap_do_regif(priv, na, hdr); if (error) { /* reg. failed, release priv and ref */ break; } diff --git a/sys/dev/netmap/netmap_bdg.c b/sys/dev/netmap/netmap_bdg.c index 96d6deedb768..4d18859e2091 100644 --- a/sys/dev/netmap/netmap_bdg.c +++ b/sys/dev/netmap/netmap_bdg.c @@ -1477,8 +1477,7 @@ netmap_bwrap_bdg_ctl(struct nmreq_header *hdr, struct netmap_adapter *na) if (npriv == NULL) return ENOMEM; npriv->np_ifp = na->ifp; /* let the priv destructor release the ref */ - error = netmap_do_regif(npriv, na, req->reg.nr_mode, - req->reg.nr_ringid, req->reg.nr_flags); + error = netmap_do_regif(npriv, na, hdr); if (error) { netmap_priv_delete(npriv); return error; diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index 3786826d8e38..fd9db5842df3 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -1449,8 +1449,7 @@ int netmap_attach_common(struct netmap_adapter *); /* fill priv->np_[tr]xq{first,last} using the ringid and flags information * coming from a struct nmreq_register */ -int netmap_interp_ringid(struct netmap_priv_d *priv, uint32_t nr_mode, - uint16_t nr_ringid, uint64_t nr_flags); +int netmap_interp_ringid(struct netmap_priv_d *priv, struct nmreq_header *hdr); /* update the ring parameters (number and size of tx and rx rings). * It calls the nm_config callback, if available. */ @@ -1485,7 +1484,7 @@ void netmap_enable_all_rings(struct ifnet *); int netmap_buf_size_validate(const struct netmap_adapter *na, unsigned mtu); int netmap_do_regif(struct netmap_priv_d *priv, struct netmap_adapter *na, - uint32_t nr_mode, uint16_t nr_ringid, uint64_t nr_flags); + struct nmreq_header *); void netmap_do_unregif(struct netmap_priv_d *priv); u_int nm_bound_var(u_int *v, u_int dflt, u_int lo, u_int hi, const char *msg); diff --git a/sys/dev/netmap/netmap_monitor.c b/sys/dev/netmap/netmap_monitor.c index f30abcc4b39a..1f5ff65b3b81 100644 --- a/sys/dev/netmap/netmap_monitor.c +++ b/sys/dev/netmap/netmap_monitor.c @@ -950,8 +950,7 @@ netmap_get_monitor_na(struct nmreq_header *hdr, struct netmap_adapter **na, mna->priv.np_na = pna; /* grab all the rings we need in the parent */ - error = netmap_interp_ringid(&mna->priv, req->nr_mode, req->nr_ringid, - req->nr_flags); + error = netmap_interp_ringid(&mna->priv, hdr); if (error) { nm_prerr("ringid error"); goto free_out; From owner-dev-commits-src-main@freebsd.org Sun Jan 24 23:03:32 2021 Return-Path: Delivered-To: dev-commits-src-main@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 3CC0A4DE5E7; Sun, 24 Jan 2021 23:03:32 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DP7pD1Fy3z4jp0; Sun, 24 Jan 2021 23:03:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E11A3CC3; Sun, 24 Jan 2021 23:03:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10ON3Wcp076960; Sun, 24 Jan 2021 23:03:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10ON3WFB076959; Sun, 24 Jan 2021 23:03:32 GMT (envelope-from git) Date: Sun, 24 Jan 2021 23:03:32 GMT Message-Id: <202101242303.10ON3WFB076959@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: bd01a69f4836 - main - nfs_write(): do not call ncl_pager_setsize() after clearing TDP2_SBPAGES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd01a69f4836994b50b492883fb5367db41fb506 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jan 2021 23:03:32 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bd01a69f4836994b50b492883fb5367db41fb506 commit bd01a69f4836994b50b492883fb5367db41fb506 Author: Konstantin Belousov AuthorDate: 2021-01-23 21:40:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-01-24 23:02:03 +0000 nfs_write(): do not call ncl_pager_setsize() after clearing TDP2_SBPAGES This might unnecessary truncate file undoing extension done by the write. Reported by: Yasuhiro Kimura Reviewed by: rmacklem Tested by: rmacklem, Yasuhiro Kimura MFC after: 6 days Sponsored by: The FreeBSD Foundation --- sys/fs/nfsclient/nfs_clbio.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 7d0ff0abff3d..832b44b99c8d 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -1286,11 +1286,6 @@ again: out: curthread_pflags2_restore(save2); - if ((curthread->td_pflags2 & TDP2_SBPAGES) == 0) { - NFSLOCKNODE(np); - ncl_pager_setsize(vp, NULL); - } - return (error); }