From owner-dev-commits-src-all@freebsd.org Mon Mar 8 00:11:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 034EE5554C3; Mon, 8 Mar 2021 00:11: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 4DtzKP6lYgz4qj7; Mon, 8 Mar 2021 00:11: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 DACC71F7A0; Mon, 8 Mar 2021 00:11: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 1280BbD9070205; Mon, 8 Mar 2021 00:11:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1280BbaZ070204; Mon, 8 Mar 2021 00:11:37 GMT (envelope-from git) Date: Mon, 8 Mar 2021 00:11:37 GMT Message-Id: <202103080011.1280BbaZ070204@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: be56d474e3c2 - stable/13 - camcontrol: change hueristic for I/O-less devtype MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: be56d474e3c283dff1b651fd3436739585a5972b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 00:11:38 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=be56d474e3c283dff1b651fd3436739585a5972b commit be56d474e3c283dff1b651fd3436739585a5972b Author: Warner Losh AuthorDate: 2021-02-23 19:33:26 +0000 Commit: Warner Losh CommitDate: 2021-03-07 23:07:30 +0000 camcontrol: change hueristic for I/O-less devtype Some SATA drives have 'config' set to 0 in the identify block. Rather than rely on it, use the strings windows uses to display the drive since they are supposed to be space padded and will always be non-zero. (cherry picked from commit 6b7580f7b1b66134286813b971ab575862b95426) --- sbin/camcontrol/camcontrol.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index cc21a109343c..27d545d924b3 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -5520,9 +5520,14 @@ get_device_type(struct cam_device *dev, int retry_count, int timeout, * For a retry count of -1, used only the cached data to avoid * I/O to the drive. Sending the identify command to the drive * can cause issues for SATL attachaed drives since identify is - * not an NCQ command. + * not an NCQ command. We check for the strings that windows + * displays since those will not be NULs (they are supposed + * to be space padded). We could check other bits, but anything + * non-zero implies SATL. */ - if (cgd.ident_data.config != 0) + if (cgd.ident_data.serial[0] != 0 || + cgd.ident_data.revision[0] != 0 || + cgd.ident_data.model[0] != 0) *devtype = CC_DT_SATL; else *devtype = CC_DT_SCSI; From owner-dev-commits-src-all@freebsd.org Mon Mar 8 00:11:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24792555A6E; Mon, 8 Mar 2021 00:11: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 4DtzKR0RYpz4qsq; Mon, 8 Mar 2021 00:11: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 008CA1F7A1; Mon, 8 Mar 2021 00:11: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 1280BcUh070228; Mon, 8 Mar 2021 00:11:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1280BcGT070227; Mon, 8 Mar 2021 00:11:38 GMT (envelope-from git) Date: Mon, 8 Mar 2021 00:11:38 GMT Message-Id: <202103080011.1280BcGT070227@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: feef1047d646 - stable/13 - cam: add new ASC and ASCQ values related to drive depopulation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: feef1047d646105b7ea5c7220ff7cd8e0ef6e3de Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 00:11:39 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=feef1047d646105b7ea5c7220ff7cd8e0ef6e3de commit feef1047d646105b7ea5c7220ff7cd8e0ef6e3de Author: Warner Losh AuthorDate: 2021-02-26 18:43:35 +0000 Commit: Warner Losh CommitDate: 2021-03-07 23:07:44 +0000 cam: add new ASC and ASCQ values related to drive depopulation Add 04/25 Depopulation restoration in progress, 31/04 Depopulation failed, and 31/05 Depopulation restoration failed. These are defined in SPC-6r2 (though 31/4 was added in an earlier draft). They relate to different aspects of in-progress or failed depopulation removal and restoration commands. (cherry picked from commit 34d6961108bd47243236d086551459c52adabf49) --- sys/cam/scsi/scsi_all.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/cam/scsi/scsi_all.c b/sys/cam/scsi/scsi_all.c index 1d9b74e4fe0c..1b60003a4ac7 100644 --- a/sys/cam/scsi/scsi_all.c +++ b/sys/cam/scsi/scsi_all.c @@ -1191,6 +1191,9 @@ static struct asc_table_entry asc_table[] = { /* D */ { SST(0x04, 0x24, SS_FATAL | EBUSY, "Depopulation in progress") }, + /* D */ + { SST(0x04, 0x25, SS_FATAL | EBUSY, + "Depopulation restoration in progress") }, /* DTL WROMAEBKVF */ { SST(0x05, 0x00, SS_RDEF, "Logical unit does not respond to selection") }, @@ -2072,6 +2075,12 @@ static struct asc_table_entry asc_table[] = { /* D B */ { SST(0x31, 0x03, SS_FATAL | EIO, "SANITIZE command failed") }, + /* D */ + { SST(0x31, 0x04, SS_FATAL | EIO, + "Depopulation failed") }, + /* D */ + { SST(0x31, 0x05, SS_FATAL | EIO, + "Depopulation restoration failed") }, /* D W O BK */ { SST(0x32, 0x00, SS_RDEF, "No defect spare location available") }, From owner-dev-commits-src-all@freebsd.org Mon Mar 8 00:11:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CC07555754; Mon, 8 Mar 2021 00:11: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 4DtzKS1QShz4qng; Mon, 8 Mar 2021 00:11: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 220B61F359; Mon, 8 Mar 2021 00:11: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 1280Be5C070250; Mon, 8 Mar 2021 00:11:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1280BeOZ070249; Mon, 8 Mar 2021 00:11:40 GMT (envelope-from git) Date: Mon, 8 Mar 2021 00:11:40 GMT Message-Id: <202103080011.1280BeOZ070249@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: fbc8ddde4c66 - stable/13 - cam: remove redundant scsi_vpd_block_characteristics definition MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fbc8ddde4c66d6e5d2a22c9cd5a1c850ffdbe8a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 00:11:40 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=fbc8ddde4c66d6e5d2a22c9cd5a1c850ffdbe8a2 commit fbc8ddde4c66d6e5d2a22c9cd5a1c850ffdbe8a2 Author: Warner Losh AuthorDate: 2021-03-03 01:31:43 +0000 Commit: Warner Losh CommitDate: 2021-03-07 23:07:57 +0000 cam: remove redundant scsi_vpd_block_characteristics definition There were two definitions for the SCSI VPD Block Device Characteristics (page 0xb1): struct scsi_vpd_block_characteristics and struct scsi_vpd_block_device_characteristics. The latter is more complete and more widely used. Convert uses of the former to the latter by tweaking the da driver and removing sturct scsi_vpd_block_characteristics. (cherry picked from commit b3fce46a3eac600935f3aac2b224a83defcf1cb3) --- sys/cam/scsi/scsi_all.h | 24 ------------------------ sys/cam/scsi/scsi_da.c | 7 +++---- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h index ff27388e446c..597d5fd68447 100644 --- a/sys/cam/scsi/scsi_all.h +++ b/sys/cam/scsi/scsi_all.h @@ -2820,30 +2820,6 @@ struct scsi_vpd_sfs uint8_t codes[]; }; -/* - * Block Device Characteristics VPD Page based on - * T10/1799-D Revision 31 - */ -struct scsi_vpd_block_characteristics -{ - u_int8_t device; - u_int8_t page_code; -#define SVPD_BDC 0xB1 - u_int8_t page_length[2]; - u_int8_t medium_rotation_rate[2]; -#define SVPD_BDC_RATE_NOT_REPORTED 0x00 -#define SVPD_BDC_RATE_NON_ROTATING 0x01 - u_int8_t reserved1; - u_int8_t nominal_form_factor; -#define SVPD_BDC_FORM_NOT_REPORTED 0x00 -#define SVPD_BDC_FORM_5_25INCH 0x01 -#define SVPD_BDC_FORM_3_5INCH 0x02 -#define SVPD_BDC_FORM_2_5INCH 0x03 -#define SVPD_BDC_FORM_1_5INCH 0x04 -#define SVPD_BDC_FORM_LESSTHAN_1_5INCH 0x05 - u_int8_t reserved2[56]; -}; - /* * Block Device Characteristics VPD Page */ diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 490f75336efd..73e5e0c3e14c 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -3649,14 +3649,14 @@ out: } case DA_STATE_PROBE_BDC: { - struct scsi_vpd_block_characteristics *bdc; + struct scsi_vpd_block_device_characteristics *bdc; if (!scsi_vpd_supported_page(periph, SVPD_BDC)) { softc->state = DA_STATE_PROBE_ATA; goto skipstate; } - bdc = (struct scsi_vpd_block_characteristics *) + bdc = (struct scsi_vpd_block_device_characteristics *) malloc(sizeof(*bdc), M_SCSIDA, M_NOWAIT|M_ZERO); if (bdc == NULL) { @@ -5207,8 +5207,7 @@ dadone_probebdc(struct cam_periph *periph, union ccb *done_ccb) medium_rotation_rate)) { softc->disk->d_rotation_rate = scsi_2btoul(bdc->medium_rotation_rate); - if (softc->disk->d_rotation_rate == - SVPD_BDC_RATE_NON_ROTATING) { + if (softc->disk->d_rotation_rate == SVPD_NON_ROTATING) { cam_iosched_set_sort_queue( softc->cam_iosched, 0); softc->flags &= ~DA_FLAG_ROTATING; From owner-dev-commits-src-all@freebsd.org Mon Mar 8 00:38:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B73DB5561D0; Mon, 8 Mar 2021 00:38: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 4Dtzwl4PXzz4sFm; Mon, 8 Mar 2021 00:38: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 85E721FE90; Mon, 8 Mar 2021 00:38: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 1280clQ2098273; Mon, 8 Mar 2021 00:38:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1280clXY098272; Mon, 8 Mar 2021 00:38:47 GMT (envelope-from git) Date: Mon, 8 Mar 2021 00:38:47 GMT Message-Id: <202103080038.1280clXY098272@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 38dfb0626fd3 - main - bhyve/snapshot: use SOCK_DGRAM instead of SOCK_STREAM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 38dfb0626fd35c64b2e2d5faae2c90e7981a3307 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 00:38:47 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=38dfb0626fd35c64b2e2d5faae2c90e7981a3307 commit 38dfb0626fd35c64b2e2d5faae2c90e7981a3307 Author: Robert Wing AuthorDate: 2021-03-08 00:23:29 +0000 Commit: Robert Wing CommitDate: 2021-03-08 00:23:29 +0000 bhyve/snapshot: use SOCK_DGRAM instead of SOCK_STREAM The save/restore feature uses a unix domain socket to send messages from bhyvectl(8) to a bhyve(8) process. A datagram socket will suffice for this. An added benefit of using a datagram socket is simplified code. For bhyve, the listen/accept calls are dropped; and for bhyvectl, the connect() call is dropped. EPRINTLN handles raw mode for bhyve(8), use it to print error messages. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D28983 --- usr.sbin/bhyve/snapshot.c | 65 +++++++++++++++++--------------------------- usr.sbin/bhyvectl/bhyvectl.c | 22 ++++----------- 2 files changed, 31 insertions(+), 56 deletions(-) diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 11ff963ae1fd..221558b6f205 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include "bhyverun.h" #include "acpi.h" #include "atkbdc.h" +#include "debug.h" #include "inout.h" #include "fwctl.h" #include "ioapic.h" @@ -117,8 +118,6 @@ static sig_t old_winch_handler; #define MAX_VMNAME 100 -#define MAX_MSG_SIZE 1024 - #define SNAPSHOT_BUFFER_SIZE (20 * MB) #define JSON_STRUCT_ARR_KEY "structs" @@ -1442,24 +1441,10 @@ done: } int -get_checkpoint_msg(int conn_fd, struct vmctx *ctx) +handle_message(struct checkpoint_op *checkpoint_op, struct vmctx *ctx) { - unsigned char buf[MAX_MSG_SIZE]; - struct checkpoint_op *checkpoint_op; - int len, recv_len, total_recv = 0; - int err = 0; - - len = sizeof(struct checkpoint_op); /* expected length */ - while ((recv_len = recv(conn_fd, buf + total_recv, len - total_recv, 0)) > 0) { - total_recv += recv_len; - } - if (recv_len < 0) { - perror("Error while receiving data from bhyvectl"); - err = -1; - goto done; - } + int err; - checkpoint_op = (struct checkpoint_op *)buf; switch (checkpoint_op->op) { case START_CHECKPOINT: err = vm_checkpoint(ctx, checkpoint_op->snapshot_filename, false); @@ -1468,12 +1453,13 @@ get_checkpoint_msg(int conn_fd, struct vmctx *ctx) err = vm_checkpoint(ctx, checkpoint_op->snapshot_filename, true); break; default: - fprintf(stderr, "Unrecognized checkpoint operation.\n"); + EPRINTLN("Unrecognized checkpoint operation\n"); err = -1; } -done: - close(conn_fd); + if (err != 0) + EPRINTLN("Unable to perform the requested operation\n"); + return (err); } @@ -1483,21 +1469,25 @@ done: void * checkpoint_thread(void *param) { + struct checkpoint_op op; struct checkpoint_thread_info *thread_info; - int conn_fd, ret; + ssize_t n; pthread_set_name_np(pthread_self(), "checkpoint thread"); thread_info = (struct checkpoint_thread_info *)param; - while ((conn_fd = accept(thread_info->socket_fd, NULL, NULL)) > -1) { - ret = get_checkpoint_msg(conn_fd, thread_info->ctx); - if (ret != 0) { - fprintf(stderr, "Failed to read message on checkpoint " - "socket. Retrying.\n"); - } - } - if (conn_fd < -1) { - perror("Failed to accept connection"); + for (;;) { + n = recvfrom(thread_info->socket_fd, &op, sizeof(op), 0, NULL, 0); + + /* + * slight sanity check: see if there's enough data to at + * least determine the type of message. + */ + if (n >= sizeof(op.op)) + handle_message(&op, thread_info->ctx); + else + EPRINTLN("Failed to receive message: %s\n", + n == -1 ? strerror(errno) : "unknown error"); } return (NULL); @@ -1527,9 +1517,9 @@ init_checkpoint_thread(struct vmctx *ctx) if (err != 0) errc(1, err, "checkpoint cv init"); - socket_fd = socket(PF_UNIX, SOCK_STREAM, 0); + socket_fd = socket(PF_UNIX, SOCK_DGRAM, 0); if (socket_fd < 0) { - perror("Socket creation failed (IPC with bhyvectl"); + EPRINTLN("Socket creation failed: %s", strerror(errno)); err = -1; goto fail; } @@ -1548,13 +1538,8 @@ init_checkpoint_thread(struct vmctx *ctx) unlink(addr.sun_path); if (bind(socket_fd, (struct sockaddr *)&addr, addr.sun_len) != 0) { - perror("Failed to bind socket (IPC with bhyvectl)"); - err = -1; - goto fail; - } - - if (listen(socket_fd, 10) < 0) { - perror("Failed to listen on socket (IPC with bhyvectl)"); + EPRINTLN("Failed to bind socket \"%s\": %s\n", + addr.sun_path, strerror(errno)); err = -1; goto fail; } diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c index 0f7b9533fe4b..df02f7caf345 100644 --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -1687,11 +1687,11 @@ static int send_checkpoint_op_req(struct vmctx *ctx, struct checkpoint_op *op) { struct sockaddr_un addr; - int socket_fd, len, len_sent, total_sent; - int err = 0; + ssize_t len_sent; + int err, socket_fd; char vmname_buf[MAX_VMNAME]; - socket_fd = socket(PF_UNIX, SOCK_STREAM, 0); + socket_fd = socket(PF_UNIX, SOCK_DGRAM, 0); if (socket_fd < 0) { perror("Error creating bhyvectl socket"); err = -1; @@ -1709,21 +1709,11 @@ send_checkpoint_op_req(struct vmctx *ctx, struct checkpoint_op *op) snprintf(addr.sun_path, sizeof(addr.sun_path), "%s%s", BHYVE_RUN_DIR, vmname_buf); - if (connect(socket_fd, (struct sockaddr *)&addr, - sizeof(struct sockaddr_un)) != 0) { - perror("Connect to VM socket failed"); - err = -1; - goto done; - } - - len = sizeof(*op); - total_sent = 0; - while ((len_sent = send(socket_fd, (char *)op + total_sent, len - total_sent, 0)) > 0) { - total_sent += len_sent; - } + len_sent = sendto(socket_fd, op, sizeof(*op), 0, + (struct sockaddr *)&addr, sizeof(struct sockaddr_un)); if (len_sent < 0) { - perror("Failed to send checkpoint operation request"); + perror("Failed to send message to bhyve vm"); err = -1; } From owner-dev-commits-src-all@freebsd.org Mon Mar 8 01:48:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FE225607D1; Mon, 8 Mar 2021 01:48: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 4Dv1TX1pBrz3DrZ; Mon, 8 Mar 2021 01:48: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 297EC207CC; Mon, 8 Mar 2021 01:48: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 1281mlM1090319; Mon, 8 Mar 2021 01:48:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1281mlli090318; Mon, 8 Mar 2021 01:48:47 GMT (envelope-from git) Date: Mon, 8 Mar 2021 01:48:47 GMT Message-Id: <202103080148.1281mlli090318@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: 56b9bee63a42 - main - Make kern.timecounter.hardware tunable 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: 56b9bee63a42dbac712acf540f23a4c3dbd099a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 01:48:48 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=56b9bee63a42dbac712acf540f23a4c3dbd099a9 commit 56b9bee63a42dbac712acf540f23a4c3dbd099a9 Author: Konstantin Belousov AuthorDate: 2021-03-07 23:50:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-08 01:48:21 +0000 Make kern.timecounter.hardware tunable Noted and reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D29122 --- sys/kern/kern_tc.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 07841fd5ca0e..b1dcb18e31be 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -141,6 +141,7 @@ SYSCTL_PROC(_kern_timecounter, OID_AUTO, alloweddeviation, volatile int rtc_generation = 1; static int tc_chosen; /* Non-zero if a specific tc was chosen via sysctl. */ +static char tc_from_tunable[16]; static void tc_windup(struct bintime *new_boottimebin); static void cpu_tick_calibrate(int); @@ -1215,11 +1216,17 @@ tc_init(struct timecounter *tc) return; if (tc->tc_quality < 0) return; - if (tc->tc_quality < timecounter->tc_quality) - return; - if (tc->tc_quality == timecounter->tc_quality && - tc->tc_frequency < timecounter->tc_frequency) - return; + if (tc_from_tunable[0] != '\0' && + strcmp(tc->tc_name, tc_from_tunable) == 0) { + tc_chosen = 1; + tc_from_tunable[0] = '\0'; + } else { + if (tc->tc_quality < timecounter->tc_quality) + return; + if (tc->tc_quality == timecounter->tc_quality && + tc->tc_frequency < timecounter->tc_frequency) + return; + } (void)tc->tc_get_timecount(tc); timecounter = tc; } @@ -1500,7 +1507,7 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_kern_timecounter, OID_AUTO, hardware, - CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, + CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, 0, 0, sysctl_kern_timecounter_hardware, "A", "Timecounter hardware selected"); @@ -1940,6 +1947,9 @@ inittimehands(void *dummy) for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i++]) thp->th_next = &ths[i]; thp->th_next = &ths[0]; + + TUNABLE_STR_FETCH("kern.timecounter.hardware", tc_from_tunable, + sizeof(tc_from_tunable)); } SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL); From owner-dev-commits-src-all@freebsd.org Mon Mar 8 03:07:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59E8E562759; Mon, 8 Mar 2021 03:07: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 4Dv3DG26yQz3JJs; Mon, 8 Mar 2021 03:07: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 3BC4921D96; Mon, 8 Mar 2021 03:07: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 12837Qhw096681; Mon, 8 Mar 2021 03:07:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12837Qen096680; Mon, 8 Mar 2021 03:07:26 GMT (envelope-from git) Date: Mon, 8 Mar 2021 03:07:26 GMT Message-Id: <202103080307.12837Qen096680@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hajimu UMEMOTO Subject: git: 006a01374f59 - main - Simplify using nvlist_append_string_array(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ume X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 006a01374f59b839ca1c900efd274a3b92044b15 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 03:07:26 -0000 The branch main has been updated by ume: URL: https://cgit.FreeBSD.org/src/commit/?id=006a01374f59b839ca1c900efd274a3b92044b15 commit 006a01374f59b839ca1c900efd274a3b92044b15 Author: Hajimu UMEMOTO AuthorDate: 2021-03-08 03:03:32 +0000 Commit: Hajimu UMEMOTO CommitDate: 2021-03-08 03:03:32 +0000 Simplify using nvlist_append_string_array(). Reported by: hrs MFC after: 1 week --- usr.sbin/rtsold/rtsold.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/usr.sbin/rtsold/rtsold.c b/usr.sbin/rtsold/rtsold.c index 5e5298bfdadc..c1594ec7420a 100644 --- a/usr.sbin/rtsold/rtsold.c +++ b/usr.sbin/rtsold/rtsold.c @@ -333,10 +333,8 @@ init_capabilities(void) #ifdef WITH_CASPER const char *const scripts[] = { resolvconf_script, managedconf_script, otherconf_script }; - const char *scripts_set[nitems(scripts)]; cap_channel_t *capcasper; nvlist_t *limits; - int count; capcasper = cap_init(); if (capcasper == NULL) @@ -349,12 +347,11 @@ init_capabilities(void) capscript = cap_service_open(capcasper, "rtsold.script"); if (capscript == NULL) return (-1); - count = 0; + limits = nvlist_create(0); for (size_t i = 0; i < nitems(scripts); i++) if (scripts[i] != NULL) - scripts_set[count++] = scripts[i]; - limits = nvlist_create(0); - nvlist_add_string_array(limits, "scripts", scripts_set, count); + nvlist_append_string_array(limits, "scripts", + scripts[i]); if (cap_limit_set(capscript, limits) != 0) return (-1); From owner-dev-commits-src-all@freebsd.org Mon Mar 8 06:22:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A64B566867; Mon, 8 Mar 2021 06:22:41 +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 4Dv7YY3zZZz3j23; Mon, 8 Mar 2021 06:22:41 +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 7BA9024510; Mon, 8 Mar 2021 06:22:41 +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 1286Mfw9059155; Mon, 8 Mar 2021 06:22:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1286Mfwu059154; Mon, 8 Mar 2021 06:22:41 GMT (envelope-from git) Date: Mon, 8 Mar 2021 06:22:41 GMT Message-Id: <202103080622.1286Mfwu059154@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: d9a50109e238 - main - if_wg: release correct lock in noise_remote_begin_session() 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: d9a50109e238e2d0171f0e647821f82efb8d037d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 06:22:41 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=d9a50109e238e2d0171f0e647821f82efb8d037d commit d9a50109e238e2d0171f0e647821f82efb8d037d Author: Kyle Evans AuthorDate: 2021-03-08 02:25:33 +0000 Commit: Kyle Evans CommitDate: 2021-03-08 06:21:03 +0000 if_wg: release correct lock in noise_remote_begin_session() The keypair lock is not taken until later. Obtained from: Jason A. Donenfeld via OpenBSD MFC after: 3 days --- sys/dev/if_wg/module/wg_noise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/if_wg/module/wg_noise.c b/sys/dev/if_wg/module/wg_noise.c index 946a570916a6..0fa7664e66d5 100644 --- a/sys/dev/if_wg/module/wg_noise.c +++ b/sys/dev/if_wg/module/wg_noise.c @@ -454,7 +454,7 @@ noise_remote_begin_session(struct noise_remote *r) NOISE_SYMMETRIC_SIZE, NOISE_SYMMETRIC_SIZE, 0, 0, hs->hs_ck); } else { - rw_exit_write(&r->r_keypair_lock); + rw_exit_write(&r->r_handshake_lock); return EINVAL; } From owner-dev-commits-src-all@freebsd.org Mon Mar 8 06:22:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFA97566B8C; Mon, 8 Mar 2021 06:22: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 4Dv7YZ4zm4z3j08; Mon, 8 Mar 2021 06:22: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 9DDF624636; Mon, 8 Mar 2021 06:22: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 1286MgnT059177; Mon, 8 Mar 2021 06:22:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1286Mgeg059176; Mon, 8 Mar 2021 06:22:42 GMT (envelope-from git) Date: Mon, 8 Mar 2021 06:22:42 GMT Message-Id: <202103080622.1286Mgeg059176@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: df554850858f - main - wg_input: avoid leaking due to an m_defrag failure 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: df554850858f59fd9d54c25a96bb7dfc4237fa70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 06:22:42 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=df554850858f59fd9d54c25a96bb7dfc4237fa70 commit df554850858f59fd9d54c25a96bb7dfc4237fa70 Author: Kyle Evans AuthorDate: 2021-03-08 02:49:00 +0000 Commit: Kyle Evans CommitDate: 2021-03-08 06:21:23 +0000 wg_input: avoid leaking due to an m_defrag failure m_defrag() will not free the chain on failure, leaking the mbuf. Obtained from: OpenBSD MFC after: 3 days --- sys/dev/if_wg/module/if_wg_session.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index 084bc789039d..cb2a88812855 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -1905,7 +1905,13 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, m_adj(m0, hlen); - if ((m = m_defrag(m0, M_NOWAIT)) == NULL) { + /* + * Ensure mbuf is contiguous over full length of the packet. This is + * done so that we can directly read the handshake values in + * wg_handshake, and so we can decrypt a transport packet by passing a + * a single buffer to noise_remote_decrypt() in wg_decap. + */ + if ((m = m_pullup(m0, m0->m_pkthdr.len)) == NULL) { DPRINTF(sc, "DEFRAG fail\n"); return; } From owner-dev-commits-src-all@freebsd.org Mon Mar 8 06:25:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7116F566A78; Mon, 8 Mar 2021 06:25: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 4Dv7d92mBLz3jKc; Mon, 8 Mar 2021 06:25: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 518CA24511; Mon, 8 Mar 2021 06:25: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 1286Pnm1059750; Mon, 8 Mar 2021 06:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1286PnkD059749; Mon, 8 Mar 2021 06:25:49 GMT (envelope-from git) Date: Mon, 8 Mar 2021 06:25:49 GMT Message-Id: <202103080625.1286PnkD059749@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: 2b82c94acff6 - main - if_wg: avoid null ptr deref 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: 2b82c94acff6b4a90da5af700b59cd398481e968 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 06:25:49 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=2b82c94acff6b4a90da5af700b59cd398481e968 commit 2b82c94acff6b4a90da5af700b59cd398481e968 Author: Kyle Evans AuthorDate: 2021-03-08 02:47:27 +0000 Commit: Kyle Evans CommitDate: 2021-03-08 06:25:34 +0000 if_wg: avoid null ptr deref While we're here, sync up with OpenBSD and don't use a keypair !kp_valid MFC after: 3 days --- sys/dev/if_wg/module/wg_noise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/if_wg/module/wg_noise.c b/sys/dev/if_wg/module/wg_noise.c index 0fa7664e66d5..08a0d8d32876 100644 --- a/sys/dev/if_wg/module/wg_noise.c +++ b/sys/dev/if_wg/module/wg_noise.c @@ -673,7 +673,7 @@ noise_remote_decrypt(struct noise_remote *r, struct noise_data *data, * REKEY_AFTER_TIME_RECV seconds. */ ret = ESTALE; kp = r->r_current; - if (kp->kp_is_initiator && + if (kp != NULL && kp->kp_valid && kp->kp_is_initiator && noise_timer_expired(&kp->kp_birthdate, REKEY_AFTER_TIME_RECV, 0)) goto error; From owner-dev-commits-src-all@freebsd.org Mon Mar 8 07:16:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71651567BD0; Mon, 8 Mar 2021 07:16:33 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dv8lj0GvCz3lvn; Mon, 8 Mar 2021 07:16:32 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id JA7wlTpJX2SWTJA7xlCS0f; Mon, 08 Mar 2021 00:16:30 -0700 X-Authority-Analysis: v=2.4 cv=fdJod2cF c=1 sm=1 tr=0 ts=6045cf4e a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=dESyimp9J3IA:10 a=ZB5LerlCAAAA:8 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=IN2qHnOaUhcsauUY1eUA:9 a=CjuIK1q_8ugA:10 a=YKPTzOroS2oaEK2QgPcx:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 a=BPzZvq435JnGatEyYwdK:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 10D5D2AB2; Sun, 7 Mar 2021 23:16:27 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 1287GQWB055131; Sun, 7 Mar 2021 23:16:26 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202103080716.1287GQWB055131@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Chris Rees cc: dev-commits-src-all@freebsd.org, Baptiste Daroussin , src-committers@freebsd.org, dev-commits-src-main@freebsd.org, Rick Parrish Subject: Re: git: 77e1ccbee3ed - main - rc: implement parallel boot In-reply-to: <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> References: <202102231027.11NARYYE041280@gitrepo.freebsd.org> <6D4FCE07-B996-430C-8EA8-6CB37A6DEEE8@bayofrum.net> <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> Comments: In-reply-to Chris Rees message dated "Sun, 07 Mar 2021 13:43:50 -0500." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 07 Mar 2021 23:16:26 -0800 X-CMAE-Envelope: MS4xfFQ/DyGcyBpZWDprn+Ze9YBd5CmU2P5GKf9kcMvUDGO0faejt4XfFT4h941Ya2OkxzSMBRVFCyt2RoDwUWXLee9C5rqYagPAMTVZM716ntLLyAH48EsK WQ9FossCkxfGSZnVAJEBNW2pK0qY+oXYyq4pZ1FcW7I8S/NlHZ43BzENcEvZCQe8MIFxYfRFLgxKjyp565ehpTaptvNhnKKp9BUcSQwZJZI2rGf5kW9meB9a YLzQ/O3LabwQfm9MddzIqtgy6z0CGOpHnFbMd+MrZF0X7fMkmR9bMjFkIYM8zCUBU6PSY6HUf/58CYlzuXSzAJ1+0cOIsBtZMLpYEPbPUXKHmSIQh31RkbQ5 5iMkdIPKFlEXhqWuSDt+B0y/w8CzLKGq/N9i12I2kUUZHgDgVh0= X-Rspamd-Queue-Id: 4Dv8lj0GvCz3lvn 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 07:16:33 -0000 In message <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net>, Chris Rees writes: > Forgot to CC the actual author! > > On 2021-02-23 17:03, Chris Rees wrote: > > Hi, > > > > On 23 February 2021 10:27:34 GMT, Baptiste Daroussin > > wrote: > >> The branch main has been updated by bapt: > >> > >> URL: > >> https://cgit.FreeBSD.org/src/commit/?id=77e1ccbee3ed6c837929e4e232fd07f95b > fc8294 > >> > >> commit 77e1ccbee3ed6c837929e4e232fd07f95bfc8294 > >> Author: Rick Parrish > >> AuthorDate: 2021-02-07 06:15:21 +0000 > >> Commit: Baptiste Daroussin > >> CommitDate: 2021-02-23 10:16:53 +0000 > >> > >> rc: implement parallel boot > >> > >> take advantage of the rcorder -p argument to implement parallel > >> booting in rc. > >> > >> According to the author non scientific tests: > >> on a Core 2 Duo with spinning disk: > >> > >> | Services enabled | before | after | saving | > >> | 0 | 8s | 8s | 0 | > >> | 1 | 13s | 13s | 0 | > >> | 2 | 17s | 13s | 5 | > >> | 3 | 23s | 13s | 10 | > >> | 4 | 28s | 13s | 15 | > >> | 5 | 33s | 13s | 20 | > >> > >> PR: 249192 > >> MFC after: 3 weeks > >> --- > >> libexec/rc/rc | 49 ++++++++++++++++++++++++++++++++++--------------- > >> 1 file changed, 34 insertions(+), 15 deletions(-) > >> > >> diff --git a/libexec/rc/rc b/libexec/rc/rc > >> index 35db4a850516..722d7fe35884 100644 > >> --- a/libexec/rc/rc > >> +++ b/libexec/rc/rc > >> @@ -91,19 +91,31 @@ if ! [ -e ${firstboot_sentinel} ]; then > >> skip_firstboot="-s firstboot" > >> fi > >> > >> +# rc_parallel_start default is "NO" > >> +rc_parallel_start=${rc_parallel_start:-NO} > > > > Should this go in defaults/rc.conf? > > I think this should be in defaults/rc.conf-- the load_rc_config line is > above it. > > Incidentally, is the plan for this to go into 13 *and* 12, or just 13? > It's an exciting step! If this does go into 13 or 12, it should be tested in -CURRENT for longer than three weeks. Probably six weeks. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Mon Mar 8 08:20:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87907569A4E; Mon, 8 Mar 2021 08:20: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 4DvB8y3Qydz3pSS; Mon, 8 Mar 2021 08:20: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 6475925771; Mon, 8 Mar 2021 08:20: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 1288K2d9006195; Mon, 8 Mar 2021 08:20:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1288K2Fs006192; Mon, 8 Mar 2021 08:20:02 GMT (envelope-from git) Date: Mon, 8 Mar 2021 08:20:02 GMT Message-Id: <202103080820.1288K2Fs006192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: e0fd837a30bd - main - stress2: open(2) tests with BENEATH flags. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0fd837a30bd9e6b0046db9d459fce8b2fc89cce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 08:20:02 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=e0fd837a30bd9e6b0046db9d459fce8b2fc89cce commit e0fd837a30bd9e6b0046db9d459fce8b2fc89cce Author: Peter Holm AuthorDate: 2021-03-08 08:08:58 +0000 Commit: Peter Holm CommitDate: 2021-03-08 08:19:37 +0000 stress2: open(2) tests with BENEATH flags. Update tests to reflect the changes of "open(2): Remove O_BENEATH and AT_BENEATH" in 20e91ca36a56. --- tools/test/stress2/misc/beneath.sh | 11 +++-------- tools/test/stress2/misc/beneath2.sh | 4 ++-- tools/test/stress2/misc/beneath3.sh | 2 +- tools/test/stress2/misc/beneath4.sh | 24 ++++++++++++------------ 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/tools/test/stress2/misc/beneath.sh b/tools/test/stress2/misc/beneath.sh index 6c2f71a7e992..5f61dbd5e383 100755 --- a/tools/test/stress2/misc/beneath.sh +++ b/tools/test/stress2/misc/beneath.sh @@ -27,7 +27,7 @@ # SUCH DAMAGE. # -# Test of open(2) with the O_BENEATH flag. +# Test of open(2) with the O_RESOLVE_BENEATH flag. # userret: returning with the following locks held: # shared lockmgr ufs (ufs) r = 0 (0xfffff804ec0d2a48) locked @ @@ -46,11 +46,6 @@ cat > $top/beneath.c < #include -#ifndef O_BENEATH -#define O_BENEATH 0x00400000 /* Fail if not under cwd */ -#define AT_BENEATH 0x1000 /* Fail if not under dirfd */ -#endif - int main(int argc, char *argv[]) { @@ -61,7 +56,7 @@ main(int argc, char *argv[]) for (i = 1; i < argc; i++) { name = argv[i]; alarm(120); - fd = open(name, O_RDONLY | O_BENEATH); + fd = open(name, O_RDONLY | O_RESOLVE_BENEATH); if (fd == -1) { fprintf(stderr, "open(\"%s\") failed, error %d %s\n", name, errno, strerror(errno)); @@ -69,7 +64,7 @@ main(int argc, char *argv[]) fprintf(stderr, "open(\"%s\") succeeded\n", name); close(fd); } - error = fstatat(AT_FDCWD, name, &st, AT_BENEATH); + error = fstatat(AT_FDCWD, name, &st, AT_RESOLVE_BENEATH); if (error == -1){ fprintf(stderr, "stat(\"%s\") failed, error %d %s\n", name, errno, strerror(errno)); diff --git a/tools/test/stress2/misc/beneath2.sh b/tools/test/stress2/misc/beneath2.sh index 93a937c054ff..a89cd8deb1e1 100755 --- a/tools/test/stress2/misc/beneath2.sh +++ b/tools/test/stress2/misc/beneath2.sh @@ -27,7 +27,7 @@ # SUCH DAMAGE. # -# O_BENEATH test with a relative path, which is a symbolic link pointing +# O_RESOLVE_BENEATH test with a relative path, which is a symbolic link pointing # to an absolute path. # "panic: Assertion (ndp->ni_lcf & NI_LCF_LATCH) != 0 failed at @@ -93,7 +93,7 @@ main(int argc, char *argv[]) exit(1); } file = argv[1]; - if ((fd = open(file, O_RDONLY | O_BENEATH)) != 0 && + if ((fd = open(file, O_RDONLY | O_RESOLVE_BENEATH)) != 0 && errno != ENOTCAPABLE) err(1, "open(%s)", file); diff --git a/tools/test/stress2/misc/beneath3.sh b/tools/test/stress2/misc/beneath3.sh index 52dc37a7f873..46f370899ee8 100755 --- a/tools/test/stress2/misc/beneath3.sh +++ b/tools/test/stress2/misc/beneath3.sh @@ -84,7 +84,7 @@ main(void) char file[] = "/.."; errno = 0; - fd = open(file, O_CREAT | O_RDONLY | O_BENEATH); + fd = open(file, O_CREAT | O_RDONLY | O_RESOLVE_BENEATH); if (fd != -1 || errno != ENOTCAPABLE) err(1, "open(%s) returns %d", file, fd); diff --git a/tools/test/stress2/misc/beneath4.sh b/tools/test/stress2/misc/beneath4.sh index d9ee71a8f222..f1a5c8817662 100755 --- a/tools/test/stress2/misc/beneath4.sh +++ b/tools/test/stress2/misc/beneath4.sh @@ -69,7 +69,7 @@ main(int argc, char *argv[]) sscanf(argv[3], "%x", &flag); exp = atoi(argv[4]); #if 0 - if ((flag & (AT_BENEATH | AT_RESOLVE_BENEATH)) == 0) { + if ((flag & AT_RESOLVE_BENEATH) == 0) { fprintf(stderr, "Flag must be %#x or %#x\n", AT_BENEATH, AT_RESOLVE_BENEATH); return (1); @@ -105,17 +105,17 @@ top=$dir/a cd $here s=0 -ls -lR $dir -echo AT_BENEATH -$dir/beneath4 $top a 0x1000 0 || s=1 -$dir/beneath4 $top b 0x1000 2 || s=1 -$dir/beneath4 $top c 0x1000 0 || s=1 -$dir/beneath4 $top d 0x1000 0 || s=1 -$dir/beneath4 $top e 0x1000 2 || s=1 -$dir/beneath4 $top fifo 0x1000 0 || s=1 -$dir/beneath4 $top $top/../../beneath4.d/a/a 0x1000 93 || s=1 -$dir/beneath4 $top $top/.. 0x1000 93 || s=1 -$dir/beneath4 $top ../a 0x1000 0 || s=1 +#ls -lR $dir +#echo AT_BENEATH +#$dir/beneath4 $top a 0x1000 0 || s=1 +#$dir/beneath4 $top b 0x1000 2 || s=1 +#$dir/beneath4 $top c 0x1000 0 || s=1 +#$dir/beneath4 $top d 0x1000 0 || s=1 +#$dir/beneath4 $top e 0x1000 2 || s=1 +#$dir/beneath4 $top fifo 0x1000 0 || s=1 +#$dir/beneath4 $top $top/../../beneath4.d/a/a 0x1000 93 || s=1 +#$dir/beneath4 $top $top/.. 0x1000 93 || s=1 +#$dir/beneath4 $top ../a 0x1000 0 || s=1 printf "\nAT_RESOLVE_BENEATH\n" $dir/beneath4 $top a 0x2000 0 || s=1 From owner-dev-commits-src-all@freebsd.org Mon Mar 8 09:44:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BE5056BD52; Mon, 8 Mar 2021 09:44: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 4DvD1z2fW1z3tdK; Mon, 8 Mar 2021 09:44: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 4DBDC26D1C; Mon, 8 Mar 2021 09:44: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 1289i7kC024209; Mon, 8 Mar 2021 09:44:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1289i7uY024208; Mon, 8 Mar 2021 09:44:07 GMT (envelope-from git) Date: Mon, 8 Mar 2021 09:44:07 GMT Message-Id: <202103080944.1289i7uY024208@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: 01fe4cac28d0 - main - kern.mk: Fix wrong variable being used for linker path after 172a624f0 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: 01fe4cac28d0b5ab2b8f4ef081fd3c81dcbb4df3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 09:44:07 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=01fe4cac28d0b5ab2b8f4ef081fd3c81dcbb4df3 commit 01fe4cac28d0b5ab2b8f4ef081fd3c81dcbb4df3 Author: Alex Richardson AuthorDate: 2021-03-08 09:37:39 +0000 Commit: Alex Richardson CommitDate: 2021-03-08 09:37:46 +0000 kern.mk: Fix wrong variable being used for linker path after 172a624f0 When I synchronized kern.mk with bsd.sys.mk, I accidentally changed CCLDFLAGS to LDFLAGS which is not used by the kernel builds. This commit should unbreak the GitHub actions cross-build CI. I didn't notice it locally because cheribuild already passes -fuse-ld in the linker flags as it predates this being done in the makefiles. Reported By: Jose Luis Duran Fixes: 172a624f0 ("Silence annoying and incorrect non-default linker warning with GCC") --- sys/conf/kern.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index 8cc79e6645ad..b0a26cd1680c 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -283,9 +283,9 @@ CFLAGS+= -std=${CSTD} .if ${COMPILER_TYPE} == "clang" # Note: Clang does not like relative paths for ld so we map ld.lld -> lld. .if ${COMPILER_VERSION} >= 120000 -LDFLAGS+= --ld-path=${LD:[1]:S/^ld.//1W} +CCLDFLAGS+= --ld-path=${LD:[1]:S/^ld.//1W} .else -LDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W} +CCLDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W} .endif .else # GCC does not support an absolute path for -fuse-ld so we just print this From owner-dev-commits-src-all@freebsd.org Mon Mar 8 09:44:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A34BE56BD53; Mon, 8 Mar 2021 09:44: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 4DvD204BzXz3tWV; Mon, 8 Mar 2021 09:44: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 8336426D91; Mon, 8 Mar 2021 09:44: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 1289i8EY024229; Mon, 8 Mar 2021 09:44:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1289i8Ul024226; Mon, 8 Mar 2021 09:44:08 GMT (envelope-from git) Date: Mon, 8 Mar 2021 09:44:08 GMT Message-Id: <202103080944.1289i8Ul024226@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: 0b86424c31ec - main - tests/sys/cddl: correctly quote atf_set "require.progs" 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: 0b86424c31ece31190c94d55feb5d190be4de5df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 09:44:08 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=0b86424c31ece31190c94d55feb5d190be4de5df commit 0b86424c31ece31190c94d55feb5d190be4de5df Author: Alex Richardson AuthorDate: 2021-03-08 09:38:24 +0000 Commit: Alex Richardson CommitDate: 2021-03-08 09:38:27 +0000 tests/sys/cddl: correctly quote atf_set "require.progs" The argument has to be a single whitespace-separate value. While touching all these lines also add ksh93, since `atf_set "require.progs"` overrides the default value specified in the Kyuafile. This then results in tests being executed despite ksh93 not being installed. Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D29066 --- tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh | 12 +-- .../zfs/tests/acl/nontrivial/nontrivial_test.sh | 34 ++++----- .../sys/cddl/zfs/tests/acl/trivial/trivial_test.sh | 56 +++++++------- tests/sys/cddl/zfs/tests/atime/atime_test.sh | 4 +- tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh | 18 ++--- tests/sys/cddl/zfs/tests/cache/cache_test.sh | 22 +++--- .../sys/cddl/zfs/tests/cachefile/cachefile_test.sh | 8 +- tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh | 2 +- tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh | 6 +- .../zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh | 18 ++--- .../tests/cli_root/zfs_copies/zfs_copies_test.sh | 12 +-- .../tests/cli_root/zfs_create/zfs_create_test.sh | 26 +++---- .../tests/cli_root/zfs_destroy/zfs_destroy_test.sh | 14 ++-- .../zfs/tests/cli_root/zfs_diff/zfs_diff_test.sh | 2 +- .../zfs/tests/cli_root/zfs_get/zfs_get_test.sh | 20 ++--- .../tests/cli_root/zfs_inherit/zfs_inherit_test.sh | 6 +- .../zfs/tests/cli_root/zfs_mount/zfs_mount_test.sh | 24 +++--- .../tests/cli_root/zfs_promote/zfs_promote_test.sh | 16 ++-- .../cli_root/zfs_property/zfs_property_test.sh | 2 +- .../tests/cli_root/zfs_receive/zfs_receive_test.sh | 18 ++--- .../tests/cli_root/zfs_rename/zfs_rename_test.sh | 26 +++---- .../zfs_reservation/zfs_reservation_test.sh | 4 +- .../cli_root/zfs_rollback/zfs_rollback_test.sh | 8 +- .../zfs/tests/cli_root/zfs_send/zfs_send_test.sh | 8 +- .../zfs/tests/cli_root/zfs_set/zfs_set_test.sh | 44 +++++------ .../zfs/tests/cli_root/zfs_share/zfs_share_test.sh | 22 +++--- .../cli_root/zfs_snapshot/zfs_snapshot_test.sh | 14 ++-- .../tests/cli_root/zfs_unmount/zfs_unmount_test.sh | 20 ++--- .../tests/cli_root/zfs_unshare/zfs_unshare_test.sh | 10 +-- .../tests/cli_root/zfs_upgrade/zfs_upgrade_test.sh | 14 ++-- .../cddl/zfs/tests/cli_root/zpool/zpool_test.sh | 6 +- .../zfs/tests/cli_root/zpool_add/zpool_add_test.sh | 20 ++--- .../cli_root/zpool_attach/zpool_attach_test.sh | 2 +- .../tests/cli_root/zpool_clear/zpool_clear_test.sh | 10 +-- .../cli_root/zpool_create/zpool_create_test.sh | 40 +++++----- .../cli_root/zpool_destroy/zpool_destroy_test.sh | 8 +- .../cli_root/zpool_detach/zpool_detach_test.sh | 2 +- .../cli_root/zpool_expand/zpool_expand_test.sh | 6 +- .../cli_root/zpool_export/zpool_export_test.sh | 8 +- .../zfs/tests/cli_root/zpool_get/zpool_get_test.sh | 8 +- .../cli_root/zpool_history/zpool_history_test.sh | 4 +- .../cli_root/zpool_import/zpool_import_test.sh | 46 ++++++------ .../cli_root/zpool_offline/zpool_offline_test.sh | 4 +- .../cli_root/zpool_online/zpool_online_test.sh | 4 +- .../cli_root/zpool_remove/zpool_remove_test.sh | 6 +- .../cli_root/zpool_replace/zpool_replace_test.sh | 4 +- .../tests/cli_root/zpool_scrub/zpool_scrub_test.sh | 10 +-- .../zfs/tests/cli_root/zpool_set/zpool_set_test.sh | 6 +- .../cli_root/zpool_status/zpool_status_test.sh | 4 +- .../cli_root/zpool_upgrade/zpool_upgrade_test.sh | 18 ++--- .../sys/cddl/zfs/tests/cli_user/misc/misc_test.sh | 86 +++++++++++----------- .../zfs/tests/cli_user/zfs_list/zfs_list_test.sh | 16 ++-- .../cli_user/zpool_iostat/zpool_iostat_test.sh | 6 +- .../tests/cli_user/zpool_list/zpool_list_test.sh | 4 +- .../cddl/zfs/tests/compression/compression_test.sh | 6 +- tests/sys/cddl/zfs/tests/ctime/ctime_test.sh | 2 +- .../sys/cddl/zfs/tests/delegate/zfs_allow_test.sh | 24 +++--- .../cddl/zfs/tests/delegate/zfs_unallow_test.sh | 16 ++-- tests/sys/cddl/zfs/tests/devices/devices_test.sh | 4 +- tests/sys/cddl/zfs/tests/exec/exec_test.sh | 4 +- .../sys/cddl/zfs/tests/grow_pool/grow_pool_test.sh | 2 +- .../zfs/tests/grow_replicas/grow_replicas_test.sh | 2 +- tests/sys/cddl/zfs/tests/history/history_test.sh | 20 ++--- tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh | 6 +- tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh | 52 ++++++------- .../cddl/zfs/tests/inheritance/inheritance_test.sh | 2 +- tests/sys/cddl/zfs/tests/interop/interop_test.sh | 2 +- tests/sys/cddl/zfs/tests/inuse/inuse_test.sh | 4 +- tests/sys/cddl/zfs/tests/iscsi/iscsi_test.sh | 12 +-- .../zfs/tests/largest_pool/largest_pool_test.sh | 2 +- .../cddl/zfs/tests/link_count/link_count_test.sh | 2 +- .../sys/cddl/zfs/tests/migration/migration_test.sh | 24 +++--- tests/sys/cddl/zfs/tests/mmap/mmap_test.sh | 2 +- tests/sys/cddl/zfs/tests/mount/mount_test.sh | 4 +- tests/sys/cddl/zfs/tests/mv_files/mv_files_test.sh | 4 +- tests/sys/cddl/zfs/tests/nestedfs/nestedfs_test.sh | 2 +- tests/sys/cddl/zfs/tests/no_space/no_space_test.sh | 2 +- .../tests/online_offline/online_offline_test.sh | 4 +- .../cddl/zfs/tests/pool_names/pool_names_test.sh | 4 +- .../cddl/zfs/tests/poolversion/poolversion_test.sh | 4 +- tests/sys/cddl/zfs/tests/quota/quota_test.sh | 12 +-- .../cddl/zfs/tests/redundancy/redundancy_test.sh | 2 +- tests/sys/cddl/zfs/tests/refquota/refquota_test.sh | 12 +-- .../sys/cddl/zfs/tests/refreserv/refreserv_test.sh | 10 +-- .../cddl/zfs/tests/replacement/replacement_test.sh | 6 +- .../cddl/zfs/tests/reservation/reservation_test.sh | 36 ++++----- tests/sys/cddl/zfs/tests/rootpool/rootpool_test.sh | 4 +- tests/sys/cddl/zfs/tests/rsend/rsend_test.sh | 26 +++---- .../zfs/tests/scrub_mirror/scrub_mirror_test.sh | 8 +- tests/sys/cddl/zfs/tests/slog/slog_test.sh | 28 +++---- tests/sys/cddl/zfs/tests/snapshot/snapshot_test.sh | 48 ++++++------ tests/sys/cddl/zfs/tests/snapused/snapused_test.sh | 10 +-- tests/sys/cddl/zfs/tests/sparse/sparse_test.sh | 2 +- tests/sys/cddl/zfs/tests/truncate/truncate_test.sh | 2 +- .../sys/cddl/zfs/tests/userquota/userquota_test.sh | 32 ++++---- .../cddl/zfs/tests/utils_test/utils_test_test.sh | 18 ++--- .../cddl/zfs/tests/write_dirs/write_dirs_test.sh | 4 +- tests/sys/cddl/zfs/tests/xattr/xattr_test.sh | 26 +++---- tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh | 36 ++++----- tests/sys/cddl/zfs/tests/zil/zil_test.sh | 4 +- tests/sys/cddl/zfs/tests/zinject/zinject_test.sh | 8 +- tests/sys/cddl/zfs/tests/zones/zones_test.sh | 10 +-- .../cddl/zfs/tests/zvol/zvol_cli/zvol_cli_test.sh | 6 +- .../zfs/tests/zvol/zvol_misc/zvol_misc_test.sh | 16 ++-- .../zfs/tests/zvol/zvol_swap/zvol_swap_test.sh | 12 +-- .../cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh | 2 +- 106 files changed, 705 insertions(+), 705 deletions(-) diff --git a/tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh b/tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh index 01a14aac61ed..e05ad8b03912 100755 --- a/tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh +++ b/tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh @@ -30,8 +30,8 @@ atf_test_case cifs_attr_001_pos cleanup cifs_attr_001_pos_head() { atf_set "descr" "Verify set/clear DOS attributes will succeed while user haswrite_attributes permission or PRIV_FILE_OWNER privilege" - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runwattr + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runwattr" } cifs_attr_001_pos_body() { @@ -57,8 +57,8 @@ atf_test_case cifs_attr_002_pos cleanup cifs_attr_002_pos_head() { atf_set "descr" "Verify set/clear BSD'ish attributes will succeed while user hasPRIV_FILE_FLAG_SET/PRIV_FILE_FLAG_CLEAR privilege" - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runwattr + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runwattr" } cifs_attr_002_pos_body() { @@ -84,8 +84,8 @@ atf_test_case cifs_attr_003_pos cleanup cifs_attr_003_pos_head() { atf_set "descr" "Verify DOS & BSD'ish attributes will provide theaccess limitation as expected." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runat" } cifs_attr_003_pos_body() { diff --git a/tests/sys/cddl/zfs/tests/acl/nontrivial/nontrivial_test.sh b/tests/sys/cddl/zfs/tests/acl/nontrivial/nontrivial_test.sh index 01abe61d532f..a75c25e9c721 100755 --- a/tests/sys/cddl/zfs/tests/acl/nontrivial/nontrivial_test.sh +++ b/tests/sys/cddl/zfs/tests/acl/nontrivial/nontrivial_test.sh @@ -55,7 +55,7 @@ zfs_acl_chmod_002_pos_head() { atf_set "descr" "Verify acl after upgrading." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_chmod_002_pos_body() { @@ -80,7 +80,7 @@ zfs_acl_chmod_aclmode_001_pos_head() { atf_set "descr" "Verify chmod have correct behaviour to directory and file whenfilesystem has the different aclmode setting." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_chmod_aclmode_001_pos_body() { @@ -177,7 +177,7 @@ zfs_acl_chmod_inherit_002_pos_head() { atf_set "descr" "Verify chmod have correct behaviour to directory and file whenfilesystem has the different aclinherit setting." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_chmod_inherit_002_pos_body() { @@ -202,7 +202,7 @@ zfs_acl_chmod_inherit_003_pos_head() { atf_set "descr" "Verify chmod have correct behaviour to directory and file whenfilesystem has the different aclinherit setting." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_chmod_inherit_003_pos_body() { @@ -227,7 +227,7 @@ zfs_acl_chmod_inherit_004_pos_head() { atf_set "descr" "Verify aclinherit=passthrough-x will inherit the 'x' bits while mode request." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } zfs_acl_chmod_inherit_004_pos_body() { @@ -395,8 +395,8 @@ atf_test_case zfs_acl_chmod_xattr_001_pos cleanup zfs_acl_chmod_xattr_001_pos_head() { atf_set "descr" "Verify that the permission of read_xattr/write_xattr forowner/group/everyone are correct." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runat" } zfs_acl_chmod_xattr_001_pos_body() { @@ -421,7 +421,7 @@ zfs_acl_chmod_xattr_002_pos_head() { atf_set "descr" "Verify that the permission of write_xattr forowner/group/everyone while remove extended attributes are correct." atf_set "require.config" zfs_xattr - atf_set "require.progs" runat + atf_set "require.progs" "ksh93 runat" } zfs_acl_chmod_xattr_002_pos_body() { @@ -446,7 +446,7 @@ zfs_acl_cp_001_pos_head() { atf_set "descr" "Verify that '$CP [-p]' supports ZFS ACLs." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_cp_001_pos_body() { @@ -470,8 +470,8 @@ atf_test_case zfs_acl_cp_002_pos cleanup zfs_acl_cp_002_pos_head() { atf_set "descr" "Verify that '$CP [-p]' supports ZFS ACLs." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" zfs runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 zfs runat" } zfs_acl_cp_002_pos_body() { @@ -496,7 +496,7 @@ zfs_acl_cpio_001_pos_head() { atf_set "descr" "Verify that '$CPIO' command supports to archive ZFS ACLs." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_cpio_001_pos_body() { @@ -520,8 +520,8 @@ atf_test_case zfs_acl_cpio_002_pos cleanup zfs_acl_cpio_002_pos_head() { atf_set "descr" "Verify that '$CPIO' command supports to archive ZFS ACLs & xattrs." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" zfs runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 zfs runat" } zfs_acl_cpio_002_pos_body() { @@ -618,7 +618,7 @@ zfs_acl_tar_001_pos_head() { atf_set "descr" "Verify that '$TAR' command supports to archive ZFS ACLs." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_tar_001_pos_body() { @@ -642,8 +642,8 @@ atf_test_case zfs_acl_tar_002_pos cleanup zfs_acl_tar_002_pos_head() { atf_set "descr" "Verify that '$TAR' command supports to archive ZFS ACLs & xattrs." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" zfs runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 zfs runat" } zfs_acl_tar_002_pos_body() { diff --git a/tests/sys/cddl/zfs/tests/acl/trivial/trivial_test.sh b/tests/sys/cddl/zfs/tests/acl/trivial/trivial_test.sh index f979cc30c145..26ee9f534084 100755 --- a/tests/sys/cddl/zfs/tests/acl/trivial/trivial_test.sh +++ b/tests/sys/cddl/zfs/tests/acl/trivial/trivial_test.sh @@ -53,7 +53,7 @@ atf_test_case zfs_acl_compress_001_pos cleanup zfs_acl_compress_001_pos_head() { atf_set "descr" "Compress will keep file attribute intact after the file iscompressed and uncompressed" - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_compress_001_pos_body() { @@ -77,7 +77,7 @@ atf_test_case zfs_acl_cp_001_pos cleanup zfs_acl_cp_001_pos_head() { atf_set "descr" "Verifies that cp will include file attribute when using the -@ flag" - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_cp_001_pos_body() { @@ -101,7 +101,7 @@ atf_test_case zfs_acl_cp_002_neg cleanup zfs_acl_cp_002_neg_head() { atf_set "descr" "Verifies that cp will not include file attribute when the -@ flagis not present." - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_cp_002_neg_body() { @@ -125,8 +125,8 @@ atf_test_case zfs_acl_cp_003_neg cleanup zfs_acl_cp_003_neg_head() { atf_set "descr" "Verifies that cp won't be able to include file attribute whenattribute is unreadable (except root)" - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runat" } zfs_acl_cp_003_neg_body() { @@ -150,7 +150,7 @@ atf_test_case zfs_acl_find_001_pos cleanup zfs_acl_find_001_pos_head() { atf_set "descr" "Verifies ability to find files with attribute with-xattr flag and using '-exec runat ls'" - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_find_001_pos_body() { @@ -174,8 +174,8 @@ atf_test_case zfs_acl_find_002_neg cleanup zfs_acl_find_002_neg_head() { atf_set "descr" "verifies -xattr doesn't include files withoutattribute and using '-exec runat ls'" - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runat" } zfs_acl_find_002_neg_body() { @@ -199,7 +199,7 @@ atf_test_case zfs_acl_ls_001_pos cleanup zfs_acl_ls_001_pos_head() { atf_set "descr" "Verifies that ls displays @ in the file permissions using ls -@for files with attribute." - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_ls_001_pos_body() { @@ -223,8 +223,8 @@ atf_test_case zfs_acl_ls_002_neg cleanup zfs_acl_ls_002_neg_head() { atf_set "descr" "Verifies that ls doesn't display @ in the filepermissions using ls -@ for files without attribute." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runat" } zfs_acl_ls_002_neg_body() { @@ -248,7 +248,7 @@ atf_test_case zfs_acl_mv_001_pos cleanup zfs_acl_mv_001_pos_head() { atf_set "descr" "Verifies that mv will include file attribute." - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_mv_001_pos_body() { @@ -272,8 +272,8 @@ atf_test_case zfs_acl_pack_001_pos cleanup zfs_acl_pack_001_pos_head() { atf_set "descr" "Verifies that pack will keep file attribute intact after the fileis packed and unpacked" - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" unpack pack + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 unpack pack" } zfs_acl_pack_001_pos_body() { @@ -297,8 +297,8 @@ atf_test_case zfs_acl_pax_001_pos cleanup zfs_acl_pax_001_pos_head() { atf_set "descr" "Verify include attribute in pax archive and restore with paxshould succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_001_pos_body() { @@ -322,8 +322,8 @@ atf_test_case zfs_acl_pax_002_pos cleanup zfs_acl_pax_002_pos_head() { atf_set "descr" "Verify include attribute in pax archive and restore with tarshould succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_002_pos_body() { @@ -347,8 +347,8 @@ atf_test_case zfs_acl_pax_003_pos cleanup zfs_acl_pax_003_pos_head() { atf_set "descr" "Verify include attribute in pax archive and restore with cpioshould succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_003_pos_body() { @@ -372,8 +372,8 @@ atf_test_case zfs_acl_pax_004_pos cleanup zfs_acl_pax_004_pos_head() { atf_set "descr" "Verify files include attribute in pax archive and restore with paxshould succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_004_pos_body() { @@ -397,8 +397,8 @@ atf_test_case zfs_acl_pax_005_pos cleanup zfs_acl_pax_005_pos_head() { atf_set "descr" "Verify files include attribute in cpio archive and restore withcpio should succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_005_pos_body() { @@ -422,8 +422,8 @@ atf_test_case zfs_acl_pax_006_pos cleanup zfs_acl_pax_006_pos_head() { atf_set "descr" "Verify files include attribute in tar archive and restore withtar should succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_006_pos_body() { @@ -447,7 +447,7 @@ atf_test_case zfs_acl_tar_001_pos cleanup zfs_acl_tar_001_pos_head() { atf_set "descr" "Verifies that tar will include file attribute when @ flag ispresent." - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_tar_001_pos_body() { @@ -471,7 +471,7 @@ atf_test_case zfs_acl_tar_002_neg cleanup zfs_acl_tar_002_neg_head() { atf_set "descr" "Verifies that tar will not include files attribute when @ flag isnot present" - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_tar_002_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/atime/atime_test.sh b/tests/sys/cddl/zfs/tests/atime/atime_test.sh index a36fc5c2eee2..7350c750ac3e 100755 --- a/tests/sys/cddl/zfs/tests/atime/atime_test.sh +++ b/tests/sys/cddl/zfs/tests/atime/atime_test.sh @@ -30,7 +30,7 @@ atf_test_case atime_001_pos cleanup atime_001_pos_head() { atf_set "descr" "Setting atime=on, the access time for files is updated when read." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } atime_001_pos_body() { @@ -56,7 +56,7 @@ atf_test_case atime_002_neg cleanup atime_002_neg_head() { atf_set "descr" "Setting atime=off, the access time for files will not be updatedwhen read." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } atime_002_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh b/tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh index b6a9feb0f3ba..9cb52e73409c 100755 --- a/tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh +++ b/tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh @@ -30,7 +30,7 @@ atf_test_case bootfs_001_pos bootfs_001_pos_head() { atf_set "descr" "Valid datasets are accepted as bootfs property values" - atf_set "require.progs" zpool zfs + atf_set "require.progs" "ksh93 zpool zfs" } bootfs_001_pos_body() { @@ -45,7 +45,7 @@ atf_test_case bootfs_002_neg bootfs_002_neg_head() { atf_set "descr" "Invalid datasets are rejected as boot property values" - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } bootfs_002_neg_body() { @@ -61,7 +61,7 @@ atf_test_case bootfs_003_pos bootfs_003_pos_head() { atf_set "descr" "Valid pool names are accepted by zpool set bootfs" - atf_set "require.progs" zpool zfs + atf_set "require.progs" "ksh93 zpool zfs" } bootfs_003_pos_body() { @@ -76,7 +76,7 @@ atf_test_case bootfs_004_neg bootfs_004_neg_head() { atf_set "descr" "Invalid pool names are rejected by zpool set bootfs" - atf_set "require.progs" zpool zfs + atf_set "require.progs" "ksh93 zpool zfs" } bootfs_004_neg_body() { @@ -91,7 +91,7 @@ atf_test_case bootfs_005_neg bootfs_005_neg_head() { atf_set "descr" "Boot properties cannot be set on pools with older versions" - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } bootfs_005_neg_body() { @@ -107,7 +107,7 @@ atf_test_case bootfs_006_pos bootfs_006_pos_head() { atf_set "descr" "Pools of correct vdev types accept boot property" - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } bootfs_006_pos_body() { @@ -122,7 +122,7 @@ atf_test_case bootfs_007_pos bootfs_007_pos_head() { atf_set "descr" "setting bootfs on a pool which was configured with the whole disk will succeed" - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } bootfs_007_pos_body() { @@ -138,7 +138,7 @@ atf_test_case bootfs_008_neg bootfs_008_neg_head() { atf_set "descr" "setting bootfs on a dataset which has gzip compression enabled will fail" - atf_set "require.progs" zpool zfs + atf_set "require.progs" "ksh93 zpool zfs" } bootfs_008_neg_body() { @@ -154,7 +154,7 @@ bootfs_009_neg_head() { atf_set "descr" "Valid encrypted datasets can't be set bootfs property values" atf_set "require.config" zfs_encryption - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } bootfs_009_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/cache/cache_test.sh b/tests/sys/cddl/zfs/tests/cache/cache_test.sh index f722dbf0efdc..cf420d1e2b41 100755 --- a/tests/sys/cddl/zfs/tests/cache/cache_test.sh +++ b/tests/sys/cddl/zfs/tests/cache/cache_test.sh @@ -30,7 +30,7 @@ atf_test_case cache_001_pos cleanup cache_001_pos_head() { atf_set "descr" "Creating a pool with a cache device succeeds." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_001_pos_body() @@ -57,7 +57,7 @@ atf_test_case cache_002_pos cleanup cache_002_pos_head() { atf_set "descr" "Adding a cache device to normal pool works." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_002_pos_body() @@ -84,7 +84,7 @@ atf_test_case cache_003_pos cleanup cache_003_pos_head() { atf_set "descr" "Adding an extra cache device works." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_003_pos_body() @@ -111,7 +111,7 @@ atf_test_case cache_004_neg cleanup cache_004_neg_head() { atf_set "descr" "Attaching a cache device fails." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_004_neg_body() @@ -138,7 +138,7 @@ atf_test_case cache_005_neg cleanup cache_005_neg_head() { atf_set "descr" "Replacing a cache device fails." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_005_neg_body() @@ -165,7 +165,7 @@ atf_test_case cache_006_pos cleanup cache_006_pos_head() { atf_set "descr" "Exporting and importing pool with cache devices passes." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_006_pos_body() @@ -192,7 +192,7 @@ atf_test_case cache_007_neg cleanup cache_007_neg_head() { atf_set "descr" "A mirror/raidz/raidz2 cache is not supported." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_007_neg_body() @@ -219,7 +219,7 @@ atf_test_case cache_008_neg cleanup cache_008_neg_head() { atf_set "descr" "A raidz/raidz2 cache can not be added to existed pool." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_008_neg_body() @@ -246,7 +246,7 @@ atf_test_case cache_009_pos cleanup cache_009_pos_head() { atf_set "descr" "Offline and online a cache device succeed." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_009_pos_body() @@ -273,7 +273,7 @@ atf_test_case cache_010_neg cleanup cache_010_neg_head() { atf_set "descr" "Cache device can only be disk or slice." - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" atf_set "timeout" 1200 } cache_010_neg_body() @@ -300,7 +300,7 @@ atf_test_case cache_011_pos cleanup cache_011_pos_head() { atf_set "descr" "Remove cache device from pool with spare device should succeed" - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_011_pos_body() diff --git a/tests/sys/cddl/zfs/tests/cachefile/cachefile_test.sh b/tests/sys/cddl/zfs/tests/cachefile/cachefile_test.sh index 04e7dc09f7e5..691ca66e3682 100755 --- a/tests/sys/cddl/zfs/tests/cachefile/cachefile_test.sh +++ b/tests/sys/cddl/zfs/tests/cachefile/cachefile_test.sh @@ -30,7 +30,7 @@ atf_test_case cachefile_001_pos cachefile_001_pos_head() { atf_set "descr" "Creating a pool with \cachefile\ set doesn't update zpool.cache" - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" } cachefile_001_pos_body() { @@ -47,7 +47,7 @@ atf_test_case cachefile_002_pos cachefile_002_pos_head() { atf_set "descr" "Importing a pool with \cachefile\ set doesn't update zpool.cache" - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" } cachefile_002_pos_body() { @@ -64,7 +64,7 @@ atf_test_case cachefile_003_pos cachefile_003_pos_head() { atf_set "descr" "Setting altroot=path and cachefile=$CPATH for zpool create succeed." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" } cachefile_003_pos_body() { @@ -81,7 +81,7 @@ atf_test_case cachefile_004_pos cachefile_004_pos_head() { atf_set "descr" "Verify set, export and destroy when cachefile is set on pool." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" } cachefile_004_pos_body() { diff --git a/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh index e75da9201b5d..60168a3da493 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh @@ -30,7 +30,7 @@ atf_test_case zdb_001_neg cleanup zdb_001_neg_head() { atf_set "descr" "Execute zdb using invalid parameters." - atf_set "require.progs" zdb + atf_set "require.progs" "ksh93 zdb" } zdb_001_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh index 3d2270e28af8..aa96a7846983 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh @@ -30,7 +30,7 @@ atf_test_case zfs_001_neg cleanup zfs_001_neg_head() { atf_set "descr" "Badly-formed zfs sub-command should return an error." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_001_neg_body() { @@ -54,7 +54,7 @@ atf_test_case zfs_002_pos cleanup zfs_002_pos_head() { atf_set "descr" "With ZFS_ABORT set, all zfs commands can abort and generate a core file." - atf_set "require.progs" zfs coreadm + atf_set "require.progs" "ksh93 zfs coreadm" } zfs_002_pos_body() { @@ -78,7 +78,7 @@ atf_test_case zfs_003_neg cleanup zfs_003_neg_head() { atf_set "descr" "zfs fails with unexpected scenarios." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_003_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh index 5e82fd885ce1..d304770f419e 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh @@ -30,7 +30,7 @@ atf_test_case zfs_clone_001_neg cleanup zfs_clone_001_neg_head() { atf_set "descr" "Badly-formed 'zfs clone' with inapplicable scenariosshould return an error." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_001_neg_body() { @@ -54,7 +54,7 @@ atf_test_case zfs_clone_002_pos cleanup zfs_clone_002_pos_head() { atf_set "descr" "clone -p should work as expected." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_002_pos_body() { @@ -78,7 +78,7 @@ atf_test_case zfs_clone_003_pos cleanup zfs_clone_003_pos_head() { atf_set "descr" "'zfs clone -o property=value filesystem' can successfully createa ZFS clone filesystem with correct property set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_003_pos_body() { @@ -102,7 +102,7 @@ atf_test_case zfs_clone_004_pos cleanup zfs_clone_004_pos_head() { atf_set "descr" "'zfs clone -o property=value filesystem' can successfully createa ZFS clone filesystem with multiple properties set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_004_pos_body() { @@ -126,7 +126,7 @@ atf_test_case zfs_clone_005_pos cleanup zfs_clone_005_pos_head() { atf_set "descr" "'zfs clone -o property=value -V size volume' can successfullycreate a ZFS clone volume with correct property set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_005_pos_body() { @@ -150,7 +150,7 @@ atf_test_case zfs_clone_006_pos cleanup zfs_clone_006_pos_head() { atf_set "descr" "'zfs clone -o property=value volume' can successfullycreate a ZFS clone volume with multiple correct properties set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_006_pos_body() { @@ -174,7 +174,7 @@ atf_test_case zfs_clone_007_pos cleanup zfs_clone_007_pos_head() { atf_set "descr" "'zfs clone -o version=' could upgrade version,but downgrade is denied." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_007_pos_body() { @@ -198,7 +198,7 @@ atf_test_case zfs_clone_008_neg cleanup zfs_clone_008_neg_head() { atf_set "descr" "Verify 'zfs clone -o ' fails with bad argument." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_008_neg_body() { @@ -222,7 +222,7 @@ atf_test_case zfs_clone_009_neg cleanup zfs_clone_009_neg_head() { atf_set "descr" "Verify 'zfs clone -o ' fails with bad argument." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_009_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh index 121b94b80b92..d0cd94ae0484 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh @@ -30,7 +30,7 @@ atf_test_case zfs_copies_001_pos cleanup zfs_copies_001_pos_head() { atf_set "descr" "Verify 'copies' property with correct arguments works or not." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_copies_001_pos_body() { @@ -56,7 +56,7 @@ atf_test_case zfs_copies_002_pos cleanup zfs_copies_002_pos_head() { atf_set "descr" "Verify that the space used by multiple copies is charged correctly." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_copies_002_pos_body() { @@ -82,7 +82,7 @@ atf_test_case zfs_copies_003_pos cleanup zfs_copies_003_pos_head() { atf_set "descr" "Verify that ZFS volume space used by multiple copies is charged correctly." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_copies_003_pos_body() { @@ -108,7 +108,7 @@ atf_test_case zfs_copies_004_neg cleanup zfs_copies_004_neg_head() { atf_set "descr" "Verify that copies property cannot be set to any value other than 1,2 or 3" - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_copies_004_neg_body() { @@ -135,7 +135,7 @@ atf_test_case zfs_copies_005_neg cleanup zfs_copies_005_neg_head() { atf_set "descr" "Verify that copies cannot be set with pool version 1" - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } zfs_copies_005_neg_body() { @@ -161,7 +161,7 @@ atf_test_case zfs_copies_006_pos cleanup zfs_copies_006_pos_head() { atf_set "descr" "Verify that ZFS volume space used by multiple copies is charged correctly." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_copies_006_pos_body() { diff --git a/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_test.sh index 00185dbf4a0b..a79a10263386 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_test.sh @@ -30,7 +30,7 @@ atf_test_case zfs_create_001_pos cleanup zfs_create_001_pos_head() { atf_set "descr" "'zfs create ' can create a ZFS filesystem in the namespace." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_001_pos_body() { @@ -58,7 +58,7 @@ atf_test_case zfs_create_002_pos cleanup zfs_create_002_pos_head() { atf_set "descr" "'zfs create -s -V ' succeeds" - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_002_pos_body() { @@ -86,7 +86,7 @@ atf_test_case zfs_create_003_pos cleanup zfs_create_003_pos_head() { atf_set "descr" "Verify creating volume with specified blocksize works." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_003_pos_body() { @@ -114,7 +114,7 @@ atf_test_case zfs_create_004_pos cleanup zfs_create_004_pos_head() { atf_set "descr" "'zfs create -o property=value filesystem' can successfully createa ZFS filesystem with correct property set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_004_pos_body() { @@ -142,7 +142,7 @@ atf_test_case zfs_create_005_pos cleanup zfs_create_005_pos_head() { atf_set "descr" "'zfs create -o property=value filesystem' can successfully createa ZFS filesystem with multiple properties set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_005_pos_body() { @@ -170,7 +170,7 @@ atf_test_case zfs_create_006_pos cleanup zfs_create_006_pos_head() { atf_set "descr" "'zfs create -o property=value -V size volume' can successfullycreate a ZFS volume with correct property set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_006_pos_body() { @@ -198,7 +198,7 @@ atf_test_case zfs_create_007_pos cleanup zfs_create_007_pos_head() { atf_set "descr" "'zfs create -o property=value -V size volume' can successfullycreate a ZFS volume with correct property set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_007_pos_body() { @@ -226,7 +226,7 @@ atf_test_case zfs_create_008_neg cleanup zfs_create_008_neg_head() { *** 5791 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Mar 8 09:44:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EB1C56BEC0; Mon, 8 Mar 2021 09:44: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 4DvD216r2fz3tYM; Mon, 8 Mar 2021 09:44: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 B8676269FC; Mon, 8 Mar 2021 09:44: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 1289i9ke024249; Mon, 8 Mar 2021 09:44:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1289i9R8024248; Mon, 8 Mar 2021 09:44:09 GMT (envelope-from git) Date: Mon, 8 Mar 2021 09:44:09 GMT Message-Id: <202103080944.1289i9R8024248@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: 221622ec0c8e - main - lib/msun: Avoid FE_INEXACT for x86 log2l/log10l 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: 221622ec0c8e184dd1ea7e1f77fb45d2d32cb6e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 09:44:11 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=221622ec0c8e184dd1ea7e1f77fb45d2d32cb6e2 commit 221622ec0c8e184dd1ea7e1f77fb45d2d32cb6e2 Author: Alex Richardson AuthorDate: 2021-03-08 09:39:29 +0000 Commit: Alex Richardson CommitDate: 2021-03-08 09:39:32 +0000 lib/msun: Avoid FE_INEXACT for x86 log2l/log10l This fixes tests/lib/msun/logarithm_test after compiling the test with -fno-builtin (D28577). Adding invln10_lo + invln10_10 results in FE_INEXACT (for all inputs) and the same for the log2l invln2_lo + invln2_hi. This patch avoids FE_INEXACT (for exact results such as 0) by defining a constant and using that. Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D28786 --- lib/msun/ld128/s_logl.c | 18 +++++++++--------- lib/msun/ld80/s_logl.c | 9 ++++++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/msun/ld128/s_logl.c b/lib/msun/ld128/s_logl.c index 93a2a7c35ff5..4774a271e7ad 100644 --- a/lib/msun/ld128/s_logl.c +++ b/lib/msun/ld128/s_logl.c @@ -697,14 +697,15 @@ invln10_hi = 4.3429448176175356e-1, /* 0x1bcb7b15000000.0p-54 */ invln2_hi = 1.4426950402557850e0; /* 0x17154765000000.0p-52 */ static const long double invln10_lo = 1.41498268538580090791605082294397000e-10L, /* 0x137287195355baaafad33dc323ee3.0p-145L */ -invln2_lo = 6.33178418956604368501892137426645911e-10L; /* 0x15c17f0bbbe87fed0691d3e88eb57.0p-143L */ +invln2_lo = 6.33178418956604368501892137426645911e-10L, /* 0x15c17f0bbbe87fed0691d3e88eb57.0p-143L */ +invln10_lo_plus_hi = invln10_lo + invln10_hi, +invln2_lo_plus_hi = invln2_lo + invln2_hi; long double log10l(long double x) { struct ld r; - long double lo; - float hi; + long double hi, lo; ENTERI(); DOPRINT_START(&x); @@ -712,18 +713,17 @@ log10l(long double x) if (!r.lo_set) RETURNPI(r.hi); _2sumF(r.hi, r.lo); - hi = r.hi; + hi = (float)r.hi; lo = r.lo + (r.hi - hi); RETURN2PI(invln10_hi * hi, - (invln10_lo + invln10_hi) * lo + invln10_lo * hi); + invln10_lo_plus_hi * lo + invln10_lo * hi); } long double log2l(long double x) { struct ld r; - long double lo; - float hi; + long double hi, lo; ENTERI(); DOPRINT_START(&x); @@ -731,10 +731,10 @@ log2l(long double x) if (!r.lo_set) RETURNPI(r.hi); _2sumF(r.hi, r.lo); - hi = r.hi; + hi = (float)r.hi; lo = r.lo + (r.hi - hi); RETURN2PI(invln2_hi * hi, - (invln2_lo + invln2_hi) * lo + invln2_lo * hi); + invln2_lo_plus_hi * lo + invln2_lo * hi); } #endif /* STRUCT_RETURN */ diff --git a/lib/msun/ld80/s_logl.c b/lib/msun/ld80/s_logl.c index 0a220f2a2403..d787b953fedb 100644 --- a/lib/msun/ld80/s_logl.c +++ b/lib/msun/ld80/s_logl.c @@ -677,8 +677,11 @@ logl(long double x) static const double invln10_hi = 4.3429448190317999e-1, /* 0x1bcb7b1526e000.0p-54 */ invln10_lo = 7.1842412889749798e-14, /* 0x1438ca9aadd558.0p-96 */ +invln10_lo_plus_hi = invln10_lo + invln10_hi, invln2_hi = 1.4426950408887933e0, /* 0x171547652b8000.0p-52 */ -invln2_lo = 1.7010652264631490e-13; /* 0x17f0bbbe87fed0.0p-95 */ +invln2_lo = 1.7010652264631490e-13, /* 0x17f0bbbe87fed0.0p-95 */ +invln2_lo_plus_hi = invln2_lo + invln2_hi; + long double log10l(long double x) @@ -695,7 +698,7 @@ log10l(long double x) hi = (float)r.hi; lo = r.lo + (r.hi - hi); RETURN2PI(invln10_hi * hi, - (invln10_lo + invln10_hi) * lo + invln10_lo * hi); + invln10_lo_plus_hi * lo + invln10_lo * hi); } long double @@ -713,7 +716,7 @@ log2l(long double x) hi = (float)r.hi; lo = r.lo + (r.hi - hi); RETURN2PI(invln2_hi * hi, - (invln2_lo + invln2_hi) * lo + invln2_lo * hi); + invln2_lo_plus_hi * lo + invln2_lo * hi); } #endif /* STRUCT_RETURN */ From owner-dev-commits-src-all@freebsd.org Mon Mar 8 09:44:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAF3956BCED; Mon, 8 Mar 2021 09:44:15 +0000 (UTC) (envelope-from agh@riseup.net) Received: from mx1.riseup.net (mx1.riseup.net [198.252.153.129]) (using TLSv1.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 "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DvD2265hjz3tdb; Mon, 8 Mar 2021 09:44:10 +0000 (UTC) (envelope-from agh@riseup.net) Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4DvD203TZ8zDrL7; Mon, 8 Mar 2021 01:44:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1615196648; bh=9Cs97QBmWFjv33SHmenp4cBTqCK7P0cB1uIWRwIXRlw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oVlsDCeKzX4vNnMWGj69AMADTGkZXIH65Z6IRDvLNHE0X4HIMWscpcWFSNLsA+/oe wam26U336oCGxcm3mnC8zDT59jrFae/Pl1n07do8lnzWg8e+Qq/Y7fEvc5LTsQeCs9 mfxokgMal6OSzGl1aPvC0yGsdQdHvIT1N4ISNsGc= X-Riseup-User-ID: 0A0EBF42FDD35DCF63E231CAA4A3059EAD9135C1AED763365B01EC14C05E7180 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4DvD201QXkz1xmR; Mon, 8 Mar 2021 01:44:08 -0800 (PST) MIME-Version: 1.0 Date: Mon, 08 Mar 2021 01:44:08 -0800 From: Alastair Hogge To: Cy Schubert Cc: Chris Rees , dev-commits-src-all@freebsd.org, Baptiste Daroussin , src-committers@freebsd.org, dev-commits-src-main@freebsd.org, Rick Parrish Subject: Re: git: 77e1ccbee3ed - main - rc: implement parallel boot In-Reply-To: <202103080716.1287GQWB055131@slippy.cwsent.com> References: <202102231027.11NARYYE041280@gitrepo.freebsd.org> <6D4FCE07-B996-430C-8EA8-6CB37A6DEEE8@bayofrum.net> <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> <202103080716.1287GQWB055131@slippy.cwsent.com> Message-ID: <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DvD2265hjz3tdb X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=riseup.net header.s=squak header.b=oVlsDCeK; dmarc=pass (policy=none) header.from=riseup.net; spf=pass (mx1.freebsd.org: domain of agh@riseup.net designates 198.252.153.129 as permitted sender) smtp.mailfrom=agh@riseup.net X-Spamd-Result: default: False [-5.10 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[198.252.153.129:from]; R_SPF_ALLOW(-0.20)[+mx]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[riseup.net:+]; DMARC_POLICY_ALLOW(-0.50)[riseup.net,none]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_LOW(-0.10)[198.252.153.129:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[198.252.153.129:from]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:16652, ipnet:198.252.153.0/24, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[riseup.net:s=squak]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[198.252.153.129:from:127.0.2.255]; DWL_DNSWL_LOW(-1.00)[riseup.net:dkim]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FREEMAIL_CC(0.00)[bayofrum.net,freebsd.org,gmail.com]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 09:44:16 -0000 On 2021-03-08 15:16, Cy Schubert wrote: > In message <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net>, Chris Rees > writes: >> Forgot to CC the actual author! >> >> On 2021-02-23 17:03, Chris Rees wrote: >> > Hi, >> > >> > On 23 February 2021 10:27:34 GMT, Baptiste Daroussin >> > wrote: >> >> The branch main has been updated by bapt: >> >> >> >> URL: >> >> https://cgit.FreeBSD.org/src/commit/?id=77e1ccbee3ed6c837929e4e232fd07f95b >> fc8294 >> >> >> >> commit 77e1ccbee3ed6c837929e4e232fd07f95bfc8294 >> >> Author: Rick Parrish >> >> AuthorDate: 2021-02-07 06:15:21 +0000 >> >> Commit: Baptiste Daroussin >> >> CommitDate: 2021-02-23 10:16:53 +0000 >> >> >> >> rc: implement parallel boot >> >> >> >> take advantage of the rcorder -p argument to implement parallel >> >> booting in rc. >> >> >> >> According to the author non scientific tests: >> >> on a Core 2 Duo with spinning disk: >> >> >> >> | Services enabled | before | after | saving | >> >> | 0 | 8s | 8s | 0 | >> >> | 1 | 13s | 13s | 0 | >> >> | 2 | 17s | 13s | 5 | >> >> | 3 | 23s | 13s | 10 | >> >> | 4 | 28s | 13s | 15 | >> >> | 5 | 33s | 13s | 20 | >> >> >> >> PR: 249192 >> >> MFC after: 3 weeks >> >> --- >> >> libexec/rc/rc | 49 ++++++++++++++++++++++++++++++++++--------------- >> >> 1 file changed, 34 insertions(+), 15 deletions(-) >> >> >> >> diff --git a/libexec/rc/rc b/libexec/rc/rc >> >> index 35db4a850516..722d7fe35884 100644 >> >> --- a/libexec/rc/rc >> >> +++ b/libexec/rc/rc >> >> @@ -91,19 +91,31 @@ if ! [ -e ${firstboot_sentinel} ]; then >> >> skip_firstboot="-s firstboot" >> >> fi >> >> >> >> +# rc_parallel_start default is "NO" >> >> +rc_parallel_start=${rc_parallel_start:-NO} >> > >> > Should this go in defaults/rc.conf? >> >> I think this should be in defaults/rc.conf-- the load_rc_config line is >> above it. >> >> Incidentally, is the plan for this to go into 13 *and* 12, or just 13? >> It's an exciting step! > > If this does go into 13 or 12, it should be tested in -CURRENT for longer > than three weeks. Probably six weeks. mountd on my NAS fails to load because unbound (via ports) is not yet responding to any name queries: [...] Starting mountd. Mar 8 02:35:13 fafnir mountd[67654]: can't get address info for host direwolf.local. Mar 8 02:35:13 fafnir mountd[67654]: bad host direwolf.local., skipping Mar 8 02:35:13 fafnir mountd[67654]: can't get address info for host nova.local. Mar 8 02:35:13 fafnir mountd[67654]: bad host nova.local., skipping Mar 8 02:35:13 fafnir mountd[67654]: can't get address info for host deimos.local. Mar 8 02:35:13 fafnir mountd[67654]: bad host deimos.local., skipping Mar 8 02:35:13 fafnir mountd[67654]: can't get address info for host koto.local. Mar 8 02:35:13 fafnir mountd[67654]: bad host koto.local., skipping Mar 8 02:35:13 fafnir mountd[67654]: bad exports list line '/exports -maproot': no valid entries Mar 8 02:35:13 fafnir mountd[67654]: can't get address info for host direwolf.local. Mar 8 02:35:13 fafnir mountd[67654]: bad host direwolf.local., skipping Mar 8 02:35:13 fafnir mountd[67654]: can't get address info for host nova.local. Mar 8 02:35:13 fafnir mountd[67654]: bad host nova.local., skipping Mar 8 02:35:13 fafnir mountd[67654]: can't get address info for host deimos.local. Mar 8 02:35:13 fafnir mountd[67654]: bad host deimos.local., skipping Mar 8 02:35:13 fafnir mountd[67654]: can't get address info for host koto.local. Mar 8 02:35:13 fafnir mountd[67654]: bad host koto.local., skipping Mar 8 02:35:13 fafnir mountd[67654]: bad exports list line 'V4: /exports direwolf.local. nova.local. deimos.local. koto.local.': no valid entries Starting nfsd. Mounting late filesystems:. Starting cron. Configuring vt: blanktime. Performing sanity check on sshd configuration. Starting sshd. [...] From owner-dev-commits-src-all@freebsd.org Mon Mar 8 11:22:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D5D756ED5A; Mon, 8 Mar 2021 11:22: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 4DvGC64wwcz4VdC; Mon, 8 Mar 2021 11:22: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 0A695389; Mon, 8 Mar 2021 11:22: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 128BM8JG053515; Mon, 8 Mar 2021 11:22:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128BM8Vp053514; Mon, 8 Mar 2021 11:22:08 GMT (envelope-from git) Date: Mon, 8 Mar 2021 11:22:08 GMT Message-Id: <202103081122.128BM8Vp053514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: d90bba73a2e4 - stable/13 - tcp: remove incorrect reset of SACK variable in PRR 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d90bba73a2e43fa12ea19425d101df4c488c1070 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 11:22:12 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=d90bba73a2e43fa12ea19425d101df4c488c1070 commit d90bba73a2e43fa12ea19425d101df4c488c1070 Author: Richard Scheffenegger AuthorDate: 2021-03-05 16:45:23 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-08 10:43:49 +0000 tcp: remove incorrect reset of SACK variable in PRR Reviewed By: #transport, rrs, tuexen PR: 253848 MFC after: 3 days Sponsored By: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29083 (cherry picked from commit 4a8f3aad37dd35c905e34b64b022d60844ba8d01) --- sys/netinet/tcp_input.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 0cb99ce8f2c5..4773c8fb3dac 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2699,7 +2699,6 @@ enter_recovery: */ tp->sackhint.prr_delivered = tp->sackhint.sacked_bytes; - tp->sackhint.sack_bytes_rexmit = 0; tp->sackhint.recover_fs = max(1, tp->snd_nxt - tp->snd_una); } From owner-dev-commits-src-all@freebsd.org Mon Mar 8 11:23:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 251B156EDE2; Mon, 8 Mar 2021 11:23: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 4DvGDp6zltz4W78; Mon, 8 Mar 2021 11:23: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 DF34538E; Mon, 8 Mar 2021 11:23: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 128BNcCL056189; Mon, 8 Mar 2021 11:23:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128BNcDw056188; Mon, 8 Mar 2021 11:23:38 GMT (envelope-from git) Date: Mon, 8 Mar 2021 11:23:38 GMT Message-Id: <202103081123.128BNcDw056188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 7ab9fef1be9d - stable/13 - tcp: remove a superfluous local var in tcp_sack_partialack() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7ab9fef1be9d4124f0fa07468a4fbe4f3fe1895d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 11:23:39 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=7ab9fef1be9d4124f0fa07468a4fbe4f3fe1895d commit 7ab9fef1be9d4124f0fa07468a4fbe4f3fe1895d Author: Richard Scheffenegger AuthorDate: 2021-03-05 17:19:16 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-08 11:22:41 +0000 tcp: remove a superfluous local var in tcp_sack_partialack() No functional change. Reviewed By: #transport, tuexen MFC after: 3 days Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29088 (cherry picked from commit 9a13d9dceee27fc1bf6fb7e58e83c88707665859) --- sys/netinet/tcp_sack.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 28cd5c93f106..37db30007580 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -832,7 +832,6 @@ tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th) TAILQ_EMPTY(&tp->snd_holes) && (tp->sackhint.delivered_data > 0)) { struct sackhole *hole; - int maxseg = tcp_maxseg(tp); hole = tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack, tp->snd_max - maxseg), tp->snd_max, NULL); } (void) tp->t_fb->tfb_tcp_output(tp); From owner-dev-commits-src-all@freebsd.org Mon Mar 8 11:26:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B0CE56F343; Mon, 8 Mar 2021 11:26:41 +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 4DvGJK0n73z4WVw; Mon, 8 Mar 2021 11:26:41 +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 0D9F2390; Mon, 8 Mar 2021 11:26:41 +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 128BQepE056748; Mon, 8 Mar 2021 11:26:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128BQeqI056747; Mon, 8 Mar 2021 11:26:40 GMT (envelope-from git) Date: Mon, 8 Mar 2021 11:26:40 GMT Message-Id: <202103081126.128BQeqI056747@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 71cc98ba7352 - stable/13 - tcp: Add prr_out in preparation for PRR/nonSACK and LRD 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 71cc98ba735283b8720c9031eb87810f3d3d96a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 11:26:41 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=71cc98ba735283b8720c9031eb87810f3d3d96a0 commit 71cc98ba735283b8720c9031eb87810f3d3d96a0 Author: Richard Scheffenegger AuthorDate: 2021-03-05 23:36:48 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-08 11:23:58 +0000 tcp: Add prr_out in preparation for PRR/nonSACK and LRD Reviewed By: #transport, kbowling MFC after: 3 days Sponsored By: Netapp, Inc. Differential Revision: https://reviews.freebsd.org/D29058 (cherry picked from commit e53138694aa41c24c17847afe959225ce0eeff91) --- sys/netinet/tcp_input.c | 21 ++++++++------------- sys/netinet/tcp_output.c | 8 ++++++++ sys/netinet/tcp_var.h | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 4773c8fb3dac..e000c589c78e 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.prr_out = 0; } /* @@ -2601,17 +2602,14 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, imax(1, tp->snd_nxt - tp->snd_una); snd_cnt = howmany((long)tp->sackhint.prr_delivered * tp->snd_ssthresh, tp->sackhint.recover_fs) - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)); + tp->sackhint.prr_out; } else { if (V_tcp_do_prr_conservative) limit = tp->sackhint.prr_delivered - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)); + tp->sackhint.prr_out; else limit = imax(tp->sackhint.prr_delivered - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)), + tp->sackhint.prr_out, del_data) + maxseg; snd_cnt = imin(tp->snd_ssthresh - pipe, limit); } @@ -3978,18 +3976,15 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) imax(1, tp->snd_nxt - tp->snd_una); snd_cnt = howmany((long)tp->sackhint.prr_delivered * tp->snd_ssthresh, tp->sackhint.recover_fs) - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)); + tp->sackhint.prr_out; } else { if (V_tcp_do_prr_conservative) limit = tp->sackhint.prr_delivered - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)); + tp->sackhint.prr_out; else limit = imax(tp->sackhint.prr_delivered - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)), - del_data) + maxseg; + tp->sackhint.prr_out, del_data) + + maxseg; snd_cnt = imin((tp->snd_ssthresh - pipe), limit); } snd_cnt = imax(snd_cnt, 0) / maxseg; diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index b4c7ab0a1ab7..d4b5a328e2a6 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1236,6 +1236,14 @@ send: p->rxmit += len; tp->sackhint.sack_bytes_rexmit += len; } + if (IN_RECOVERY(tp->t_flags)) { + /* + * Account all bytes transmitted while + * IN_RECOVERY, simplifying PRR and + * Lost Retransmit Detection + */ + tp->sackhint.prr_out += len; + } th->th_ack = htonl(tp->rcv_nxt); if (optlen) { bcopy(opt, th + 1, optlen); diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 6e22d75ac441..3b007fcfcc93 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -115,7 +115,7 @@ struct sackhint { */ uint32_t recover_fs; /* Flight Size at the start of Loss recovery */ uint32_t prr_delivered; /* Total bytes delivered using PRR */ - uint32_t _pad[1]; /* TBD */ + uint32_t prr_out; /* Bytes sent during IN_RECOVERY */ }; #define SEGQ_EMPTY(tp) TAILQ_EMPTY(&(tp)->t_segq) From owner-dev-commits-src-all@freebsd.org Mon Mar 8 12:28:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 698C75718B7; Mon, 8 Mar 2021 12:28: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 4DvHg52Sc6z4Zyk; Mon, 8 Mar 2021 12:28: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 4318CAFB; Mon, 8 Mar 2021 12:28: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 128CS1w9036212; Mon, 8 Mar 2021 12:28:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128CS1gn036211; Mon, 8 Mar 2021 12:28:01 GMT (envelope-from git) Date: Mon, 8 Mar 2021 12:28:01 GMT Message-Id: <202103081228.128CS1gn036211@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 873f8376015c - stable/13 - rack: unbreak TCP fast open for the client side 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 873f8376015c12febec3619976a8c30fbead4ad6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 12:28:01 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=873f8376015c12febec3619976a8c30fbead4ad6 commit 873f8376015c12febec3619976a8c30fbead4ad6 Author: Michael Tuexen AuthorDate: 2021-03-05 14:57:26 +0000 Commit: Michael Tuexen CommitDate: 2021-03-08 12:27:30 +0000 rack: unbreak TCP fast open for the client side Allow sending user data on the SYN segment. Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D29082 Sponsored by: Netflix, Inc. (cherry picked from commit 705d06b289e9821439b7b694d766cad75bc064e5) --- sys/netinet/tcp_stacks/rack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 4d1a4cc8a0eb..104468bee53b 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12297,7 +12297,8 @@ again: * If sack_rxmit is true we are retransmitting from the scoreboard * in which case len is already set. */ - if ((sack_rxmit == 0) && TCPS_HAVEESTABLISHED(tp->t_state)) { + if ((sack_rxmit == 0) && + (TCPS_HAVEESTABLISHED(tp->t_state) || IS_FASTOPEN(tp->t_flags))) { uint32_t avail; avail = sbavail(sb); From owner-dev-commits-src-all@freebsd.org Mon Mar 8 12:55:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B51D571C67; Mon, 8 Mar 2021 12:55:00 +0000 (UTC) (envelope-from se@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 4DvJGD2rLdz4cKY; Mon, 8 Mar 2021 12:55:00 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-449.fritz.box (p200300cd5f26c900c5758f2b8c70eaef.dip0.t-ipconnect.de [IPv6:2003:cd:5f26:c900:c575:8f2b:8c70:eaef]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 6C047A75B; Mon, 8 Mar 2021 12:54:57 +0000 (UTC) (envelope-from se@freebsd.org) To: dev-commits-src-all@freebsd.org, src-committers@freebsd.org, dev-commits-src-main@freebsd.org Cc: Chris Rees , Baptiste Daroussin , Rick Parrish , Cy Schubert , Alastair Hogge References: <202102231027.11NARYYE041280@gitrepo.freebsd.org> <6D4FCE07-B996-430C-8EA8-6CB37A6DEEE8@bayofrum.net> <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> <202103080716.1287GQWB055131@slippy.cwsent.com> <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> From: Stefan Esser Subject: Re: git: 77e1ccbee3ed - main - rc: implement parallel boot Message-ID: <38e603a7-6c04-38f0-2ab8-84dc4303a4e6@freebsd.org> Date: Mon, 8 Mar 2021 13:54:53 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yUCpJEhUDPo8OlbsS3xTv1HUJiJy3RHm3" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 12:55:00 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --yUCpJEhUDPo8OlbsS3xTv1HUJiJy3RHm3 Content-Type: multipart/mixed; boundary="uL2uFaSH9IO96vdjjeafizosWGWwgD79v"; protected-headers="v1" From: Stefan Esser To: dev-commits-src-all@freebsd.org, src-committers@freebsd.org, dev-commits-src-main@freebsd.org Cc: Chris Rees , Baptiste Daroussin , Rick Parrish , Cy Schubert , Alastair Hogge Message-ID: <38e603a7-6c04-38f0-2ab8-84dc4303a4e6@freebsd.org> Subject: Re: git: 77e1ccbee3ed - main - rc: implement parallel boot References: <202102231027.11NARYYE041280@gitrepo.freebsd.org> <6D4FCE07-B996-430C-8EA8-6CB37A6DEEE8@bayofrum.net> <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> <202103080716.1287GQWB055131@slippy.cwsent.com> <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> In-Reply-To: <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> --uL2uFaSH9IO96vdjjeafizosWGWwgD79v Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Am 08.03.21 um 10:44 schrieb Alastair Hogge: > On 2021-03-08 15:16, Cy Schubert wrote: >> In message <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net>, Chris Rees= >> writes: >>> Incidentally, is the plan for this to go into 13 *and* 12, or just 13= ? >>> It's an exciting step! >> >> If this does go into 13 or 12, it should be tested in -CURRENT for lon= ger >> than three weeks. Probably six weeks. >=20 > mountd on my NAS fails to load because unbound (via ports) is not yet > responding to any name queries: SDDM fails to successfully start an X session now, too. It repeatedly tries to start the X server without success. Only a "service sddm restart" terminates this loop. I do assume that the same applies to quite a number of services that are installed form ports/packages. While we can test parallel execution of rc scripts in base, this is not easily possible for the large number of optional services provided by ports/packages. I'll try to find the cause of the start-up failure for the SDDM case on my system. But even if I get it fixed on my system, it may still fail to start the X server on systems with a different set of ports ... Regards, STefan --uL2uFaSH9IO96vdjjeafizosWGWwgD79v-- --yUCpJEhUDPo8OlbsS3xTv1HUJiJy3RHm3 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAmBGHp0FAwAAAAAACgkQR+u171r99UTo mwf+Jn2TptSh6pa4EBkJOvXBNFVPKhTnh/KnYLoM4da3fNigGrnvIPpGsCG+X9tzmCWXu2fPA/Sl uNx+/i9wabN0LiKmNTfz38vxfzssv1fQ8A0JYsV0K+9u13ia9n0TUw/U1eIKvb5vLCpnj9wLT6io DNTzzU9/Cd4c852tF/j9NsAA8RNLL11j4P/tl4lr5eZgkfheZ9EL+Xw378wA2IHE7aIPlVxn4qD1 hhpHHX+/cSoQ4rABduginQKhouzxJcfAk0Tb9nyrZIV9H8OEXaLowWKRmc8nnfaLl7n+NLoF/K/2 C/ep6PlddQ7G/8hveHCghr4jxY/U1pPvfNXigBHH1w== =yrwc -----END PGP SIGNATURE----- --yUCpJEhUDPo8OlbsS3xTv1HUJiJy3RHm3-- From owner-dev-commits-src-all@freebsd.org Mon Mar 8 13:21:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E17A25722F8; Mon, 8 Mar 2021 13:21: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 4DvJrl64PQz4dbZ; Mon, 8 Mar 2021 13:21: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 C392B18C1; Mon, 8 Mar 2021 13:21: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 128DLREe010728; Mon, 8 Mar 2021 13:21:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128DLRMe010727; Mon, 8 Mar 2021 13:21:27 GMT (envelope-from git) Date: Mon, 8 Mar 2021 13:21:27 GMT Message-Id: <202103081321.128DLRMe010727@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: fb6ac317c065 - releng/13.0 - rack: unbreak TCP fast open for the client side 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: fb6ac317c065a3d760927cbbc1f12e604b44391f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 13:21:27 -0000 The branch releng/13.0 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=fb6ac317c065a3d760927cbbc1f12e604b44391f commit fb6ac317c065a3d760927cbbc1f12e604b44391f Author: Michael Tuexen AuthorDate: 2021-03-05 14:57:26 +0000 Commit: Michael Tuexen CommitDate: 2021-03-08 12:46:26 +0000 rack: unbreak TCP fast open for the client side Allow sending user data on the SYN segment. Reviewed by: rrs Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D29082 Sponsored by: Netflix, Inc. (cherry picked from commit 705d06b289e9821439b7b694d766cad75bc064e5) (cherry picked from commit 873f8376015c12febec3619976a8c30fbead4ad6) --- sys/netinet/tcp_stacks/rack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 4d1a4cc8a0eb..104468bee53b 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -12297,7 +12297,8 @@ again: * If sack_rxmit is true we are retransmitting from the scoreboard * in which case len is already set. */ - if ((sack_rxmit == 0) && TCPS_HAVEESTABLISHED(tp->t_state)) { + if ((sack_rxmit == 0) && + (TCPS_HAVEESTABLISHED(tp->t_state) || IS_FASTOPEN(tp->t_flags))) { uint32_t avail; avail = sbavail(sb); From owner-dev-commits-src-all@freebsd.org Mon Mar 8 14:03:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8853A5737A4; Mon, 8 Mar 2021 14: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 4DvKnf3H1qz4gh5; Mon, 8 Mar 2021 14:03: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 6338E231C; Mon, 8 Mar 2021 14:03: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 128E3o5m067051; Mon, 8 Mar 2021 14:03:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128E3old067050; Mon, 8 Mar 2021 14:03:50 GMT (envelope-from git) Date: Mon, 8 Mar 2021 14:03:50 GMT Message-Id: <202103081403.128E3old067050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 35435ee5725a - stable/13 - arm64: fix hardware single-stepping from EL1 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 35435ee5725a8c0c67bdb4fd22d18154634dd081 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 14:03:50 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=35435ee5725a8c0c67bdb4fd22d18154634dd081 commit 35435ee5725a8c0c67bdb4fd22d18154634dd081 Author: Mitchell Horne AuthorDate: 2021-03-01 13:59:25 +0000 Commit: Mitchell Horne CommitDate: 2021-03-08 14:01:32 +0000 arm64: fix hardware single-stepping from EL1 The main issue is that debug exceptions must to be disabled for the entire duration that SS bit in MDSCR_EL1 is set. Otherwise, a single-step exception will be generated immediately. This can occur before returning from the debugger (when MDSCR is written to) or before re-entering it after the single-step (when debug exceptions are unmasked in the exception handler). Solve this by delaying the unmask to C code for EL1, and avoid unmasking at all while handling debug exceptions, thus avoiding any recursive debug traps. Reviewed by: markj, jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit 874635e381731e1fbd5e2d0459ca87814f1e455c) --- sys/arm64/arm64/debug_monitor.c | 6 ++++++ sys/arm64/arm64/exception.S | 6 +++++- sys/arm64/arm64/trap.c | 8 ++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/debug_monitor.c b/sys/arm64/arm64/debug_monitor.c index dcb3645cf5d4..d302c8c95b4f 100644 --- a/sys/arm64/arm64/debug_monitor.c +++ b/sys/arm64/arm64/debug_monitor.c @@ -186,6 +186,9 @@ void kdb_cpu_set_singlestep(void) { + KASSERT((READ_SPECIALREG(daif) & PSR_D) == PSR_D, + ("%s: debug exceptions are not masked", __func__)); + kdb_frame->tf_spsr |= DBG_SPSR_SS; WRITE_SPECIALREG(mdscr_el1, READ_SPECIALREG(mdscr_el1) | DBG_MDSCR_SS | DBG_MDSCR_KDE); @@ -205,6 +208,9 @@ void kdb_cpu_clear_singlestep(void) { + KASSERT((READ_SPECIALREG(daif) & PSR_D) == PSR_D, + ("%s: debug exceptions are not masked", __func__)); + WRITE_SPECIALREG(mdscr_el1, READ_SPECIALREG(mdscr_el1) & ~(DBG_MDSCR_SS | DBG_MDSCR_KDE)); diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S index bcb444ef2f55..2af32a185748 100644 --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -76,8 +76,12 @@ __FBSDID("$FreeBSD$"); ldr x0, [x18, #(PC_CURTHREAD)] bl dbg_monitor_enter -.endif msr daifclr, #8 /* Enable the debug exception */ +.endif + /* + * For EL1, debug exceptions are conditionally unmasked in + * do_el1h_sync(). + */ .endm .macro restore_registers el diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index cb3a05ad0163..d793e34a6894 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -377,6 +377,14 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) "do_el1_sync: curthread: %p, esr %lx, elr: %lx, frame: %p", td, esr, frame->tf_elr, frame); + /* + * Enable debug exceptions if we aren't already handling one. They will + * be masked again in the exception handler's epilogue. + */ + if (exception != EXCP_BRK && exception != EXCP_WATCHPT_EL1 && + exception != EXCP_SOFTSTP_EL1) + dbg_enable(); + switch (exception) { case EXCP_FP_SIMD: case EXCP_TRAP_FP: From owner-dev-commits-src-all@freebsd.org Mon Mar 8 14:03:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7227573568; Mon, 8 Mar 2021 14:03: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 4DvKng4Kj7z4gd8; Mon, 8 Mar 2021 14:03: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 877A72258; Mon, 8 Mar 2021 14:03: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 128E3p92067074; Mon, 8 Mar 2021 14:03:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128E3pYh067073; Mon, 8 Mar 2021 14:03:51 GMT (envelope-from git) Date: Mon, 8 Mar 2021 14:03:51 GMT Message-Id: <202103081403.128E3pYh067073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 46810641e879 - stable/13 - arm64: update kdb_thrctx->pcb_lr with BKPT_SKIP 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 46810641e879fb406354a7094a216e955c9ce117 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 14:03:51 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=46810641e879fb406354a7094a216e955c9ce117 commit 46810641e879fb406354a7094a216e955c9ce117 Author: Mitchell Horne AuthorDate: 2021-03-01 14:00:17 +0000 Commit: Mitchell Horne CommitDate: 2021-03-08 14:02:16 +0000 arm64: update kdb_thrctx->pcb_lr with BKPT_SKIP This value should be kept in sync with updates to kdb_frame->tf_elr, since it is queried by PC_REGS() in several places. Reviewed by: markj, jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit bd0b7cbf5ac1baff4211e09584e0b86d4d96228b) --- sys/arm64/include/db_machdep.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/arm64/include/db_machdep.h b/sys/arm64/include/db_machdep.h index f2fd2a57a9c3..61b58415e41c 100644 --- a/sys/arm64/include/db_machdep.h +++ b/sys/arm64/include/db_machdep.h @@ -49,8 +49,9 @@ typedef long db_expr_t; #define BKPT_SIZE (4) #define BKPT_SET(inst) (BKPT_INST) -#define BKPT_SKIP do { \ - kdb_frame->tf_elr += BKPT_SIZE; \ +#define BKPT_SKIP do { \ + kdb_frame->tf_elr += BKPT_SIZE; \ + kdb_thrctx->pcb_lr += BKPT_SIZE; \ } while (0) #define db_clear_single_step kdb_cpu_clear_singlestep From owner-dev-commits-src-all@freebsd.org Mon Mar 8 14:03:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D530D57356C; Mon, 8 Mar 2021 14:03: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 4DvKnh5f8Jz4h3V; Mon, 8 Mar 2021 14:03: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 AFFC7231D; Mon, 8 Mar 2021 14:03: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 128E3q7x067092; Mon, 8 Mar 2021 14:03:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128E3q47067091; Mon, 8 Mar 2021 14:03:52 GMT (envelope-from git) Date: Mon, 8 Mar 2021 14:03:52 GMT Message-Id: <202103081403.128E3q47067091@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 090db1352edb - stable/13 - arm64: add definition for IS_SSTEP_TRAP() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 090db1352edbb62cfe4b5e936ee7664756f1580a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 14:03:52 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=090db1352edbb62cfe4b5e936ee7664756f1580a commit 090db1352edbb62cfe4b5e936ee7664756f1580a Author: Mitchell Horne AuthorDate: 2021-03-01 14:01:25 +0000 Commit: Mitchell Horne CommitDate: 2021-03-08 14:02:42 +0000 arm64: add definition for IS_SSTEP_TRAP() arm64 has a distinct exception code for single-step, so we can use this to detect when an unexpected SS trap is encountered, or when an expected one is not. See db_stop_at_pc(). Reviewed by: markj, jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit e152c882738ffe26a2f52e420e2a92c014943207) --- sys/arm64/include/db_machdep.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm64/include/db_machdep.h b/sys/arm64/include/db_machdep.h index 61b58415e41c..105e8e507ce3 100644 --- a/sys/arm64/include/db_machdep.h +++ b/sys/arm64/include/db_machdep.h @@ -38,6 +38,7 @@ #include #define T_BREAKPOINT (EXCP_BRK) +#define T_SINGLESTEP (EXCP_SOFTSTP_EL1) #define T_WATCHPOINT (EXCP_WATCHPT_EL1) typedef vm_offset_t db_addr_t; @@ -58,6 +59,7 @@ typedef long db_expr_t; #define db_set_single_step kdb_cpu_set_singlestep #define IS_BREAKPOINT_TRAP(type, code) (type == T_BREAKPOINT) +#define IS_SSTEP_TRAP(type, code) (type == T_SINGLESTEP) #define IS_WATCHPOINT_TRAP(type, code) (type == T_WATCHPOINT) #define inst_trap_return(ins) (0) From owner-dev-commits-src-all@freebsd.org Mon Mar 8 14:03:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E356D5732DE; Mon, 8 Mar 2021 14:03: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 4DvKnk113kz4gxr; Mon, 8 Mar 2021 14:03: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 C96672386; Mon, 8 Mar 2021 14:03: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 128E3rQM067114; Mon, 8 Mar 2021 14:03:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128E3rm1067113; Mon, 8 Mar 2021 14:03:53 GMT (envelope-from git) Date: Mon, 8 Mar 2021 14:03:53 GMT Message-Id: <202103081403.128E3rm1067113@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: cc24f5bc6f6e - stable/13 - riscv: fix errors in some atomic type aliases 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/stable/13 X-Git-Reftype: branch X-Git-Commit: cc24f5bc6f6eb56a959bd23ebb051d3bf6ebf670 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 14:03:56 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=cc24f5bc6f6eb56a959bd23ebb051d3bf6ebf670 commit cc24f5bc6f6eb56a959bd23ebb051d3bf6ebf670 Author: Mitchell Horne AuthorDate: 2021-03-04 17:52:45 +0000 Commit: Mitchell Horne CommitDate: 2021-03-08 14:03:01 +0000 riscv: fix errors in some atomic type aliases This appears to be a copy-and-paste error that has simply been overlooked. The tree contains only two calls to any of the affected variants, but recent additions to the test suite started exercising the call to atomic_clear_rel_int() in ng_leave_write(), reliably causing panics. Apparently, the issue was inherited from the arm64 atomic header. That instance was addressed in c90baf6817a0, but the fix did not make its way to RISC-V. Note that the particular test case ng_macfilter_test:main still appears to fail on this platform, but this change reduces the panic to a timeout. PR: 253237 Reported by: Jenkins, arichardson Reviewed by: kp, arichardson (cherry picked from commit 0d3b3beeb253e09b2b6b3805065594aecc7e2c2f) --- sys/riscv/include/atomic.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/riscv/include/atomic.h b/sys/riscv/include/atomic.h index d08047593861..d743fce6f1ff 100644 --- a/sys/riscv/include/atomic.h +++ b/sys/riscv/include/atomic.h @@ -288,7 +288,7 @@ atomic_store_rel_32(volatile uint32_t *p, uint32_t val) #define atomic_subtract_acq_int atomic_subtract_acq_32 #define atomic_add_rel_int atomic_add_rel_32 -#define atomic_clear_rel_int atomic_add_rel_32 +#define atomic_clear_rel_int atomic_clear_rel_32 #define atomic_cmpset_rel_int atomic_cmpset_rel_32 #define atomic_fcmpset_rel_int atomic_fcmpset_rel_32 #define atomic_set_rel_int atomic_set_rel_32 @@ -490,7 +490,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) } #define atomic_add_acq_long atomic_add_acq_64 -#define atomic_clear_acq_long atomic_add_acq_64 +#define atomic_clear_acq_long atomic_clear_acq_64 #define atomic_cmpset_acq_long atomic_cmpset_acq_64 #define atomic_fcmpset_acq_long atomic_fcmpset_acq_64 #define atomic_load_acq_long atomic_load_acq_64 @@ -498,7 +498,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_subtract_acq_long atomic_subtract_acq_64 #define atomic_add_acq_ptr atomic_add_acq_64 -#define atomic_clear_acq_ptr atomic_add_acq_64 +#define atomic_clear_acq_ptr atomic_clear_acq_64 #define atomic_cmpset_acq_ptr atomic_cmpset_acq_64 #define atomic_fcmpset_acq_ptr atomic_fcmpset_acq_64 #define atomic_load_acq_ptr atomic_load_acq_64 From owner-dev-commits-src-all@freebsd.org Mon Mar 8 14:17:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 958465738D0; Mon, 8 Mar 2021 14:17: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 4DvL5w3shGz4j3V; Mon, 8 Mar 2021 14:17: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 779BD20E9; Mon, 8 Mar 2021 14:17: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 128EHuXj081265; Mon, 8 Mar 2021 14:17:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128EHu5u081264; Mon, 8 Mar 2021 14:17:56 GMT (envelope-from git) Date: Mon, 8 Mar 2021 14:17:56 GMT Message-Id: <202103081417.128EHu5u081264@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: bb60a68985c8 - releng/13.0 - tcp: remove incorrect reset of SACK variable in PRR tcp: Add prr_out in preparation for PRR/nonSACK and LRD 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: bb60a68985c8902f4061f1e3338a74e5f7d36a5d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 14:17:56 -0000 The branch releng/13.0 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=bb60a68985c8902f4061f1e3338a74e5f7d36a5d commit bb60a68985c8902f4061f1e3338a74e5f7d36a5d Author: Richard Scheffenegger AuthorDate: 2021-03-05 16:45:23 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-08 14:17:12 +0000 tcp: remove incorrect reset of SACK variable in PRR tcp: Add prr_out in preparation for PRR/nonSACK and LRD Reviewed by: #transport, rrs, tuexen, kbowling Approved by: #re (gjb) PR: 253848 MFC after: 3 days Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29083 Differential Revision: https://reviews.freebsd.org/D29058 (cherry picked from commit 4a8f3aad37dd35c905e34b64b022d60844ba8d01) (cherry picked from commit d90bba73a2e43fa12ea19425d101df4c488c1070) (cherry picked from commit e53138694aa41c24c17847afe959225ce0eeff91) (cherry picked from commit 71cc98ba735283b8720c9031eb87810f3d3d96a0) --- sys/netinet/tcp_input.c | 22 ++++++++-------------- sys/netinet/tcp_output.c | 8 ++++++++ sys/netinet/tcp_var.h | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index f2edbecbb079..3efc100bf897 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.prr_out = 0; } /* @@ -2598,17 +2599,14 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, imax(1, tp->snd_nxt - tp->snd_una); snd_cnt = howmany((long)tp->sackhint.prr_delivered * tp->snd_ssthresh, tp->sackhint.recover_fs) - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)); + tp->sackhint.prr_out; } else { if (V_tcp_do_prr_conservative) limit = tp->sackhint.prr_delivered - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)); + tp->sackhint.prr_out; else limit = imax(tp->sackhint.prr_delivered - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)), + tp->sackhint.prr_out, del_data) + maxseg; snd_cnt = imin(tp->snd_ssthresh - pipe, limit); } @@ -2682,7 +2680,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, */ tp->sackhint.prr_delivered = tp->sackhint.sacked_bytes; - tp->sackhint.sack_bytes_rexmit = 0; tp->sackhint.recover_fs = max(1, tp->snd_nxt - tp->snd_una); } @@ -3951,18 +3948,15 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) imax(1, tp->snd_nxt - tp->snd_una); snd_cnt = howmany((long)tp->sackhint.prr_delivered * tp->snd_ssthresh, tp->sackhint.recover_fs) - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)); + tp->sackhint.prr_out; } else { if (V_tcp_do_prr_conservative) limit = tp->sackhint.prr_delivered - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)); + tp->sackhint.prr_out; else limit = imax(tp->sackhint.prr_delivered - - (tp->sackhint.sack_bytes_rexmit + - (tp->snd_nxt - tp->snd_recover)), - del_data) + maxseg; + tp->sackhint.prr_out, del_data) + + maxseg; snd_cnt = imin((tp->snd_ssthresh - pipe), limit); } snd_cnt = imax(snd_cnt, 0) / maxseg; diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index b4c7ab0a1ab7..d4b5a328e2a6 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1236,6 +1236,14 @@ send: p->rxmit += len; tp->sackhint.sack_bytes_rexmit += len; } + if (IN_RECOVERY(tp->t_flags)) { + /* + * Account all bytes transmitted while + * IN_RECOVERY, simplifying PRR and + * Lost Retransmit Detection + */ + tp->sackhint.prr_out += len; + } th->th_ack = htonl(tp->rcv_nxt); if (optlen) { bcopy(opt, th + 1, optlen); diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 6e22d75ac441..3b007fcfcc93 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -115,7 +115,7 @@ struct sackhint { */ uint32_t recover_fs; /* Flight Size at the start of Loss recovery */ uint32_t prr_delivered; /* Total bytes delivered using PRR */ - uint32_t _pad[1]; /* TBD */ + uint32_t prr_out; /* Bytes sent during IN_RECOVERY */ }; #define SEGQ_EMPTY(tp) TAILQ_EMPTY(&(tp)->t_segq) From owner-dev-commits-src-all@freebsd.org Mon Mar 8 14:22:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81587573E1E; Mon, 8 Mar 2021 14:22:55 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DvLCg0Ft5z4jPc; Mon, 8 Mar 2021 14:22:54 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id JGmYlZYiVnRGtJGmalBX23; Mon, 08 Mar 2021 07:22:53 -0700 X-Authority-Analysis: v=2.4 cv=cagXElPM c=1 sm=1 tr=0 ts=6046333d a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=dESyimp9J3IA:10 a=6I5d2MoRAAAA:8 a=ZB5LerlCAAAA:8 a=pGLkceISAAAA:8 a=YxBL1-UpAAAA:8 a=bBqXziUQAAAA:8 a=VxmjJ2MpAAAA:8 a=EkcXrb_YAAAA:8 a=E-8GrYASrIsY-qedPWUA:9 a=CjuIK1q_8ugA:10 a=9Ce6f9bjfTkA:10 a=IjZwj45LgO3ly-622nXo:22 a=YKPTzOroS2oaEK2QgPcx:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=BjKv_IHbNJvPKzgot4uq:22 a=7gXAzLPJhVmCkEl4_tsf:22 a=LK5xJRSDVpKd5WXXoEvA:22 a=BPzZvq435JnGatEyYwdK:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 5DC572EC0; Mon, 8 Mar 2021 06:22:49 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 128EMmC9075829; Mon, 8 Mar 2021 06:22:48 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202103081422.128EMmC9075829@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Stefan Esser cc: dev-commits-src-all@freebsd.org, src-committers@freebsd.org, dev-commits-src-main@freebsd.org, Chris Rees , Baptiste Daroussin , Rick Parrish , Cy Schubert , Alastair Hogge Subject: Re: git: 77e1ccbee3ed - main - rc: implement parallel boot In-reply-to: <38e603a7-6c04-38f0-2ab8-84dc4303a4e6@freebsd.org> References: <202102231027.11NARYYE041280@gitrepo.freebsd.org> <6D4FCE07-B996-430C-8EA8-6CB37A6DEEE8@bayofrum.net> <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> <202103080716.1287GQWB055131@slippy.cwsent.com> <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> <38e603a7-6c04-38f0-2ab8-84dc4303a4e6@freebsd.org> Comments: In-reply-to Stefan Esser message dated "Mon, 08 Mar 2021 13:54:53 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 08 Mar 2021 06:22:48 -0800 X-CMAE-Envelope: MS4xfClp1nrbq1pVTiU/6+HfHRb9ePQr9e9FK2fKGyv7DVbiT7IdBYn4pjHdrWwDeXMfTNx8sZET7eiIG4Bgb8ak8qu5kzgqWA+0UtUCZZqCIoH9ph0zOkrX zp8pknPTqbvZIxqWs2KBHZtrbUPbx1TXzE0itV0eOa5WKJNSga9kT7gO7Jug9JxOvktXUDYhfK+0xbN3Yrt9Nzg5B79dsQtoBrsAKNiiHp2jHR7GACHQTHAs skBTxGQuoC641daVP9Jc6Ff6eHCyf7WaYXonqEjNkGiBkQ4bvZlF7Ac2jvIHh6tGbawfC35hcmHf7pP1HAcfCAUC9a0fXU6N3r5OAMjAZq0LdCgD4otEUHCj SvY0Rv2FxLFDFJGj3vfOcSmj1po+ZyuK1lxWyqgsaGwDvQ1xB9ziH2YhP2QwKlmJQf7bfD606iH8+G7IF5deD0Be7RMvag== X-Rspamd-Queue-Id: 4DvLCg0Ft5z4jPc 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 14:22:55 -0000 In message <38e603a7-6c04-38f0-2ab8-84dc4303a4e6@freebsd.org>, Stefan Esser wri tes: > This is an OpenPGP/MIME signed message (RFC 4880 and 3156) > --yUCpJEhUDPo8OlbsS3xTv1HUJiJy3RHm3 > Content-Type: multipart/mixed; boundary="uL2uFaSH9IO96vdjjeafizosWGWwgD79v"; > protected-headers="v1" > From: Stefan Esser > To: dev-commits-src-all@freebsd.org, src-committers@freebsd.org, > dev-commits-src-main@freebsd.org > Cc: Chris Rees , Baptiste Daroussin , > Rick Parrish , Cy Schubert > , Alastair Hogge > Message-ID: <38e603a7-6c04-38f0-2ab8-84dc4303a4e6@freebsd.org> > Subject: Re: git: 77e1ccbee3ed - main - rc: implement parallel boot > References: <202102231027.11NARYYE041280@gitrepo.freebsd.org> > <6D4FCE07-B996-430C-8EA8-6CB37A6DEEE8@bayofrum.net> > <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> > <202103080716.1287GQWB055131@slippy.cwsent.com> > <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> > In-Reply-To: <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> > > --uL2uFaSH9IO96vdjjeafizosWGWwgD79v > Content-Type: text/plain; charset=windows-1252; format=flowed > Content-Language: en-US > Content-Transfer-Encoding: quoted-printable > > Am 08.03.21 um 10:44 schrieb Alastair Hogge: > > On 2021-03-08 15:16, Cy Schubert wrote: > >> In message <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net>, Chris Rees= > > >> writes: > >>> Incidentally, is the plan for this to go into 13 *and* 12, or just 13= > ? > >>> It's an exciting step! > >> > >> If this does go into 13 or 12, it should be tested in -CURRENT for lon= > ger > >> than three weeks. Probably six weeks. > >=20 > > mountd on my NAS fails to load because unbound (via ports) is not yet > > responding to any name queries: > > SDDM fails to successfully start an X session now, too. > > It repeatedly tries to start the X server without success. > Only a "service sddm restart" terminates this loop. > > I do assume that the same applies to quite a number of services > that are installed form ports/packages. > > While we can test parallel execution of rc scripts in base, this > is not easily possible for the large number of optional services > provided by ports/packages. > > I'll try to find the cause of the start-up failure for the SDDM > case on my system. But even if I get it fixed on my system, it > may still fail to start the X server on systems with a different > set of ports ... > > Regards, STefan Is this new breakage after 763db589328 or before the fixes to this? -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:05:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 297C9577CA1; Mon, 8 Mar 2021 17:05:58 +0000 (UTC) (envelope-from se@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 4DvPqp0QMNz4shN; Mon, 8 Mar 2021 17:05:58 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-449.fritz.box (p200300cd5f26c900c5758f2b8c70eaef.dip0.t-ipconnect.de [IPv6:2003:cd:5f26:c900:c575:8f2b:8c70:eaef]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 1B6B6C871; Mon, 8 Mar 2021 17:05:54 +0000 (UTC) (envelope-from se@freebsd.org) To: Cy Schubert Cc: dev-commits-src-all@freebsd.org, src-committers@freebsd.org, dev-commits-src-main@freebsd.org, Chris Rees , Baptiste Daroussin , Rick Parrish , Alastair Hogge References: <202102231027.11NARYYE041280@gitrepo.freebsd.org> <6D4FCE07-B996-430C-8EA8-6CB37A6DEEE8@bayofrum.net> <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> <202103080716.1287GQWB055131@slippy.cwsent.com> <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> <38e603a7-6c04-38f0-2ab8-84dc4303a4e6@freebsd.org> <202103081422.128EMmC9075829@slippy.cwsent.com> From: Stefan Esser Subject: Re: git: 77e1ccbee3ed - main - rc: implement parallel boot Message-ID: <4a4e021c-c874-5511-0e5a-4364df98e2c4@freebsd.org> Date: Mon, 8 Mar 2021 18:05:50 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <202103081422.128EMmC9075829@slippy.cwsent.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NK2NXzwQu7dx8KsgmaoRg3Dm6O6zdPwBc" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:05:58 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --NK2NXzwQu7dx8KsgmaoRg3Dm6O6zdPwBc Content-Type: multipart/mixed; boundary="IvLrYgq138dlzrHKca2qNTCpIvtGaetXM"; protected-headers="v1" From: Stefan Esser To: Cy Schubert Cc: dev-commits-src-all@freebsd.org, src-committers@freebsd.org, dev-commits-src-main@freebsd.org, Chris Rees , Baptiste Daroussin , Rick Parrish , Alastair Hogge Message-ID: <4a4e021c-c874-5511-0e5a-4364df98e2c4@freebsd.org> Subject: Re: git: 77e1ccbee3ed - main - rc: implement parallel boot References: <202102231027.11NARYYE041280@gitrepo.freebsd.org> <6D4FCE07-B996-430C-8EA8-6CB37A6DEEE8@bayofrum.net> <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> <202103080716.1287GQWB055131@slippy.cwsent.com> <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> <38e603a7-6c04-38f0-2ab8-84dc4303a4e6@freebsd.org> <202103081422.128EMmC9075829@slippy.cwsent.com> In-Reply-To: <202103081422.128EMmC9075829@slippy.cwsent.com> --IvLrYgq138dlzrHKca2qNTCpIvtGaetXM Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Am 08.03.21 um 15:22 schrieb Cy Schubert: >> SDDM fails to successfully start an X session now, too. >> >> It repeatedly tries to start the X server without success. >> Only a "service sddm restart" terminates this loop. >> >> I do assume that the same applies to quite a number of services >> that are installed form ports/packages. >> >> While we can test parallel execution of rc scripts in base, this >> is not easily possible for the large number of optional services >> provided by ports/packages. >> >> I'll try to find the cause of the start-up failure for the SDDM >> case on my system. But even if I get it fixed on my system, it >> may still fail to start the X server on systems with a different >> set of ports ... >> >> Regards, STefan >=20 > Is this new breakage after 763db589328 or before the fixes to this? This issue exists since the initial commit that enabled parallel start=20 of rc scripts. I do not see why the X server does not start, since the commands that are started in parallel appear to be completely unrelated and I do assume that scripts are only started from the next line after the previous ones are running (but maybe not yet completely functional). SDDM is in the 2nd-last line of rcorder -p output on my system: /etc/rc.d/sendmail /usr/local/etc/rc.d/apache24 /usr/local/etc/rc.d/postfix /etc/rc.d/othermta /etc/rc.d/bgfsck /usr/local/etc/rc.d/postgresql /etc/rc.d/securelevel /usr/local/etc/rc.d/sddm (All the above listed rc files are on a single line, actually.) BTW: I was surprised to see the following line 139 in /etc/rc: files=3D`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc}=20 ${_rc_parallel} 2>/dev/null` Since ${_rc_parallel} is at the end of the command line, it does not have any impact on the output that is generated ... This seems to indicate that scripts from /usr/local/etc/rc.d are not executed in parallel, which makes the SDDM failure even more surprising. Regards, STefan --IvLrYgq138dlzrHKca2qNTCpIvtGaetXM-- --NK2NXzwQu7dx8KsgmaoRg3Dm6O6zdPwBc Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAmBGWW8FAwAAAAAACgkQR+u171r99UQ/ gwgAzGhRwN1MuMAFPr9zwSW8mWHNBd5EEzwBr86SrVEHpGkiMhSBVTupwwswXEbmVTSDIcKWNaN+ /5Pf/FVaJT1tHGYbbXHI6dxHQp87CKkVzJRcs66rQD4RNyB19nO2atTjiIDFVzAp6nzjybNRpgiD fqeesP/1SU1I3MIac48UtAraoVBh2jO8syOSW92lyRathfU6zHClENbochvoEy3nuHYTBkCpLCrz uH2g27Lx43dxOV+AlxYMVFkBxbbQq1iJLACuF3MiQyCv5wccLPuFklXiB6BXlxBv9pLSNjyzLhtf A8WB7BgwwszF4wHqabiXKovs4e5jEd7TPsYMhXXgsA== =M1qa -----END PGP SIGNATURE----- --NK2NXzwQu7dx8KsgmaoRg3Dm6O6zdPwBc-- From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:47:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53029550D0E; Mon, 8 Mar 2021 17:47:51 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DvQm65v27z4vpq; Mon, 8 Mar 2021 17:47:50 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id JJyslxS0PeHr9JJytlrUFs; Mon, 08 Mar 2021 10:47:48 -0700 X-Authority-Analysis: v=2.4 cv=Yq/K+6UX c=1 sm=1 tr=0 ts=60466344 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=dESyimp9J3IA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=ZB5LerlCAAAA:8 a=pGLkceISAAAA:8 a=bBqXziUQAAAA:8 a=VxmjJ2MpAAAA:8 a=EkcXrb_YAAAA:8 a=kA6XjwGokMnRZUBWtCkA:9 a=CjuIK1q_8ugA:10 a=3x16XyzRRVwA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=YKPTzOroS2oaEK2QgPcx:22 a=BjKv_IHbNJvPKzgot4uq:22 a=7gXAzLPJhVmCkEl4_tsf:22 a=LK5xJRSDVpKd5WXXoEvA:22 a=BPzZvq435JnGatEyYwdK:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id F07592FCF; Mon, 8 Mar 2021 09:47:44 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 128HliPA008952; Mon, 8 Mar 2021 09:47:44 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202103081747.128HliPA008952@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Stefan Esser cc: Cy Schubert , dev-commits-src-all@freebsd.org, src-committers@freebsd.org, dev-commits-src-main@freebsd.org, Chris Rees , Baptiste Daroussin , Rick Parrish , Alastair Hogge Subject: Re: git: 77e1ccbee3ed - main - rc: implement parallel boot In-reply-to: <4a4e021c-c874-5511-0e5a-4364df98e2c4@freebsd.org> References: <202102231027.11NARYYE041280@gitrepo.freebsd.org> <6D4FCE07-B996-430C-8EA8-6CB37A6DEEE8@bayofrum.net> <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> <202103080716.1287GQWB055131@slippy.cwsent.com> <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> <38e603a7-6c04-38f0-2ab8-84dc4303a4e6@freebsd.org> <202103081422.128EMmC9075829@slippy.cwsent.com> <4a4e021c-c874-5511-0e5a-4364df98e2c4@freebsd.org> Comments: In-reply-to Stefan Esser message dated "Mon, 08 Mar 2021 18:05:50 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 08 Mar 2021 09:47:44 -0800 X-CMAE-Envelope: MS4xfCHZ4J45VMNhdL8ZSCdaafCRuI8avLJKHlfxnSl5lf+I+nIBelqeVve9nL/zoPCaRhYwYHgcpan/V3fgmZ2+1z7Qf8EfJHNvMylhJwlQWJ1PNgOVDCEH 5HN6YXBv69lvrprEXDVKUikGiK99fYkosAdlcSci2d2i3r4WiAjIZFq3m++Zor8b5oXs3RyAWvCnzThuWd5p6fDsFPPoS6ZiFbMreOawyzprCNdiNEqmheln Zgo4XG57Mpb5VvA70DZK05W/mN24ReGiXFSQkRJMkRK5BH1bZBNgNYT5rJERPTE2pv7Yv0Gqbiu0GTVlTB8il0GhTw3dnXws0tLB7bjGAB9KvtpYmH+lcOZ6 /r02+rdTzhlWvko5NVvQJ7oIvJFd5/CioCGAQSRVkJL+wzqdmRyg8hnFzTs2DMDacE8UnIawylsyuBJQa4Ts3HILzHEsOg== X-Rspamd-Queue-Id: 4DvQm65v27z4vpq 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:47:51 -0000 In message <4a4e021c-c874-5511-0e5a-4364df98e2c4@freebsd.org>, Stefan Esser wri tes: > This is an OpenPGP/MIME signed message (RFC 4880 and 3156) > --NK2NXzwQu7dx8KsgmaoRg3Dm6O6zdPwBc > Content-Type: multipart/mixed; boundary="IvLrYgq138dlzrHKca2qNTCpIvtGaetXM"; > protected-headers="v1" > From: Stefan Esser > To: Cy Schubert > Cc: dev-commits-src-all@freebsd.org, src-committers@freebsd.org, > dev-commits-src-main@freebsd.org, Chris Rees , > Baptiste Daroussin , Rick Parrish , > Alastair Hogge > Message-ID: <4a4e021c-c874-5511-0e5a-4364df98e2c4@freebsd.org> > Subject: Re: git: 77e1ccbee3ed - main - rc: implement parallel boot > References: <202102231027.11NARYYE041280@gitrepo.freebsd.org> > <6D4FCE07-B996-430C-8EA8-6CB37A6DEEE8@bayofrum.net> > <74fde23ead6719ac4e56dacb51bca6ed@bayofrum.net> > <202103080716.1287GQWB055131@slippy.cwsent.com> > <2ed29c1254d48c3724b944ba4a7d6f3c@riseup.net> > <38e603a7-6c04-38f0-2ab8-84dc4303a4e6@freebsd.org> > <202103081422.128EMmC9075829@slippy.cwsent.com> > In-Reply-To: <202103081422.128EMmC9075829@slippy.cwsent.com> > > --IvLrYgq138dlzrHKca2qNTCpIvtGaetXM > Content-Type: text/plain; charset=windows-1252; format=flowed > Content-Language: en-US > Content-Transfer-Encoding: quoted-printable > > Am 08.03.21 um 15:22 schrieb Cy Schubert: > >> SDDM fails to successfully start an X session now, too. > >> > >> It repeatedly tries to start the X server without success. > >> Only a "service sddm restart" terminates this loop. > >> > >> I do assume that the same applies to quite a number of services > >> that are installed form ports/packages. > >> > >> While we can test parallel execution of rc scripts in base, this > >> is not easily possible for the large number of optional services > >> provided by ports/packages. > >> > >> I'll try to find the cause of the start-up failure for the SDDM > >> case on my system. But even if I get it fixed on my system, it > >> may still fail to start the X server on systems with a different > >> set of ports ... > >> > >> Regards, STefan > >=20 > > Is this new breakage after 763db589328 or before the fixes to this? > > This issue exists since the initial commit that enabled parallel start=20 > of rc scripts. I do not see why the X server does not start, since the > commands that are started in parallel appear to be completely unrelated > and I do assume that scripts are only started from the next line after > the previous ones are running (but maybe not yet completely functional). Yes, the original commit broke rc due to some incorrect assumptions by the author -- it messed up non-parallel boot here. I don't use parallel rc here. I think bapt@ does. > > SDDM is in the 2nd-last line of rcorder -p output on my system: > > /etc/rc.d/sendmail > /usr/local/etc/rc.d/apache24 > /usr/local/etc/rc.d/postfix > /etc/rc.d/othermta > /etc/rc.d/bgfsck > /usr/local/etc/rc.d/postgresql > /etc/rc.d/securelevel > /usr/local/etc/rc.d/sddm > > (All the above listed rc files are on a single line, actually.) When I started looking at it, it uses spaces to separate related scripts to be started serially and line feeds for parallel threads. > > > BTW: I was surprised to see the following line 139 in /etc/rc: > > files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} > ${_rc_parallel} 2>/dev/null` > > > Since ${_rc_parallel} is at the end of the command line, it does not > have any impact on the output that is generated ... > > This seems to indicate that scripts from /usr/local/etc/rc.d are not > executed in parallel, which makes the SDDM failure even more > surprising. I'll leave this to bapt@ and the author to answer. I suspect that this too wasn't tested, hence the suggestion that this not be MFCed for six weeks, or maybe never. The original commit seriously broke my infrastructure here. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:55:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0106550AE3; Mon, 8 Mar 2021 17:55: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 4DvQwN4cfFz3C5M; Mon, 8 Mar 2021 17:55: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 91569524B; Mon, 8 Mar 2021 17:55: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 128Ht0wh069328; Mon, 8 Mar 2021 17:55:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Ht03c069327; Mon, 8 Mar 2021 17:55:00 GMT (envelope-from git) Date: Mon, 8 Mar 2021 17:55:00 GMT Message-Id: <202103081755.128Ht03c069327@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: af06ff55535d - main - dumpon.8: Ask DDB to call doadump() rather than calling it directly 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: af06ff55535d9b2de253103e974558104e0a3d97 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:55:00 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=af06ff55535d9b2de253103e974558104e0a3d97 commit af06ff55535d9b2de253103e974558104e0a3d97 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:05 +0000 Commit: Mark Johnston CommitDate: 2021-03-08 17:39:05 +0000 dumpon.8: Ask DDB to call doadump() rather than calling it directly Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sbin/dumpon/dumpon.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/dumpon/dumpon.8 b/sbin/dumpon/dumpon.8 index acdc554ae546..de9bd648e68b 100644 --- a/sbin/dumpon/dumpon.8 +++ b/sbin/dumpon/dumpon.8 @@ -275,7 +275,7 @@ debugger: In the debugger the following commands should be typed to write a core dump and reboot: .Pp -.Dl db> call doadump(0) +.Dl db> dump .Dl db> reset .Pp After reboot From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:55:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D87A2550E21; Mon, 8 Mar 2021 17:55: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 4DvQwP5rhxz3C7t; Mon, 8 Mar 2021 17:55: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 BAE1752E8; Mon, 8 Mar 2021 17:55: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 128Ht1HG069348; Mon, 8 Mar 2021 17:55:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Ht1Ke069347; Mon, 8 Mar 2021 17:55:01 GMT (envelope-from git) Date: Mon, 8 Mar 2021 17:55:01 GMT Message-Id: <202103081755.128Ht1Ke069347@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: a11009dccb6a - main - wg: Avoid leaking mbufs when the input handshake queue is full 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: a11009dccb6a2e75de2b8f1b45a0896eda2e6d85 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:55:01 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a11009dccb6a2e75de2b8f1b45a0896eda2e6d85 commit a11009dccb6a2e75de2b8f1b45a0896eda2e6d85 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:05 +0000 Commit: Mark Johnston CommitDate: 2021-03-08 17:39:05 +0000 wg: Avoid leaking mbufs when the input handshake queue is full Reviewed by: grehan Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29011 --- sys/dev/if_wg/module/if_wg_session.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index cb2a88812855..c31a06992fe9 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -1913,6 +1913,7 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, */ if ((m = m_pullup(m0, m0->m_pkthdr.len)) == NULL) { DPRINTF(sc, "DEFRAG fail\n"); + m_freem(m0); return; } data = mtod(m, void *); @@ -1943,8 +1944,10 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, verify_endpoint(m); if (mbufq_enqueue(&sc->sc_handshake_queue, m) == 0) { GROUPTASK_ENQUEUE(&sc->sc_handshake); - } else + } else { DPRINTF(sc, "Dropping handshake packet\n"); + wg_m_freem(m); + } } else if (pktlen >= sizeof(struct wg_pkt_data) + NOISE_MAC_SIZE && pkttype == MESSAGE_DATA) { From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:55:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11F38550E22; Mon, 8 Mar 2021 17:55: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 4DvQwR1Y3qz3CL8; Mon, 8 Mar 2021 17:55: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 DD6C6564F; Mon, 8 Mar 2021 17:55: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 128Ht2lg069369; Mon, 8 Mar 2021 17:55:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Ht280069368; Mon, 8 Mar 2021 17:55:02 GMT (envelope-from git) Date: Mon, 8 Mar 2021 17:55:02 GMT Message-Id: <202103081755.128Ht280069368@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: d8cebef50e7b - main - wg: 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: d8cebef50e7b5fac1e28bcb1f931962210f9b5f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:55:04 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d8cebef50e7b5fac1e28bcb1f931962210f9b5f6 commit d8cebef50e7b5fac1e28bcb1f931962210f9b5f6 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:05 +0000 Commit: Mark Johnston CommitDate: 2021-03-08 17:39:05 +0000 wg: Style MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/dev/if_wg/module/if_wg_session.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index c31a06992fe9..75baae063428 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -254,15 +254,13 @@ wg_socket_reuse(struct wg_softc *sc, struct socket *so) error = sosetopt(so, &sopt); if (error) { ifp = iflib_get_ifp(sc->wg_ctx); - if_printf(ifp, - "cannot set REUSEPORT socket opt: %d\n", error); + if_printf(ifp, "cannot set REUSEPORT socket opt: %d\n", error); } sopt.sopt_name = SO_REUSEADDR; error = sosetopt(so, &sopt); if (error) { ifp = iflib_get_ifp(sc->wg_ctx); - if_printf(ifp, - "cannot set REUSEADDDR socket opt: %d\n", error); + if_printf(ifp, "cannot set REUSEADDDR socket opt: %d\n", error); } return (error); } From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:55:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CCBC550E27; Mon, 8 Mar 2021 17:55: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 4DvQwT4ffGz3C5j; Mon, 8 Mar 2021 17:55: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 192945791; Mon, 8 Mar 2021 17:55: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 128Ht3qZ069391; Mon, 8 Mar 2021 17:55:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Ht3RE069390; Mon, 8 Mar 2021 17:55:03 GMT (envelope-from git) Date: Mon, 8 Mar 2021 17:55:03 GMT Message-Id: <202103081755.128Ht3RE069390@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: 8ff2b41c05a8 - main - posix timers: Declare unexported functions as static 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: 8ff2b41c05a8f98e30250b929e9722f714f1f319 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:55:07 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8ff2b41c05a8f98e30250b929e9722f714f1f319 commit 8ff2b41c05a8f98e30250b929e9722f714f1f319 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-08 17:39:06 +0000 posix timers: Declare unexported functions as static MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/kern/kern_time.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 6222bdc39bee..1d5bd2343153 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -107,8 +107,8 @@ static void realtimer_clocktime(clockid_t, struct timespec *); static void realtimer_expire(void *); static int register_posix_clock(int, const struct kclock *); -void itimer_fire(struct itimer *it); -int itimespecfix(struct timespec *ts); +static void itimer_fire(struct itimer *it); +static int itimespecfix(struct timespec *ts); #define CLOCK_CALL(clock, call, arglist) \ ((*posix_clocks[clock].call) arglist) @@ -1592,7 +1592,7 @@ itimer_accept(struct proc *p, int timerid, ksiginfo_t *ksi) return (EINVAL); } -int +static int itimespecfix(struct timespec *ts) { @@ -1653,7 +1653,7 @@ realtimer_expire(void *arg) } } -void +static void itimer_fire(struct itimer *it) { struct proc *p = it->it_proc; From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:55:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C13EE550EC2; Mon, 8 Mar 2021 17:55: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 4DvQwX3P75z3CRs; Mon, 8 Mar 2021 17:55: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 325C95653; Mon, 8 Mar 2021 17:55: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 128Ht5hd069409; Mon, 8 Mar 2021 17:55:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Ht5DE069408; Mon, 8 Mar 2021 17:55:05 GMT (envelope-from git) Date: Mon, 8 Mar 2021 17:55:05 GMT Message-Id: <202103081755.128Ht5DE069408@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: 60d12ef952a3 - main - posix timers: Sprinkle some style fixes 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: 60d12ef952a39581e967a1a608522fdbdedefa01 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:55:09 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=60d12ef952a39581e967a1a608522fdbdedefa01 commit 60d12ef952a39581e967a1a608522fdbdedefa01 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-08 17:39:06 +0000 posix timers: Sprinkle some style fixes MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/kern/kern_time.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 1d5bd2343153..3e85f8e1d6ec 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1518,8 +1518,8 @@ realtimer_gettime(struct itimer *it, struct itimerspec *ovalue) } static int -realtimer_settime(struct itimer *it, int flags, - struct itimerspec *value, struct itimerspec *ovalue) +realtimer_settime(struct itimer *it, int flags, struct itimerspec *value, + struct itimerspec *ovalue) { struct timespec cts, ts; struct timeval tv; @@ -1548,7 +1548,7 @@ realtimer_settime(struct itimer *it, int flags, if ((flags & TIMER_ABSTIME) == 0) { /* Convert to absolute time. */ timespecadd(&it->it_time.it_value, &cts, - &it->it_time.it_value); + &it->it_time.it_value); } else { timespecsub(&ts, &cts, &ts); /* @@ -1557,8 +1557,8 @@ realtimer_settime(struct itimer *it, int flags, */ } TIMESPEC_TO_TIMEVAL(&tv, &ts); - callout_reset(&it->it_callout, tvtohz(&tv), - realtimer_expire, it); + callout_reset(&it->it_callout, tvtohz(&tv), realtimer_expire, + it); } else { callout_stop(&it->it_callout); } @@ -1618,16 +1618,16 @@ realtimer_expire(void *arg) if (timespeccmp(&cts, &it->it_time.it_value, >=)) { if (timespecisset(&it->it_time.it_interval)) { timespecadd(&it->it_time.it_value, - &it->it_time.it_interval, - &it->it_time.it_value); + &it->it_time.it_interval, + &it->it_time.it_value); while (timespeccmp(&cts, &it->it_time.it_value, >=)) { if (it->it_overrun < INT_MAX) it->it_overrun++; else it->it_ksi.ksi_errno = ERANGE; timespecadd(&it->it_time.it_value, - &it->it_time.it_interval, - &it->it_time.it_value); + &it->it_time.it_interval, + &it->it_time.it_value); } } else { /* single shot timer ? */ @@ -1637,7 +1637,7 @@ realtimer_expire(void *arg) timespecsub(&it->it_time.it_value, &cts, &ts); TIMESPEC_TO_TIMEVAL(&tv, &ts); callout_reset(&it->it_callout, tvtohz(&tv), - realtimer_expire, it); + realtimer_expire, it); } itimer_enter(it); ITIMER_UNLOCK(it); @@ -1649,7 +1649,7 @@ realtimer_expire(void *arg) timespecsub(&ts, &cts, &ts); TIMESPEC_TO_TIMEVAL(&tv, &ts); callout_reset(&it->it_callout, tvtohz(&tv), realtimer_expire, - it); + it); } } From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:55:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65BCE550D57; Mon, 8 Mar 2021 17:55: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 4DvQwX5fqtz3CRv; Mon, 8 Mar 2021 17:55: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 59D5F56D9; Mon, 8 Mar 2021 17:55: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 128Ht6we069431; Mon, 8 Mar 2021 17:55:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Ht6UV069430; Mon, 8 Mar 2021 17:55:06 GMT (envelope-from git) Date: Mon, 8 Mar 2021 17:55:06 GMT Message-Id: <202103081755.128Ht6UV069430@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: 7995dae9d3f5 - main - posix timers: Improve the overrun calculation 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: 7995dae9d3f58abf38ef0001cee24131f3c9054b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:55:09 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7995dae9d3f58abf38ef0001cee24131f3c9054b commit 7995dae9d3f58abf38ef0001cee24131f3c9054b Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-08 17:39:06 +0000 posix timers: Improve the overrun calculation timer_settime(2) may be used to configure a timeout in the past. If the timer is also periodic, we also try to compute the number of timer overruns that occurred between the initial timeout and the time at which the timer fired. This is done in a loop which iterates once per period between the initial timeout and now. If the period is small and the initial timeout was a long time ago, this loop can take forever to run, so the system is effectively DOSed. Replace the loop with a more direct calculation of (now - initial timeout) / period to compute the number of overruns. Reported by: syzkaller Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29093 --- sys/kern/kern_time.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 3e85f8e1d6ec..44f6b4ad07f2 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1603,6 +1603,13 @@ itimespecfix(struct timespec *ts) return (0); } +#define timespectons(tsp) \ + ((uint64_t)(tsp)->tv_sec * 1000000000 + (tsp)->tv_nsec) +#define timespecfromns(ns) (struct timespec){ \ + .tv_sec = (ns) / 1000000000, \ + .tv_nsec = (ns) % 1000000000 \ +} + /* Timeout callback for realtime timer */ static void realtimer_expire(void *arg) @@ -1610,6 +1617,7 @@ realtimer_expire(void *arg) struct timespec cts, ts; struct timeval tv; struct itimer *it; + uint64_t interval, now, overruns, value; it = (struct itimer *)arg; @@ -1620,14 +1628,27 @@ realtimer_expire(void *arg) timespecadd(&it->it_time.it_value, &it->it_time.it_interval, &it->it_time.it_value); - while (timespeccmp(&cts, &it->it_time.it_value, >=)) { - if (it->it_overrun < INT_MAX) - it->it_overrun++; - else + + interval = timespectons(&it->it_time.it_interval); + value = timespectons(&it->it_time.it_value); + now = timespectons(&cts); + + if (now >= value) { + /* + * We missed at least one period. + */ + overruns = howmany(now - value + 1, interval); + if (it->it_overrun + overruns >= + it->it_overrun && + it->it_overrun + overruns <= INT_MAX) { + it->it_overrun += (int)overruns; + } else { + it->it_overrun = INT_MAX; it->it_ksi.ksi_errno = ERANGE; - timespecadd(&it->it_time.it_value, - &it->it_time.it_interval, - &it->it_time.it_value); + } + value = + now + interval - (now - value) % interval; + it->it_time.it_value = timespecfromns(value); } } else { /* single shot timer ? */ From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:55:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E611550ECA; Mon, 8 Mar 2021 17:55: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 4DvQwb3n6Yz3CNC; Mon, 8 Mar 2021 17:55: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 92EE4524D; Mon, 8 Mar 2021 17:55: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 128Ht8HO069473; Mon, 8 Mar 2021 17:55:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Ht8Yx069472; Mon, 8 Mar 2021 17:55:08 GMT (envelope-from git) Date: Mon, 8 Mar 2021 17:55:08 GMT Message-Id: <202103081755.128Ht8Yx069472@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: 435c7cfb2418 - main - Rename _cscan_atomic.h and _cscan_bus.h to atomic_san.h and bus_san.h 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: 435c7cfb2418fdac48fa53e29e38ef03646b817d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:55:16 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=435c7cfb2418fdac48fa53e29e38ef03646b817d commit 435c7cfb2418fdac48fa53e29e38ef03646b817d Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-08 17:39:06 +0000 Rename _cscan_atomic.h and _cscan_bus.h to atomic_san.h and bus_san.h Other kernel sanitizers (KMSAN, KASAN) require interceptors as well, so put these in a more generic place as a step towards importing the other sanitizers. No functional change intended. MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29103 --- sys/amd64/include/atomic.h | 2 +- sys/arm64/include/atomic.h | 2 +- sys/arm64/include/bus.h | 2 +- sys/kern/subr_csan.c | 4 ++-- sys/sys/{_cscan_atomic.h => atomic_san.h} | 6 +++--- sys/sys/{_cscan_bus.h => bus_san.h} | 6 +++--- sys/x86/include/bus.h | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h index 87f7b8e8293e..61cb79645c10 100644 --- a/sys/amd64/include/atomic.h +++ b/sys/amd64/include/atomic.h @@ -69,7 +69,7 @@ #endif #if defined(KCSAN) && !defined(KCSAN_RUNTIME) -#include +#include #else #include diff --git a/sys/arm64/include/atomic.h b/sys/arm64/include/atomic.h index 9c5d6224f3e2..6c63357f85b9 100644 --- a/sys/arm64/include/atomic.h +++ b/sys/arm64/include/atomic.h @@ -54,7 +54,7 @@ #define rmb() dmb(ld) /* Full system memory barrier load */ #if defined(KCSAN) && !defined(KCSAN_RUNTIME) -#include +#include #else #include diff --git a/sys/arm64/include/bus.h b/sys/arm64/include/bus.h index 917b2618b275..417b918f595f 100644 --- a/sys/arm64/include/bus.h +++ b/sys/arm64/include/bus.h @@ -92,7 +92,7 @@ #define BUS_SPACE_BARRIER_WRITE 0x02 #if defined(KCSAN) && !defined(KCSAN_RUNTIME) -#include +#include #else struct bus_space { diff --git a/sys/kern/subr_csan.c b/sys/kern/subr_csan.c index 3fa59ef2ea66..ec2fd23729b2 100644 --- a/sys/kern/subr_csan.c +++ b/sys/kern/subr_csan.c @@ -380,7 +380,7 @@ kcsan_copyout(const void *kaddr, void *uaddr, size_t len) /* -------------------------------------------------------------------------- */ #include -#include +#include #define _CSAN_ATOMIC_FUNC_ADD(name, type) \ void kcsan_atomic_add_##name(volatile type *ptr, type val) \ @@ -688,7 +688,7 @@ CSAN_ATOMIC_FUNC_THREAD_FENCE(seq_cst) #include #include -#include +#include int kcsan_bus_space_map(bus_space_tag_t tag, bus_addr_t hnd, bus_size_t size, diff --git a/sys/sys/_cscan_atomic.h b/sys/sys/atomic_san.h similarity index 99% rename from sys/sys/_cscan_atomic.h rename to sys/sys/atomic_san.h index b458c24841bf..c2b963ae8b92 100644 --- a/sys/sys/_cscan_atomic.h +++ b/sys/sys/atomic_san.h @@ -32,8 +32,8 @@ * $FreeBSD$ */ -#ifndef _SYS__CSAN_ATOMIC_H_ -#define _SYS__CSAN_ATOMIC_H_ +#ifndef _SYS_ATOMIC_SAN_H_ +#define _SYS_ATOMIC_SAN_H_ #ifndef _MACHINE_ATOMIC_H_ #error do not include this header, use machine/atomic.h @@ -377,4 +377,4 @@ void kcsan_atomic_thread_fence_seq_cst(void); #endif /* !KCSAN_RUNTIME */ -#endif /* !_SYS__CSAN_ATOMIC_H_ */ +#endif /* !_SYS_ATOMIC_SAN_H_ */ diff --git a/sys/sys/_cscan_bus.h b/sys/sys/bus_san.h similarity index 99% rename from sys/sys/_cscan_bus.h rename to sys/sys/bus_san.h index b1fd4135261e..96b2441fbdbe 100644 --- a/sys/sys/_cscan_bus.h +++ b/sys/sys/bus_san.h @@ -32,8 +32,8 @@ * $FreeBSD$ */ -#ifndef _SYS__CSAN_BUS_H_ -#define _SYS__CSAN_BUS_H_ +#ifndef _SYS_BUS_SAN_H_ +#define _SYS_BUS_SAN_H_ #define KCSAN_BS_MULTI(rw, width, type) \ void kcsan_bus_space_##rw##_multi_##width(bus_space_tag_t, \ @@ -206,4 +206,4 @@ void kcsan_bus_space_barrier(bus_space_tag_t, bus_space_handle_t, bus_size_t, #endif /* !KCSAN_RUNTIME */ -#endif /* !_SYS__CSAN_BUS_H_ */ +#endif /* !_SYS_BUS_SAN_H_ */ diff --git a/sys/x86/include/bus.h b/sys/x86/include/bus.h index 562445b81203..da2fe237ae99 100644 --- a/sys/x86/include/bus.h +++ b/sys/x86/include/bus.h @@ -136,7 +136,7 @@ #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ #if defined(KCSAN) && !defined(KCSAN_RUNTIME) -#include +#include #else /* From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:55:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E33B5510DD; Mon, 8 Mar 2021 17:55: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 4DvQwb3r9Wz3CDX; Mon, 8 Mar 2021 17:55: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 C8C165794; Mon, 8 Mar 2021 17:55: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 128Ht9Dd069493; Mon, 8 Mar 2021 17:55:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Ht966069492; Mon, 8 Mar 2021 17:55:09 GMT (envelope-from git) Date: Mon, 8 Mar 2021 17:55:09 GMT Message-Id: <202103081755.128Ht966069492@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: ffe3def903a5 - main - iflib: Make if_shared_ctx_t a pointer to const 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: ffe3def903a5f239c319e5fe12450659658974a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:55:19 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ffe3def903a5f239c319e5fe12450659658974a5 commit ffe3def903a5f239c319e5fe12450659658974a5 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-08 17:39:06 +0000 iflib: Make if_shared_ctx_t a pointer to const This structure is shared among multiple instances of a driver, so we should ensure that it doesn't somehow get treated as if there's a separate instance per interface. This is especially important for software-only drivers like wg. DEVICE_REGISTER() still returns a void * and so the per-driver sctx structures are not yet defined with the const qualifier. Reviewed by: gallatin, erj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29102 --- sys/dev/bnxt/if_bnxt.c | 4 +--- sys/dev/e1000/if_em.c | 8 ++------ sys/dev/e1000/igb_txrx.c | 2 -- sys/dev/ixgbe/if_ix.c | 4 +--- sys/dev/ixgbe/if_ixv.c | 4 +--- sys/dev/ixgbe/ix_txrx.c | 2 -- sys/dev/ixl/if_iavf.c | 4 +--- sys/dev/ixl/if_ixl.c | 4 +--- sys/net/iflib.h | 2 +- 9 files changed, 8 insertions(+), 26 deletions(-) diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c index 7811f4fdebf0..9990e26263b3 100644 --- a/sys/dev/bnxt/if_bnxt.c +++ b/sys/dev/bnxt/if_bnxt.c @@ -327,8 +327,6 @@ static struct if_shared_ctx bnxt_sctx_init = { .isc_driver_version = bnxt_driver_version, }; -if_shared_ctx_t bnxt_sctx = &bnxt_sctx_init; - /* * Device Methods */ @@ -336,7 +334,7 @@ if_shared_ctx_t bnxt_sctx = &bnxt_sctx_init; static void * bnxt_register(device_t dev) { - return bnxt_sctx; + return (&bnxt_sctx_init); } /* diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index b24280dae412..fcf328de9a2e 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -554,8 +554,6 @@ static struct if_shared_ctx em_sctx_init = { .isc_ntxd_default = {EM_DEFAULT_TXD}, }; -if_shared_ctx_t em_sctx = &em_sctx_init; - static struct if_shared_ctx igb_sctx_init = { .isc_magic = IFLIB_MAGIC, .isc_q_align = PAGE_SIZE, @@ -583,8 +581,6 @@ static struct if_shared_ctx igb_sctx_init = { .isc_ntxd_default = {EM_DEFAULT_TXD}, }; -if_shared_ctx_t igb_sctx = &igb_sctx_init; - /***************************************************************** * * Dump Registers @@ -707,13 +703,13 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS) static void * em_register(device_t dev) { - return (em_sctx); + return (&em_sctx_init); } static void * igb_register(device_t dev) { - return (igb_sctx); + return (&igb_sctx_init); } static int diff --git a/sys/dev/e1000/igb_txrx.c b/sys/dev/e1000/igb_txrx.c index 6c41d440c769..9f1921bf0c7e 100644 --- a/sys/dev/e1000/igb_txrx.c +++ b/sys/dev/e1000/igb_txrx.c @@ -72,8 +72,6 @@ struct if_txrx igb_txrx = { .ift_legacy_intr = em_intr }; -extern if_shared_ctx_t em_sctx; - /********************************************************************** * * Setup work for hardware segmentation offload (TSO) on diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 9f3674cdab5d..6e65f6bae55a 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -392,8 +392,6 @@ static struct if_shared_ctx ixgbe_sctx_init = { .isc_ntxd_default = {DEFAULT_TXD}, }; -if_shared_ctx_t ixgbe_sctx = &ixgbe_sctx_init; - /************************************************************************ * ixgbe_if_tx_queues_alloc ************************************************************************/ @@ -855,7 +853,7 @@ ixgbe_initialize_transmit_units(if_ctx_t ctx) static void * ixgbe_register(device_t dev) { - return (ixgbe_sctx); + return (&ixgbe_sctx_init); } /* ixgbe_register */ /************************************************************************ diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 6bd92d262558..ee139430d42b 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -233,12 +233,10 @@ static struct if_shared_ctx ixv_sctx_init = { .isc_ntxd_default = {DEFAULT_TXD}, }; -if_shared_ctx_t ixv_sctx = &ixv_sctx_init; - static void * ixv_register(device_t dev) { - return (ixv_sctx); + return (&ixv_sctx_init); } /************************************************************************ diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 43e64b0c0df0..9d31e0b1b43e 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -72,8 +72,6 @@ struct if_txrx ixgbe_txrx = { .ift_legacy_intr = NULL }; -extern if_shared_ctx_t ixgbe_sctx; - /************************************************************************ * ixgbe_tx_ctx_setup * diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c index 394656d27a2f..f6eb91c2a855 100644 --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -272,13 +272,11 @@ static struct if_shared_ctx iavf_sctx_init = { .isc_ntxd_default = {IXL_DEFAULT_RING}, }; -if_shared_ctx_t iavf_sctx = &iavf_sctx_init; - /*** Functions ***/ static void * iavf_register(device_t dev) { - return (iavf_sctx); + return (&iavf_sctx_init); } static int diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index a79648de274f..c700af889cf1 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -351,13 +351,11 @@ static struct if_shared_ctx ixl_sctx_init = { .isc_ntxd_default = {IXL_DEFAULT_RING}, }; -if_shared_ctx_t ixl_sctx = &ixl_sctx_init; - /*** Functions ***/ static void * ixl_register(device_t dev) { - return (ixl_sctx); + return (&ixl_sctx_init); } static int diff --git a/sys/net/iflib.h b/sys/net/iflib.h index 1e8aed271334..f88294b3d01a 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -49,7 +49,7 @@ typedef uint16_t qidx_t; struct iflib_ctx; typedef struct iflib_ctx *if_ctx_t; struct if_shared_ctx; -typedef struct if_shared_ctx *if_shared_ctx_t; +typedef const struct if_shared_ctx *if_shared_ctx_t; struct if_int_delay_info; typedef struct if_int_delay_info *if_int_delay_info_t; struct if_pseudo; From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:55:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67323550AFA; Mon, 8 Mar 2021 17:55: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 4DvQwb3myFz3CNB; Mon, 8 Mar 2021 17:55: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 764F255D6; Mon, 8 Mar 2021 17:55: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 128Ht7l4069453; Mon, 8 Mar 2021 17:55:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Ht71X069452; Mon, 8 Mar 2021 17:55:07 GMT (envelope-from git) Date: Mon, 8 Mar 2021 17:55:07 GMT Message-Id: <202103081755.128Ht71X069452@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: 0e72eb460228 - main - ath_hal: Stop printing messages during boot 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: 0e72eb460228e4b9cb790beb7113d0a5c88db503 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:55:21 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0e72eb460228e4b9cb790beb7113d0a5c88db503 commit 0e72eb460228e4b9cb790beb7113d0a5c88db503 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-08 17:39:06 +0000 ath_hal: Stop printing messages during boot ath_hal is compiled into the kernel by default and so always prints a message to dmesg even when the system has no ath hardware. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/dev/ath/ah_osdep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c index 44878486a0c7..a760540b0f3a 100644 --- a/sys/dev/ath/ah_osdep.c +++ b/sys/dev/ath/ah_osdep.c @@ -434,11 +434,13 @@ ath_hal_modevent(module_t mod __unused, int type, void *data __unused) switch (type) { case MOD_LOAD: - printf("[ath_hal] loaded\n"); + if (bootverbose) + printf("[ath_hal] loaded\n"); break; case MOD_UNLOAD: - printf("[ath_hal] unloaded\n"); + if (bootverbose) + printf("[ath_hal] unloaded\n"); break; case MOD_SHUTDOWN: From owner-dev-commits-src-all@freebsd.org Mon Mar 8 17:58:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 834DA5512F8; Mon, 8 Mar 2021 17:58: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 4DvQzr3MxGz3DkD; Mon, 8 Mar 2021 17:58: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 66A0155DC; Mon, 8 Mar 2021 17:58: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 128Hw0kf070058; Mon, 8 Mar 2021 17:58:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Hw05O070057; Mon, 8 Mar 2021 17:58:00 GMT (envelope-from git) Date: Mon, 8 Mar 2021 17:58:00 GMT Message-Id: <202103081758.128Hw05O070057@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: 1bb7c45c532f - main - wg: Fix a mismerge 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: 1bb7c45c532f3de76120db05739ac4ee34403091 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 17:58:00 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1bb7c45c532f3de76120db05739ac4ee34403091 commit 1bb7c45c532f3de76120db05739ac4ee34403091 Author: Mark Johnston AuthorDate: 2021-03-08 17:56:14 +0000 Commit: Mark Johnston CommitDate: 2021-03-08 17:56:14 +0000 wg: Fix a mismerge df55485085 fixed a leak that I had initially fixed in a11009dccb. Fixes: a11009dccb --- sys/dev/if_wg/module/if_wg_session.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index 75baae063428..e63367785ed3 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -1911,7 +1911,6 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, */ if ((m = m_pullup(m0, m0->m_pkthdr.len)) == NULL) { DPRINTF(sc, "DEFRAG fail\n"); - m_freem(m0); return; } data = mtod(m, void *); From owner-dev-commits-src-all@freebsd.org Mon Mar 8 18:05:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F05AD551AC0; Mon, 8 Mar 2021 18:05:51 +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 4DvR8v6Vtnz3Fb0; Mon, 8 Mar 2021 18:05:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) (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 CB766C5B2; Mon, 8 Mar 2021 18:05:51 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f177.google.com with SMTP id d11so8177460qtx.9; Mon, 08 Mar 2021 10:05:51 -0800 (PST) X-Gm-Message-State: AOAM533JEUi08ds6cl2/MoqLWiZpmawy7/+D8LmjIRit9bCqPZPpB5WV UHvkyzMHC9Y5NQoAbPlhQ80dhL/+NGpnxnLeH2g= X-Google-Smtp-Source: ABdhPJzT+d0wNTAnOrTQGBB9R6xWOWDJXpEDsa3N47V2n+KB7WIxx7vV/Am4IXyeKuzNRtS3Hojm1fiq0Ofo5cMB+4k= X-Received: by 2002:ac8:5947:: with SMTP id 7mr21872974qtz.60.1615226751399; Mon, 08 Mar 2021 10:05:51 -0800 (PST) MIME-Version: 1.0 References: <202103081758.128Hw05O070057@gitrepo.freebsd.org> In-Reply-To: <202103081758.128Hw05O070057@gitrepo.freebsd.org> From: Kyle Evans Date: Mon, 8 Mar 2021 12:05:37 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 1bb7c45c532f - main - wg: Fix a mismerge To: Mark Johnston Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 18:05:52 -0000 On Mon, Mar 8, 2021 at 11:58 AM Mark Johnston wrote: > > The branch main has been updated by markj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=1bb7c45c532f3de76120db05739ac4ee34403091 > > commit 1bb7c45c532f3de76120db05739ac4ee34403091 > Author: Mark Johnston > AuthorDate: 2021-03-08 17:56:14 +0000 > Commit: Mark Johnston > CommitDate: 2021-03-08 17:56:14 +0000 > > wg: Fix a mismerge > > df55485085 fixed a leak that I had initially fixed in a11009dccb. > > Fixes: a11009dccb Whoops, sorry about that. :-( I didn't check for conflicting work here. From owner-dev-commits-src-all@freebsd.org Mon Mar 8 18:09:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0AAAF55187C; Mon, 8 Mar 2021 18:09:44 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (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 4DvRFM6jHSz3Fvt; Mon, 8 Mar 2021 18:09:43 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-pg1-x52f.google.com with SMTP id g4so6912342pgj.0; Mon, 08 Mar 2021 10:09:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JrQTRO531Ui7uqvOCGhyXvQGVLx+99kZyUrsbpQ5tXs=; b=kptDXQ76cGz0APHcQKHavz93yASaKdGA15sngImEm4icklcXJ/zOUjDXsNnwU1EWDX OJdDc66ftGa4HgwRjGUIID1TgQsY0R+J0oKcP4Klln6q5On4yYmkU3WdC3NR4W23cZNQ dtFH/pDEQkcfEai+O03/TGY7ZPtutXrg6pUKghWLiLY1bAA6vkkz9T2xguAaqrVjs9gI ZbBDg9ovlJI1T1FJi8Wf+pnZcZHB8kgtxxApTWOOFetlpolHIfpizYiffs0FzNcnx92M 9QFDMHTpwCxa/vyh8UuqXbtbQPQdeqNd0dvhY5l/Ww3e82/13ysRXQ9iy4xsFQRddHEQ 1xXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=JrQTRO531Ui7uqvOCGhyXvQGVLx+99kZyUrsbpQ5tXs=; b=JmGgaKIrqUynsLBWx12NRLaptVAfrUPmSu/J7MXrGLOOGM4LXqJXDBKX9mZtw3+GQ3 4Vh/FYg9ORfrcY9uGw9W227U2mhTiZPh0gjf6Qg9NrzUuk0u6XfU9v96zNaIXhWfjEHS OGhea0MqbDed/SrVKpylIss2MTlQY4xXBCPMkzrTF9oxeHQD6afPbugMQLFqwz9BQD1C QwybXL3aoyDmu37i6jRoHTu6JlgzX7HmAGtpNsi0nD4e5rGHCR6+koA57YwVN7mbJeYH Eu2yTNRDFR9YB+eLkb46TsKNxK4UpEvJqpnlhlvCReeL4FBbNkGs5su37J22VSXKt/K1 Vcew== X-Gm-Message-State: AOAM5315cyHcAREf5I6hrvFuyelkjn/O2Lq1+N1lptfHYwACPEBBILuY Aq4TIP13cHIrbWvbaGx2Ol3lgYuUAFy53w== X-Google-Smtp-Source: ABdhPJyzaVwZm97KbN+GfDphibgAmFnxv8UOm0OAAa58zuMojAFPPqmG4HJLdt/91KIoDWJiWPQ1eQ== X-Received: by 2002:aa7:8e51:0:b029:1ed:2928:18ff with SMTP id d17-20020aa78e510000b02901ed292818ffmr80010pfr.76.1615226982363; Mon, 08 Mar 2021 10:09:42 -0800 (PST) Received: from spy (ip68-8-187-18.sd.sd.cox.net. [68.8.187.18]) by smtp.gmail.com with ESMTPSA id g22sm52824pju.30.2021.03.08.10.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Mar 2021 10:09:41 -0800 (PST) Sender: Mark Johnston Date: Mon, 8 Mar 2021 14:10:42 -0500 From: Mark Johnston To: Kyle Evans Cc: src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 1bb7c45c532f - main - wg: Fix a mismerge Message-ID: References: <202103081758.128Hw05O070057@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4DvRFM6jHSz3Fvt 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 18:09:44 -0000 On Mon, Mar 08, 2021 at 12:05:37PM -0600, Kyle Evans wrote: > On Mon, Mar 8, 2021 at 11:58 AM Mark Johnston wrote: > > > > The branch main has been updated by markj: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=1bb7c45c532f3de76120db05739ac4ee34403091 > > > > commit 1bb7c45c532f3de76120db05739ac4ee34403091 > > Author: Mark Johnston > > AuthorDate: 2021-03-08 17:56:14 +0000 > > Commit: Mark Johnston > > CommitDate: 2021-03-08 17:56:14 +0000 > > > > wg: Fix a mismerge > > > > df55485085 fixed a leak that I had initially fixed in a11009dccb. > > > > Fixes: a11009dccb > > Whoops, sorry about that. :-( I didn't check for conflicting work here. It's my fault, I saw your commit before I pushed and amended the commit log message accordingly, but then failed to actually update the diff. :/ From owner-dev-commits-src-all@freebsd.org Mon Mar 8 18:15:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4F195523ED; Mon, 8 Mar 2021 18:15:45 +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 4DvRNK6Fwbz3GMZ; Mon, 8 Mar 2021 18:15:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 57CCAD32F; Mon, 8 Mar 2021 18:15:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: afbee98232f4 - main - Remove xform_poly1305.h from the build, it is not necessary. To: Scott Long , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202103052202.125M2CKd002981@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Mon, 8 Mar 2021 10:15:40 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <202103052202.125M2CKd002981@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 18:15:46 -0000 On 3/5/21 2:02 PM, Scott Long wrote: > The branch main has been updated by scottl: > > URL: https://cgit.FreeBSD.org/src/commit/?id=afbee98232f41fc05fa8a5b9a8cda4c4c65ff448 > > commit afbee98232f41fc05fa8a5b9a8cda4c4c65ff448 > Author: Scott Long > AuthorDate: 2021-03-05 21:28:10 +0000 > Commit: Scott Long > CommitDate: 2021-03-05 21:28:10 +0000 > > Remove xform_poly1305.h from the build, it is not necessary. Sorry for the breakage, thanks for fixing it. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Mon Mar 8 18:36:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD859552A9F; Mon, 8 Mar 2021 18:36: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 4DvRrS4TkPz3HZp; Mon, 8 Mar 2021 18:36: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 887275AE5; Mon, 8 Mar 2021 18:36: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 128IaeJq022846; Mon, 8 Mar 2021 18:36:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128IaeQO022845; Mon, 8 Mar 2021 18:36:40 GMT (envelope-from git) Date: Mon, 8 Mar 2021 18:36:40 GMT Message-Id: <202103081836.128IaeQO022845@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brandon Bergren Subject: git: 102e7117bcf3 - stable/13 - [PowerPC64LE] pseries: Fix input buffering logic. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 102e7117bcf32f9bee513f948815213575cfebd4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 18:36:40 -0000 The branch stable/13 has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=102e7117bcf32f9bee513f948815213575cfebd4 commit 102e7117bcf32f9bee513f948815213575cfebd4 Author: Brandon Bergren AuthorDate: 2021-02-25 18:55:58 +0000 Commit: Brandon Bergren CommitDate: 2021-03-08 18:35:56 +0000 [PowerPC64LE] pseries: Fix input buffering logic. In uart_phyp_get(), when the internal buffer is empty, we make a hypercall to retrieve up to 16 bytes of input data from the hypervisor. As this is specified to be returned in BE format, we need to do a 64-bit byte swap on the first and second half of the data. If the buffer being passed in was insufficient to return the fetched data, we store the remainder in the internal buffer and use it to satisfy the following calls to uart_phyp_get() until it is drained. However, in this case, we were accidentally byteswapping the internal buffer again. Move the byteswapping code to just after the hypercall so it only gets swapped when we're filling the buffer. Fixes arrow keys in qemu on pseries, among other console oddities. Sponsored by: Tag1 Consulting, Inc. (cherry picked from commit 5001c579baff78719919d79ec054207aa2938dbd) --- sys/powerpc/pseries/phyp_console.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/powerpc/pseries/phyp_console.c b/sys/powerpc/pseries/phyp_console.c index 84ab292dae94..484952177d51 100644 --- a/sys/powerpc/pseries/phyp_console.c +++ b/sys/powerpc/pseries/phyp_console.c @@ -295,6 +295,10 @@ uart_phyp_get(struct uart_phyp_softc *sc, void *buffer, size_t bufsize) err = phyp_pft_hcall(H_GET_TERM_CHAR, sc->vtermid, 0, 0, 0, &sc->inbuflen, &sc->phyp_inbuf.u64[0], &sc->phyp_inbuf.u64[1]); +#if BYTE_ORDER == LITTLE_ENDIAN + sc->phyp_inbuf.u64[0] = be64toh(sc->phyp_inbuf.u64[0]); + sc->phyp_inbuf.u64[1] = be64toh(sc->phyp_inbuf.u64[1]); +#endif if (err != H_SUCCESS) { uart_unlock(&sc->sc_mtx); return (-1); @@ -307,11 +311,6 @@ uart_phyp_get(struct uart_phyp_softc *sc, void *buffer, size_t bufsize) return (0); } -#if BYTE_ORDER == LITTLE_ENDIAN - sc->phyp_inbuf.u64[0] = be64toh(sc->phyp_inbuf.u64[0]); - sc->phyp_inbuf.u64[1] = be64toh(sc->phyp_inbuf.u64[1]); -#endif - if ((sc->protocol == HVTERMPROT) && (hdr == 1)) { sc->inbuflen = sc->inbuflen - 4; /* The VTERM protocol has a 4 byte header, skip it here. */ From owner-dev-commits-src-all@freebsd.org Mon Mar 8 18:41:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02499552A78; Mon, 8 Mar 2021 18:41: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 4DvRxx6kM9z3Hnk; Mon, 8 Mar 2021 18:41: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 D92085FBB; Mon, 8 Mar 2021 18:41: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 128IfPwY033966; Mon, 8 Mar 2021 18:41:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128IfP8X033965; Mon, 8 Mar 2021 18:41:25 GMT (envelope-from git) Date: Mon, 8 Mar 2021 18:41:25 GMT Message-Id: <202103081841.128IfP8X033965@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brandon Bergren Subject: git: 8b96d6ac04e7 - stable/13 - [PowerPC] [PowerPCSPE] Fix multiple issues in fpsetmask(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8b96d6ac04e7e761ec6b9eff47c801a2b89fbd6d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 18:41:26 -0000 The branch stable/13 has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=8b96d6ac04e7e761ec6b9eff47c801a2b89fbd6d commit 8b96d6ac04e7e761ec6b9eff47c801a2b89fbd6d Author: Brandon Bergren AuthorDate: 2021-03-01 03:06:59 +0000 Commit: Brandon Bergren CommitDate: 2021-03-08 18:39:33 +0000 [PowerPC] [PowerPCSPE] Fix multiple issues in fpsetmask(). Building R on powerpc64 exposed a problem in fpsetmask() whereby we were not properly clamping the provided mask to the valid range. This same issue affects powerpc and powerpcspe. Properly limit the range of bits that can be set via fpsetmask(). While here, use the correct fp_except_t type instead of fp_rnd_t. Reported by: pkubaj, jhibbits (in IRC) Sponsored by: Tag1 Consulting, Inc. (cherry picked from commit 384ee7cc6e9e4ddc91a6e9e623fcbbe5826bce38) --- lib/libc/powerpc/gen/fpsetmask.c | 6 +++--- lib/libc/powerpcspe/gen/fpsetmask.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libc/powerpc/gen/fpsetmask.c b/lib/libc/powerpc/gen/fpsetmask.c index 4d63552470be..f5d52eec5482 100644 --- a/lib/libc/powerpc/gen/fpsetmask.c +++ b/lib/libc/powerpc/gen/fpsetmask.c @@ -43,11 +43,11 @@ fp_except_t fpsetmask(fp_except_t mask) { u_int64_t fpscr; - fp_rnd_t old; + fp_except_t old; __asm__("mffs %0" : "=f"(fpscr)); - old = (fp_rnd_t)((fpscr >> 3) & 0x1f); - fpscr = (fpscr & 0xffffff07) | (mask << 3); + old = (fp_except_t)((fpscr >> 3) & 0x1f); + fpscr = (fpscr & 0xffffff07) | ((mask & 0x1f) << 3); __asm__ __volatile("mtfsf 0xff,%0" :: "f"(fpscr)); return (old); } diff --git a/lib/libc/powerpcspe/gen/fpsetmask.c b/lib/libc/powerpcspe/gen/fpsetmask.c index e71b822d6e0b..2f48802d9ca3 100644 --- a/lib/libc/powerpcspe/gen/fpsetmask.c +++ b/lib/libc/powerpcspe/gen/fpsetmask.c @@ -42,11 +42,11 @@ fp_except_t fpsetmask(fp_except_t mask) { uint32_t fpscr; - fp_rnd_t old; + fp_except_t old; __asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR)); - old = (fp_rnd_t)((fpscr >> 2) & 0x1f); - fpscr = (fpscr & 0xffffff83) | (mask << 2); + old = (fp_except_t)((fpscr >> 2) & 0x1f); + fpscr = (fpscr & 0xffffff83) | ((mask & 0x1f) << 2); __asm__ __volatile("mtspr %1,%0;isync" :: "r"(fpscr), "K"(SPR_SPEFSCR)); return (old); } From owner-dev-commits-src-all@freebsd.org Mon Mar 8 18:41:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E3F7552EAB; Mon, 8 Mar 2021 18:41: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 4DvRxz0PlGz3Ht2; Mon, 8 Mar 2021 18:41: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 013DA5CCA; Mon, 8 Mar 2021 18:41: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 128IfQp3033989; Mon, 8 Mar 2021 18:41:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128IfQvW033988; Mon, 8 Mar 2021 18:41:26 GMT (envelope-from git) Date: Mon, 8 Mar 2021 18:41:26 GMT Message-Id: <202103081841.128IfQvW033988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brandon Bergren Subject: git: a79735386c46 - stable/13 - [PowerPC64] Fix multiple issues in fpsetmask(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a79735386c46298274d71577ab6b4dd00be261cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 18:41:27 -0000 The branch stable/13 has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=a79735386c46298274d71577ab6b4dd00be261cc commit a79735386c46298274d71577ab6b4dd00be261cc Author: Brandon Bergren AuthorDate: 2021-03-01 02:35:53 +0000 Commit: Brandon Bergren CommitDate: 2021-03-08 18:40:11 +0000 [PowerPC64] Fix multiple issues in fpsetmask(). Building R exposed a problem in fpsetmask() whereby we were not properly clamping the provided mask to the valid range. R initilizes the mask by calling fpsetmask(~0) on FreeBSD. Since we recently enabled precise exceptions, this was causing an immediate SIGFPE because we were attempting to set invalid bits in the fpscr. Properly limit the range of bits that can be set via fpsetmask(). While here, use the correct fp_except_t type instead of fp_rnd_t. Reported by: pkubaj (in IRC) Sponsored by: Tag1 Consulting, Inc. (cherry picked from commit dd95b39235dd81c890aa3cce02a5bb7f91f23803) --- lib/libc/powerpc64/gen/fpsetmask.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libc/powerpc64/gen/fpsetmask.c b/lib/libc/powerpc64/gen/fpsetmask.c index 4d63552470be..f5d52eec5482 100644 --- a/lib/libc/powerpc64/gen/fpsetmask.c +++ b/lib/libc/powerpc64/gen/fpsetmask.c @@ -43,11 +43,11 @@ fp_except_t fpsetmask(fp_except_t mask) { u_int64_t fpscr; - fp_rnd_t old; + fp_except_t old; __asm__("mffs %0" : "=f"(fpscr)); - old = (fp_rnd_t)((fpscr >> 3) & 0x1f); - fpscr = (fpscr & 0xffffff07) | (mask << 3); + old = (fp_except_t)((fpscr >> 3) & 0x1f); + fpscr = (fpscr & 0xffffff07) | ((mask & 0x1f) << 3); __asm__ __volatile("mtfsf 0xff,%0" :: "f"(fpscr)); return (old); } From owner-dev-commits-src-all@freebsd.org Mon Mar 8 18:42:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73AD5552FD1; Mon, 8 Mar 2021 18:42:31 +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 4DvRzC2qdkz3J6j; Mon, 8 Mar 2021 18:42:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id B4E26D68C; Mon, 8 Mar 2021 18:42:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: Stefan Esser , Kyle Evans Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103051755.125HtZsc073704@gitrepo.freebsd.org> <3e76fccd-efeb-1479-7418-7e69bed98915@freebsd.org> From: John Baldwin Subject: Re: git: bb6e84c988d3 - main - poly1305: Don't export generic Poly1305_* symbols from xform_poly1305.c. Message-ID: <196e118d-c41d-505e-2750-b05ef4328ae7@FreeBSD.org> Date: Mon, 8 Mar 2021 10:42:26 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <3e76fccd-efeb-1479-7418-7e69bed98915@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 18:42:31 -0000 On 3/5/21 12:27 PM, Stefan Esser wrote: > Am 05.03.21 um 21:05 schrieb Kyle Evans: >> On Fri, Mar 5, 2021 at 11:55 AM John Baldwin wrote: >>> >>> The branch main has been updated by jhb: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=bb6e84c988d3f54eff602ed544ceaa9b9fe3e9ff >>> >>> commit bb6e84c988d3f54eff602ed544ceaa9b9fe3e9ff >>> Author: John Baldwin >>> AuthorDate: 2021-03-05 17:47:58 +0000 >>> Commit: John Baldwin >>> CommitDate: 2021-03-05 17:55:11 +0000 >>> >>> poly1305: Don't export generic Poly1305_* symbols from xform_poly1305.c. >>> >>> There currently isn't a need to provide a public interface to a >>> software Poly1305 implementation beyond what is already available via >>> libsodium's APIs and these symbols conflict with symbols shared within >>> the ossl.ko module between ossl_poly1305.c and ossl_chacha20.c. >>> >>> Reported by: se, kp >>> Fixes: 78991a93eb9d >>> Sponsored by: Netflix >>> --- >>> sys/opencrypto/xform_poly1305.c | 43 ++++++++++++----------------------------- >>> sys/opencrypto/xform_poly1305.h | 16 --------------- >>> 2 files changed, 12 insertions(+), 47 deletions(-) >> >> xform_poly1305.h also needs to stop being grouped in >> ^/include/Makefile (reported by jenkins via np) > > AFAICT, sys/opencrypto/xform_poly1305.h needs to be restored ... > > It is needed during buildworld (and present in stable/13). Removing it from include/Makefile as scottl@ and jkim@ did is the right fix. It was a kernel-only header with no userland-usable parts. I need to double check, but probably only cryptodev.h should be installed in /usr/include/crypto as the rest of those headers are all for kernel-only APIs. It looks like I actually need to add some missing entries to ObsoleteFiles.inc for some headers that were removed in 13. Ahhh, we used to just install *.h from sys/opencrypto (which is wrong) and it was switched in f61a3898bb989 to list files explicitly, but that is somewhat why removing headers in the past didn't trigger build breakage. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Mon Mar 8 18:49:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BD55553329; Mon, 8 Mar 2021 18:49: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 4DvS6y6v6zz3JS1; Mon, 8 Mar 2021 18:49: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 DB4445FC9; Mon, 8 Mar 2021 18:49: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 128InEDV036915; Mon, 8 Mar 2021 18:49:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128InEbC036914; Mon, 8 Mar 2021 18:49:14 GMT (envelope-from git) Date: Mon, 8 Mar 2021 18:49:14 GMT Message-Id: <202103081849.128InEbC036914@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: c5a365623f88 - main - Correct the name of the structure used for TCP socket options. 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: c5a365623f88999b524d94003187ef09fda55f67 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 18:49:15 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c5a365623f88999b524d94003187ef09fda55f67 commit c5a365623f88999b524d94003187ef09fda55f67 Author: John Baldwin AuthorDate: 2021-03-08 18:46:40 +0000 Commit: John Baldwin CommitDate: 2021-03-08 18:46:40 +0000 Correct the name of the structure used for TCP socket options. The structure was renamed while refactoring Netflix's KTLS changes for upstreaming, but the original name remained in tcp.4 and was subsequently copied to ktls.4. PR: 254141 Reported by: asomers MFC after: 3 days --- share/man/man4/ktls.4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man4/ktls.4 b/share/man/man4/ktls.4 index 21e1a1bdb6ca..648eeaedfa6a 100644 --- a/share/man/man4/ktls.4 +++ b/share/man/man4/ktls.4 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2021 +.Dd March 8, 2021 .Dt KTLS 4 .Os .Sh NAME @@ -54,7 +54,7 @@ and .Dv TCP_RXTLS_ENABLE socket options. Both socket options accept a -.Vt struct tls_so_enable +.Vt struct tls_enable structure as their argument. The members of this structure describe the cipher suite used for the TLS session and provide the session keys used for the respective @@ -166,7 +166,7 @@ will fail with one of the following errors: .It Bq Er EINVAL The version fields in a TLS record's header did not match the version required by the -.Vt struct tls_so_enable +.Vt struct tls_enable structure used to enable in-kernel TLS. .It Bq Er EMSGSIZE A TLS record's length was either too small or too large. From owner-dev-commits-src-all@freebsd.org Mon Mar 8 19:07:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B5765535F1; Mon, 8 Mar 2021 19:07: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 4DvSX333rgz3Kdg; Mon, 8 Mar 2021 19:07: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 5C0ED660E; Mon, 8 Mar 2021 19:07: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 128J7Vg6063086; Mon, 8 Mar 2021 19:07:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128J7VCK063085; Mon, 8 Mar 2021 19:07:31 GMT (envelope-from git) Date: Mon, 8 Mar 2021 19:07:31 GMT Message-Id: <202103081907.128J7VCK063085@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brandon Bergren Subject: git: d905133e26d0 - stable/12 - [PowerPC] Fix SPE floating point environment manipulation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d905133e26d0c8852c9977a76a1091f25a031284 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 19:07:31 -0000 The branch stable/12 has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=d905133e26d0c8852c9977a76a1091f25a031284 commit d905133e26d0c8852c9977a76a1091f25a031284 Author: Brandon Bergren AuthorDate: 2019-12-12 17:12:18 +0000 Commit: Brandon Bergren CommitDate: 2021-03-08 18:51:31 +0000 [PowerPC] Fix SPE floating point environment manipulation Fix multiple problems in the powerpcspe floating point code. * Endianness handling of the SPEFSCR in fenv.h was completely broken. * Ensure SPEFSCR synchronization requirements are being met. The __r.__d -> __r transformations were written by jhibbits. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22526 (cherry picked from commit 4f9ed3156c3aff08629d37c8a89ed5ba525b01c9) --- lib/libc/powerpcspe/gen/fpsetmask.c | 2 +- lib/libc/powerpcspe/gen/fpsetround.c | 2 +- lib/msun/powerpc/fenv.h | 57 ++++++++++++++++++++---------------- sys/powerpc/booke/spe.c | 2 +- 4 files changed, 34 insertions(+), 29 deletions(-) diff --git a/lib/libc/powerpcspe/gen/fpsetmask.c b/lib/libc/powerpcspe/gen/fpsetmask.c index 9763b78a0919..e71b822d6e0b 100644 --- a/lib/libc/powerpcspe/gen/fpsetmask.c +++ b/lib/libc/powerpcspe/gen/fpsetmask.c @@ -47,7 +47,7 @@ fpsetmask(fp_except_t mask) __asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR)); old = (fp_rnd_t)((fpscr >> 2) & 0x1f); fpscr = (fpscr & 0xffffff83) | (mask << 2); - __asm__ __volatile("mtspr %1,%0" :: "r"(fpscr), "K"(SPR_SPEFSCR)); + __asm__ __volatile("mtspr %1,%0;isync" :: "r"(fpscr), "K"(SPR_SPEFSCR)); return (old); } #endif diff --git a/lib/libc/powerpcspe/gen/fpsetround.c b/lib/libc/powerpcspe/gen/fpsetround.c index b5340a6d9ea2..2e2469cdae5e 100644 --- a/lib/libc/powerpcspe/gen/fpsetround.c +++ b/lib/libc/powerpcspe/gen/fpsetround.c @@ -47,7 +47,7 @@ fpsetround(fp_rnd_t rnd_dir) __asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR) ); old = (fp_rnd_t)(fpscr & 0x3); fpscr = (fpscr & 0xfffffffc) | rnd_dir; - __asm__ __volatile("mtspr %1, %0" :: "r"(fpscr), "K"(SPR_SPEFSCR)); + __asm__ __volatile("mtspr %1, %0;isync" :: "r"(fpscr), "K"(SPR_SPEFSCR)); return (old); } #endif diff --git a/lib/msun/powerpc/fenv.h b/lib/msun/powerpc/fenv.h index af9eee999b70..3e2a11c48c50 100644 --- a/lib/msun/powerpc/fenv.h +++ b/lib/msun/powerpc/fenv.h @@ -32,6 +32,7 @@ #define _FENV_H_ #include +#include #ifndef __fenv_static #define __fenv_static static @@ -90,11 +91,15 @@ extern const fenv_t __fe_dfl_env; #ifndef _SOFT_FLOAT #ifdef __SPE__ -#define __mffs(__env) __asm __volatile("mfspr %0, 512" : "=r" (*(__env))) -#define __mtfsf(__env) __asm __volatile("mtspr 512,%0" : : "r" (__env)) +#define __mffs(__env) \ + __asm __volatile("mfspr %0, 512" : "=r" ((__env)->__bits.__reg)) +#define __mtfsf(__env) \ + __asm __volatile("mtspr 512,%0;isync" :: "r" ((__env).__bits.__reg)) #else -#define __mffs(__env) __asm __volatile("mffs %0" : "=f" (*(__env))) -#define __mtfsf(__env) __asm __volatile("mtfsf 255,%0" : : "f" (__env)) +#define __mffs(__env) \ + __asm __volatile("mffs %0" : "=f" ((__env)->__d)) +#define __mtfsf(__env) \ + __asm __volatile("mtfsf 255,%0" :: "f" ((__env).__d)) #endif #else #define __mffs(__env) @@ -121,9 +126,9 @@ feclearexcept(int __excepts) if (__excepts & FE_INVALID) __excepts |= FE_ALL_INVALID; - __mffs(&__r.__d); + __mffs(&__r); __r.__bits.__reg &= ~__excepts; - __mtfsf(__r.__d); + __mtfsf(__r); return (0); } @@ -132,7 +137,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts) { union __fpscr __r; - __mffs(&__r.__d); + __mffs(&__r); *__flagp = __r.__bits.__reg & __excepts; return (0); } @@ -144,10 +149,10 @@ fesetexceptflag(const fexcept_t *__flagp, int __excepts) if (__excepts & FE_INVALID) __excepts |= FE_ALL_EXCEPT; - __mffs(&__r.__d); + __mffs(&__r); __r.__bits.__reg &= ~__excepts; __r.__bits.__reg |= *__flagp & __excepts; - __mtfsf(__r.__d); + __mtfsf(__r); return (0); } @@ -158,9 +163,9 @@ feraiseexcept(int __excepts) if (__excepts & FE_INVALID) __excepts |= FE_VXSOFT; - __mffs(&__r.__d); + __mffs(&__r); __r.__bits.__reg |= __excepts; - __mtfsf(__r.__d); + __mtfsf(__r); return (0); } @@ -169,7 +174,7 @@ fetestexcept(int __excepts) { union __fpscr __r; - __mffs(&__r.__d); + __mffs(&__r); return (__r.__bits.__reg & __excepts); } @@ -178,7 +183,7 @@ fegetround(void) { union __fpscr __r; - __mffs(&__r.__d); + __mffs(&__r); return (__r.__bits.__reg & _ROUND_MASK); } @@ -189,10 +194,10 @@ fesetround(int __round) if (__round & ~_ROUND_MASK) return (-1); - __mffs(&__r.__d); + __mffs(&__r); __r.__bits.__reg &= ~_ROUND_MASK; __r.__bits.__reg |= __round; - __mtfsf(__r.__d); + __mtfsf(__r); return (0); } @@ -201,7 +206,7 @@ fegetenv(fenv_t *__envp) { union __fpscr __r; - __mffs(&__r.__d); + __mffs(&__r); *__envp = __r.__bits.__reg; return (0); } @@ -211,10 +216,10 @@ feholdexcept(fenv_t *__envp) { union __fpscr __r; - __mffs(&__r.__d); + __mffs(&__r); *__envp = __r.__d; __r.__bits.__reg &= ~(FE_ALL_EXCEPT | _ENABLE_MASK); - __mtfsf(__r.__d); + __mtfsf(__r); return (0); } @@ -224,7 +229,7 @@ fesetenv(const fenv_t *__envp) union __fpscr __r; __r.__bits.__reg = *__envp; - __mtfsf(__r.__d); + __mtfsf(__r); return (0); } @@ -233,10 +238,10 @@ feupdateenv(const fenv_t *__envp) { union __fpscr __r; - __mffs(&__r.__d); + __mffs(&__r); __r.__bits.__reg &= FE_ALL_EXCEPT; __r.__bits.__reg |= *__envp; - __mtfsf(__r.__d); + __mtfsf(__r); return (0); } @@ -250,10 +255,10 @@ feenableexcept(int __mask) union __fpscr __r; fenv_t __oldmask; - __mffs(&__r.__d); + __mffs(&__r); __oldmask = __r.__bits.__reg; __r.__bits.__reg |= (__mask & FE_ALL_EXCEPT) >> _FPUSW_SHIFT; - __mtfsf(__r.__d); + __mtfsf(__r); return ((__oldmask & _ENABLE_MASK) << _FPUSW_SHIFT); } @@ -263,10 +268,10 @@ fedisableexcept(int __mask) union __fpscr __r; fenv_t __oldmask; - __mffs(&__r.__d); + __mffs(&__r); __oldmask = __r.__bits.__reg; __r.__bits.__reg &= ~((__mask & FE_ALL_EXCEPT) >> _FPUSW_SHIFT); - __mtfsf(__r.__d); + __mtfsf(__r); return ((__oldmask & _ENABLE_MASK) << _FPUSW_SHIFT); } @@ -275,7 +280,7 @@ fegetexcept(void) { union __fpscr __r; - __mffs(&__r.__d); + __mffs(&__r); return ((__r.__bits.__reg & _ENABLE_MASK) << _FPUSW_SHIFT); } diff --git a/sys/powerpc/booke/spe.c b/sys/powerpc/booke/spe.c index 7b24f3b7a759..0305145d5107 100644 --- a/sys/powerpc/booke/spe.c +++ b/sys/powerpc/booke/spe.c @@ -134,7 +134,7 @@ enable_vec(struct thread *td) /* Restore SPEFSCR and ACC. Use %r0 as the scratch for ACC. */ mtspr(SPR_SPEFSCR, pcb->pcb_vec.vscr); - __asm __volatile("evldd 0, 0(%0); evmra 0,0\n" + __asm __volatile("isync;evldd 0, 0(%0); evmra 0,0\n" :: "b"(&pcb->pcb_vec.spare[0])); /* From owner-dev-commits-src-all@freebsd.org Mon Mar 8 19:07:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C7555538CB; Mon, 8 Mar 2021 19:07: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 4DvSX441XLz3Kdh; Mon, 8 Mar 2021 19:07: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 7CE7A627E; Mon, 8 Mar 2021 19:07: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 128J7WUL063108; Mon, 8 Mar 2021 19:07:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128J7Wlv063107; Mon, 8 Mar 2021 19:07:32 GMT (envelope-from git) Date: Mon, 8 Mar 2021 19:07:32 GMT Message-Id: <202103081907.128J7Wlv063107@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brandon Bergren Subject: git: 1a4b9c2827dc - stable/12 - [PowerPC] [PowerPCSPE] Fix multiple issues in fpsetmask(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1a4b9c2827dc74867ceed85febf89f3924605c43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 19:07:32 -0000 The branch stable/12 has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=1a4b9c2827dc74867ceed85febf89f3924605c43 commit 1a4b9c2827dc74867ceed85febf89f3924605c43 Author: Brandon Bergren AuthorDate: 2021-03-01 03:06:59 +0000 Commit: Brandon Bergren CommitDate: 2021-03-08 18:58:37 +0000 [PowerPC] [PowerPCSPE] Fix multiple issues in fpsetmask(). Building R on powerpc64 exposed a problem in fpsetmask() whereby we were not properly clamping the provided mask to the valid range. This same issue affects powerpc and powerpcspe. Properly limit the range of bits that can be set via fpsetmask(). While here, use the correct fp_except_t type instead of fp_rnd_t. Reported by: pkubaj, jhibbits (in IRC) Sponsored by: Tag1 Consulting, Inc. (cherry picked from commit 384ee7cc6e9e4ddc91a6e9e623fcbbe5826bce38) (cherry picked from commit 8b96d6ac04e7e761ec6b9eff47c801a2b89fbd6d) --- lib/libc/powerpc/gen/fpsetmask.c | 6 +++--- lib/libc/powerpcspe/gen/fpsetmask.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libc/powerpc/gen/fpsetmask.c b/lib/libc/powerpc/gen/fpsetmask.c index 4d63552470be..f5d52eec5482 100644 --- a/lib/libc/powerpc/gen/fpsetmask.c +++ b/lib/libc/powerpc/gen/fpsetmask.c @@ -43,11 +43,11 @@ fp_except_t fpsetmask(fp_except_t mask) { u_int64_t fpscr; - fp_rnd_t old; + fp_except_t old; __asm__("mffs %0" : "=f"(fpscr)); - old = (fp_rnd_t)((fpscr >> 3) & 0x1f); - fpscr = (fpscr & 0xffffff07) | (mask << 3); + old = (fp_except_t)((fpscr >> 3) & 0x1f); + fpscr = (fpscr & 0xffffff07) | ((mask & 0x1f) << 3); __asm__ __volatile("mtfsf 0xff,%0" :: "f"(fpscr)); return (old); } diff --git a/lib/libc/powerpcspe/gen/fpsetmask.c b/lib/libc/powerpcspe/gen/fpsetmask.c index e71b822d6e0b..2f48802d9ca3 100644 --- a/lib/libc/powerpcspe/gen/fpsetmask.c +++ b/lib/libc/powerpcspe/gen/fpsetmask.c @@ -42,11 +42,11 @@ fp_except_t fpsetmask(fp_except_t mask) { uint32_t fpscr; - fp_rnd_t old; + fp_except_t old; __asm__ __volatile("mfspr %0, %1" : "=r"(fpscr) : "K"(SPR_SPEFSCR)); - old = (fp_rnd_t)((fpscr >> 2) & 0x1f); - fpscr = (fpscr & 0xffffff83) | (mask << 2); + old = (fp_except_t)((fpscr >> 2) & 0x1f); + fpscr = (fpscr & 0xffffff83) | ((mask & 0x1f) << 2); __asm__ __volatile("mtspr %1,%0;isync" :: "r"(fpscr), "K"(SPR_SPEFSCR)); return (old); } From owner-dev-commits-src-all@freebsd.org Mon Mar 8 19:07:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61B0F553573; Mon, 8 Mar 2021 19:07: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 4DvSX56HWDz3KNy; Mon, 8 Mar 2021 19:07: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 A3EBA658D; Mon, 8 Mar 2021 19:07: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 128J7XEO063127; Mon, 8 Mar 2021 19:07:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128J7Xdr063126; Mon, 8 Mar 2021 19:07:33 GMT (envelope-from git) Date: Mon, 8 Mar 2021 19:07:33 GMT Message-Id: <202103081907.128J7Xdr063126@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brandon Bergren Subject: git: 015a37124b91 - stable/12 - [PowerPC64] Fix multiple issues in fpsetmask(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 015a37124b91043b7f052352a2ba9f19b5d8b5a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 19:07:34 -0000 The branch stable/12 has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=015a37124b91043b7f052352a2ba9f19b5d8b5a7 commit 015a37124b91043b7f052352a2ba9f19b5d8b5a7 Author: Brandon Bergren AuthorDate: 2021-03-01 02:35:53 +0000 Commit: Brandon Bergren CommitDate: 2021-03-08 19:00:55 +0000 [PowerPC64] Fix multiple issues in fpsetmask(). Building R exposed a problem in fpsetmask() whereby we were not properly clamping the provided mask to the valid range. R initilizes the mask by calling fpsetmask(~0) on FreeBSD. Since we recently enabled precise exceptions, this was causing an immediate SIGFPE because we were attempting to set invalid bits in the fpscr. Properly limit the range of bits that can be set via fpsetmask(). While here, use the correct fp_except_t type instead of fp_rnd_t. Reported by: pkubaj (in IRC) Sponsored by: Tag1 Consulting, Inc. (cherry picked from commit dd95b39235dd81c890aa3cce02a5bb7f91f23803) (cherry picked from commit a79735386c46298274d71577ab6b4dd00be261cc) --- lib/libc/powerpc64/gen/fpsetmask.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libc/powerpc64/gen/fpsetmask.c b/lib/libc/powerpc64/gen/fpsetmask.c index 4d63552470be..f5d52eec5482 100644 --- a/lib/libc/powerpc64/gen/fpsetmask.c +++ b/lib/libc/powerpc64/gen/fpsetmask.c @@ -43,11 +43,11 @@ fp_except_t fpsetmask(fp_except_t mask) { u_int64_t fpscr; - fp_rnd_t old; + fp_except_t old; __asm__("mffs %0" : "=f"(fpscr)); - old = (fp_rnd_t)((fpscr >> 3) & 0x1f); - fpscr = (fpscr & 0xffffff07) | (mask << 3); + old = (fp_except_t)((fpscr >> 3) & 0x1f); + fpscr = (fpscr & 0xffffff07) | ((mask & 0x1f) << 3); __asm__ __volatile("mtfsf 0xff,%0" :: "f"(fpscr)); return (old); } From owner-dev-commits-src-all@freebsd.org Mon Mar 8 19:07:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17A46553BB6; Mon, 8 Mar 2021 19:07: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 4DvSX71v1yz3KXv; Mon, 8 Mar 2021 19:07: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 C8632658E; Mon, 8 Mar 2021 19:07: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 128J7YoX063149; Mon, 8 Mar 2021 19:07:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128J7YHM063148; Mon, 8 Mar 2021 19:07:34 GMT (envelope-from git) Date: Mon, 8 Mar 2021 19:07:34 GMT Message-Id: <202103081907.128J7YHM063148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brandon Bergren Subject: git: 6d7145a2b053 - stable/12 - [PowerPC] Allow traversal of oversize OF properties. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6d7145a2b053e65aaa7acc40a7573fc0aa76984a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 19:07:37 -0000 The branch stable/12 has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=6d7145a2b053e65aaa7acc40a7573fc0aa76984a commit 6d7145a2b053e65aaa7acc40a7573fc0aa76984a Author: Brandon Bergren AuthorDate: 2020-11-13 16:49:41 +0000 Commit: Brandon Bergren CommitDate: 2021-03-08 19:02:52 +0000 [PowerPC] Allow traversal of oversize OF properties. In standards such as LoPAPR, property names in excess of the usual 31 characters exist. This breaks property traversal. While in IEEE 1275-1994, nextprop is defined explicitly to work with a 32-byte region of memory, using a larger buffer should be fine. There is actually no way to pass a buffer length to the nextprop call in the OF client interface, so SLOF actually just blindly overflows the buffer. So we have to defensively make the buffer larger, to avoid memory corruption when reading out long properties on live OF systems. Note also that on real-mode OF, things are pretty tight because we are allocating against a static bounce buffer in low memory, so we can't just use a huge buffer to work around this without it being wasteful of our limited amount of 32-bit physical memory. This allows a patched ofwdump to operate properly on SLOF (i.e. pseries) systems, as well as any other PowerPC systems with overlength properties. Reviewed by: jhibbits Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D26669 (cherry picked from commit 26869ad14c70306313405029229a1e2fd94510cd) --- sys/dev/ofw/openfirmio.c | 15 +++++++++++++-- sys/dev/ofw/openfirmio.h | 14 ++++++++++++++ usr.sbin/ofwdump/ofwdump.c | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c index a6ee962b5c8f..ccd284e8bff7 100644 --- a/sys/dev/ofw/openfirmio.c +++ b/sys/dev/ofw/openfirmio.c @@ -115,7 +115,7 @@ openfirm_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, phandle_t node; int len, ok, error; char *name, *value; - char newname[32]; + char newname[OFIOCSUGGPROPNAMELEN]; if ((flags & FREAD) == 0) return (EBADF); @@ -223,8 +223,19 @@ openfirm_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, break; } len = strlen(newname) + 1; - if (len > of->of_buflen) + if (len > of->of_buflen) { + /* + * Passed buffer was insufficient. + * + * Instead of returning an error here, truncate the + * property name to fit the buffer. + * + * This allows us to retain compatibility with old + * tools which always pass a 32 character buffer. + */ len = of->of_buflen; + newname[len - 1] = '\0'; + } else of->of_buflen = len; error = copyout(newname, of->of_buf, len); diff --git a/sys/dev/ofw/openfirmio.h b/sys/dev/ofw/openfirmio.h index 7ba7b907e892..e892c50c672a 100644 --- a/sys/dev/ofw/openfirmio.h +++ b/sys/dev/ofw/openfirmio.h @@ -76,4 +76,18 @@ struct ofiocdesc { /* Maximum accepted value length (maximum of nvramrc property). */ #define OFIOCMAXVALUE 8192 +/* + * While IEEE 1275-1994 states in 3.2.2.1.1 that property names are 1-31 + * printable characters, in practice, this limit has been ignored. + * Noncompliant properties have been codified in standards such as LoPAPR. + * + * This is a suggested buffer length that should be large enough to hold + * any property name currently seen in device trees, without being overly + * wasteful of memory. + * + * If a future version of the Devicetree specification updates the property + * names length requirement, this value will be updated to match. + */ +#define OFIOCSUGGPROPNAMELEN 64 + #endif /* _DEV_OFW_OPENFIRMIO_H_ */ diff --git a/usr.sbin/ofwdump/ofwdump.c b/usr.sbin/ofwdump/ofwdump.c index 9a356f48d01b..6bca1ac839ab 100644 --- a/usr.sbin/ofwdump/ofwdump.c +++ b/usr.sbin/ofwdump/ofwdump.c @@ -144,7 +144,7 @@ static void ofw_dump_properties(int fd, phandle_t n, int level, int raw, int str) { int nlen; - char prop[32]; + char prop[OFIOCSUGGPROPNAMELEN]; for (nlen = ofw_firstprop(fd, n, prop, sizeof(prop)); nlen != 0; nlen = ofw_nextprop(fd, n, prop, prop, sizeof(prop))) From owner-dev-commits-src-all@freebsd.org Mon Mar 8 19:18:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25AA3553CF0; Mon, 8 Mar 2021 19:18: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 4DvSmQ0ZLvz3L7W; Mon, 8 Mar 2021 19:18: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 021BC681D; Mon, 8 Mar 2021 19:18: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 128JIDAa076930; Mon, 8 Mar 2021 19:18:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128JIDTX076929; Mon, 8 Mar 2021 19:18:13 GMT (envelope-from git) Date: Mon, 8 Mar 2021 19:18:13 GMT Message-Id: <202103081918.128JIDTX076929@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: ef74bfc6fed2 - main - Add ObsoleteFiles.inc entries for various OCF headers removed in 13. 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: ef74bfc6fed298d5ca0e3cb92bf008b715ea0c2f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 19:18:14 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=ef74bfc6fed298d5ca0e3cb92bf008b715ea0c2f commit ef74bfc6fed298d5ca0e3cb92bf008b715ea0c2f Author: John Baldwin AuthorDate: 2021-03-08 19:17:21 +0000 Commit: John Baldwin CommitDate: 2021-03-08 19:17:21 +0000 Add ObsoleteFiles.inc entries for various OCF headers removed in 13. MFC after: 3 days --- ObsoleteFiles.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 8dd33475fe44..8f56ef29dad5 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -1237,11 +1237,19 @@ OLD_DIRS+=usr/lib/clang/10.0.0/lib/freebsd OLD_DIRS+=usr/lib/clang/10.0.0/lib OLD_DIRS+=usr/lib/clang/10.0.0 +# 20200520: xform_userland.h removed +OLD_FILES+=usr/include/crypto/xform_userland.h + # 20200515: libalias cuseeme protocol support retired OLD_LIBS+=lib/libalias_cuseeme.so OLD_FILES+=usr/lib/libalias_cuseeme.a OLD_FILES+=usr/lib/libalias_cuseeme_p.a +# 20200511: Remove deprecated crypto algorithms +OLD_FILES+=usr/include/crypto/cast.h +OLD_FILES+=usr/include/crypto/castsb.h +OLD_FILES+=usr/include/crypto/skipjack.h + # 20200511: Remove ubsec(4) OLD_FILES+=usr/share/man/man4/ubsec.4.gz @@ -1277,6 +1285,7 @@ OLD_FILES+=usr/share/man/man1/gdbserver.1.gz OLD_FILES+=usr/share/man/man1/kgdb.1.gz # 20200327: OCF refactoring +OLD_FILES+=usr/include/crypto/cryptosoft.h OLD_FILES+=usr/share/man/man9/crypto_find_driver.9.gz OLD_FILES+=usr/share/man/man9/crypto_register.9.gz OLD_FILES+=usr/share/man/man9/crypto_unregister.9.gz From owner-dev-commits-src-all@freebsd.org Mon Mar 8 20:15:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2F9555653A; Mon, 8 Mar 2021 20:15: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 4DvV2W60XDz3QmM; Mon, 8 Mar 2021 20:15: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 C0B0370FB; Mon, 8 Mar 2021 20:15: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 128KFVGu054948; Mon, 8 Mar 2021 20:15:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128KFVCb054945; Mon, 8 Mar 2021 20:15:31 GMT (envelope-from git) Date: Mon, 8 Mar 2021 20:15:31 GMT Message-Id: <202103082015.128KFVCb054945@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Stefan Eßer Subject: git: f165641df4da - stable/13 - bc: Vendor import new version 3.3.3 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/stable/13 X-Git-Reftype: branch X-Git-Commit: f165641df4da1752f8bb1f55c1e602cdb657fba4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 20:15:31 -0000 The branch stable/13 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=f165641df4da1752f8bb1f55c1e602cdb657fba4 commit f165641df4da1752f8bb1f55c1e602cdb657fba4 Author: Stefan Eßer AuthorDate: 2021-03-05 10:30:11 +0000 Commit: Stefan Eßer CommitDate: 2021-03-08 20:09:19 +0000 bc: Vendor import new version 3.3.3 (cherry picked from commit 028616d0dd69a3da7a30cb94d35f040bf2ced6b9) Make length(0) and length(0.0) return 1 for compatibility with GNU bc and the traditional FreeBSD bc. Fix a potential division by zero error in a non-standard (extended) math library function. --- contrib/bc/Makefile.in | 2 +- contrib/bc/NEWS.md | 26 +++++++ contrib/bc/gen/lib2.bc | 2 +- contrib/bc/karatsuba.py | 10 +-- contrib/bc/manuals/bc.1.md.in | 61 ++++++++-------- contrib/bc/manuals/bc/A.1 | 71 +++++++++--------- contrib/bc/manuals/bc/A.1.md | 59 ++++++++------- contrib/bc/manuals/bc/E.1 | 69 +++++++++--------- contrib/bc/manuals/bc/E.1.md | 55 +++++++------- contrib/bc/manuals/bc/EH.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EH.1.md | 55 +++++++------- contrib/bc/manuals/bc/EHN.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EHN.1.md | 55 +++++++------- contrib/bc/manuals/bc/EHNP.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EHNP.1.md | 55 +++++++------- contrib/bc/manuals/bc/EHP.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EHP.1.md | 55 +++++++------- contrib/bc/manuals/bc/EN.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EN.1.md | 55 +++++++------- contrib/bc/manuals/bc/ENP.1 | 69 +++++++++--------- contrib/bc/manuals/bc/ENP.1.md | 55 +++++++------- contrib/bc/manuals/bc/EP.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EP.1.md | 55 +++++++------- contrib/bc/manuals/bc/H.1 | 71 +++++++++--------- contrib/bc/manuals/bc/H.1.md | 59 ++++++++------- contrib/bc/manuals/bc/HN.1 | 71 +++++++++--------- contrib/bc/manuals/bc/HN.1.md | 59 ++++++++------- contrib/bc/manuals/bc/HNP.1 | 71 +++++++++--------- contrib/bc/manuals/bc/HNP.1.md | 59 ++++++++------- contrib/bc/manuals/bc/HP.1 | 71 +++++++++--------- contrib/bc/manuals/bc/HP.1.md | 59 ++++++++------- contrib/bc/manuals/bc/N.1 | 71 +++++++++--------- contrib/bc/manuals/bc/N.1.md | 59 ++++++++------- contrib/bc/manuals/bc/NP.1 | 71 +++++++++--------- contrib/bc/manuals/bc/NP.1.md | 59 ++++++++------- contrib/bc/manuals/bc/P.1 | 71 +++++++++--------- contrib/bc/manuals/bc/P.1.md | 59 ++++++++------- contrib/bc/manuals/bcl.3 | 2 +- contrib/bc/manuals/bcl.3.md | 76 +++++++++---------- contrib/bc/manuals/dc.1.md.in | 38 +++++----- contrib/bc/manuals/dc/A.1 | 53 +++++++------- contrib/bc/manuals/dc/A.1.md | 38 +++++----- contrib/bc/manuals/dc/E.1 | 53 +++++++------- contrib/bc/manuals/dc/E.1.md | 38 +++++----- contrib/bc/manuals/dc/EH.1 | 53 +++++++------- contrib/bc/manuals/dc/EH.1.md | 38 +++++----- contrib/bc/manuals/dc/EHN.1 | 53 +++++++------- contrib/bc/manuals/dc/EHN.1.md | 38 +++++----- contrib/bc/manuals/dc/EHNP.1 | 53 +++++++------- contrib/bc/manuals/dc/EHNP.1.md | 38 +++++----- contrib/bc/manuals/dc/EHP.1 | 53 +++++++------- contrib/bc/manuals/dc/EHP.1.md | 38 +++++----- contrib/bc/manuals/dc/EN.1 | 53 +++++++------- contrib/bc/manuals/dc/EN.1.md | 38 +++++----- contrib/bc/manuals/dc/ENP.1 | 53 +++++++------- contrib/bc/manuals/dc/ENP.1.md | 38 +++++----- contrib/bc/manuals/dc/EP.1 | 53 +++++++------- contrib/bc/manuals/dc/EP.1.md | 38 +++++----- contrib/bc/manuals/dc/H.1 | 53 +++++++------- contrib/bc/manuals/dc/H.1.md | 38 +++++----- contrib/bc/manuals/dc/HN.1 | 53 +++++++------- contrib/bc/manuals/dc/HN.1.md | 38 +++++----- contrib/bc/manuals/dc/HNP.1 | 53 +++++++------- contrib/bc/manuals/dc/HNP.1.md | 38 +++++----- contrib/bc/manuals/dc/HP.1 | 53 +++++++------- contrib/bc/manuals/dc/HP.1.md | 38 +++++----- contrib/bc/manuals/dc/N.1 | 53 +++++++------- contrib/bc/manuals/dc/N.1.md | 38 +++++----- contrib/bc/manuals/dc/NP.1 | 53 +++++++------- contrib/bc/manuals/dc/NP.1.md | 38 +++++----- contrib/bc/manuals/dc/P.1 | 53 +++++++------- contrib/bc/manuals/dc/P.1.md | 38 +++++----- contrib/bc/manuals/header_bc.txt | 2 +- contrib/bc/manuals/header_bcl.txt | 2 +- contrib/bc/manuals/header_dc.txt | 2 +- contrib/bc/src/num.c | 2 +- contrib/bc/tests/bc/length.txt | 3 + contrib/bc/tests/bc/length_results.txt | 5 +- contrib/bc/tests/bc/lib2.txt | 6 ++ contrib/bc/tests/bc/lib2_results.txt | 6 ++ contrib/bc/tests/bc/scripts/bessel.bc | 9 ++- contrib/bc/tests/dc/all.txt | 1 + contrib/bc/tests/dc/length.txt | 129 +++++++++++++++++++++++++++++++++ contrib/bc/tests/dc/length_results.txt | 129 +++++++++++++++++++++++++++++++++ 84 files changed, 2130 insertions(+), 1871 deletions(-) diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index dbb5debd44cc..db8e24967996 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.3.0 +VERSION = 3.3.3 SRC = %%SRC%% OBJ = %%OBJ%% diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index 6a8899200f4a..3a3433077d50 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,31 @@ # News +## 3.3.3 + +This is a production release with one tweak and fixes for manuals. + +The tweak is that `length(0)` returns `1` instead of `0`. In `3.3.1`, I changed +it so `length(0.x)`, where `x` could be any number of digits, returned the +`scale`, but `length(0)` still returned `0` because I believe that `0` has `0` +significant digits. + +After request of FreeBSD and considering the arguments of a mathematician, +compatibility with other `bc`'s, and the expectations of users, I decided to +make the change. + +The fixes for manuals fixed a bug where `--` was rendered as `-`. + +## 3.3.2 + +This is a production release that fixes a divide-by-zero bug in `root()` in the +[extended math library][16]. All previous versions with `root()` have the bug. + +## 3.3.1 + +This is a production release that fixes a bug. + +The bug was in the reporting of number length when the value was 0. + ## 3.3.0 This is a production release that changes one behavior and fixes documentation diff --git a/contrib/bc/gen/lib2.bc b/contrib/bc/gen/lib2.bc index b0e651eddcbd..399c7ad3d313 100644 --- a/contrib/bc/gen/lib2.bc +++ b/contrib/bc/gen/lib2.bc @@ -110,7 +110,7 @@ define root(x,n){ if(n<0)sqrt(n) n=n$ if(n==0)x/n - if(n==1)return x + if(x==0||n==1)return x if(n==2)return sqrt(x) s=scale scale=0 diff --git a/contrib/bc/karatsuba.py b/contrib/bc/karatsuba.py index f8087301f54c..cfab4c4f4fbf 100755 --- a/contrib/bc/karatsuba.py +++ b/contrib/bc/karatsuba.py @@ -121,20 +121,20 @@ else: p = run([ "make", "clean" ]) -print("Testing \"make -j4\"") +print("Testing \"make -j12\"") if p.returncode != 0: print("make returned an error ({}); exiting...".format(p.returncode)) sys.exit(p.returncode) -p = run([ "make", "-j4" ]) +p = run([ "make", "-j12" ]) if p.returncode == 0: - makecmd = [ "make", "-j4" ] - print("Using \"make -j4\"") + makecmd = [ "make", "-j12" ] + print("Using \"make -j12\"") else: makecmd = [ "make" ] - print("Not using \"make -j4\"") + print("Not using \"make -j12\"") if test_num != 0: mx2 = test_num diff --git a/contrib/bc/manuals/bc.1.md.in b/contrib/bc/manuals/bc.1.md.in index 1ce83b8237cd..661fcdd45ae4 100644 --- a/contrib/bc/manuals/bc.1.md.in +++ b/contrib/bc/manuals/bc.1.md.in @@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator # SYNOPSIS -**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] -[*file*...] +**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...] # DESCRIPTION @@ -61,7 +60,7 @@ especially) the GNU bc(1). The following are the options that bc(1) accepts. -**-g**, **--global-stacks** +**-g**, **-\-global-stacks** {{ A H N P HN HP NP HNP }} : Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks. @@ -152,17 +151,17 @@ The following are the options that bc(1) accepts. This is a **non-portable extension**. -**-h**, **--help** +**-h**, **-\-help** : Prints a usage message and quits. -**-i**, **--interactive** +**-i**, **-\-interactive** : Forces interactive mode. (See the **INTERACTIVE MODE** section.) This is a **non-portable extension**. -**-l**, **--mathlib** +**-l**, **-\-mathlib** : Sets **scale** (see the **SYNTAX** section) to **20** and loads the included {{ A H N P HN HP NP HNP }} @@ -178,7 +177,7 @@ The following are the options that bc(1) accepts. To learn what is in the library, see the **LIBRARY** section. {{ end }} -**-P**, **--no-prompt** +**-P**, **-\-no-prompt** {{ A E H N EH EN HN EHN }} : Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode. @@ -193,36 +192,36 @@ The following are the options that bc(1) accepts. This is a **non-portable extension**. -**-q**, **--quiet** +**-q**, **-\-quiet** : This option is for compatibility with the [GNU bc(1)][2]; it is a no-op. Without this option, GNU bc(1) prints a copyright header. This bc(1) only prints the copyright header if one or more of the **-v**, **-V**, or - **--version** options are given. + **-\-version** options are given. This is a **non-portable extension**. -**-s**, **--standard** +**-s**, **-\-standard** : Process exactly the language defined by the [standard][1] and error if any extensions are used. This is a **non-portable extension**. -**-v**, **-V**, **--version** +**-v**, **-V**, **-\-version** : Print the version information (copyright header) and exit. This is a **non-portable extension**. -**-w**, **--warn** +**-w**, **-\-warn** -: Like **-s** and **--standard**, except that warnings (and not errors) are +: Like **-s** and **-\-standard**, except that warnings (and not errors) are printed for non-standard extensions and execution continues normally. This is a **non-portable extension**. -**-e** *expr*, **--expression**=*expr* +**-e** *expr*, **-\-expression**=*expr* : Evaluates *expr*. If multiple expressions are given, they are evaluated in order. If files are given as well (see below), the expressions and files are @@ -232,14 +231,14 @@ The following are the options that bc(1) accepts. If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, see the **ENVIRONMENT VARIABLES** section), then after processing all expressions and files, bc(1) will exit, unless **-** (**stdin**) was given - as an argument at least once to **-f** or **--file**, whether on the + as an argument at least once to **-f** or **-\-file**, whether on the command-line or in **BC_ENV_ARGS**. However, if any other **-e**, - **--expression**, **-f**, or **--file** arguments are given after **-f-** or - equivalent is given, bc(1) will give a fatal error and exit. + **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-** + or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. -**-f** *file*, **--file**=*file* +**-f** *file*, **-\-file**=*file* : Reads in *file* and evaluates it, line by line, as though it were read through **stdin**. If expressions are also given (see above), the @@ -248,8 +247,8 @@ The following are the options that bc(1) accepts. If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, see the **ENVIRONMENT VARIABLES** section), then after processing all expressions and files, bc(1) will exit, unless **-** (**stdin**) was given - as an argument at least once to **-f** or **--file**. However, if any other - **-e**, **--expression**, **-f**, or **--file** arguments are given after + as an argument at least once to **-f** or **-\-file**. However, if any other + **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -304,8 +303,8 @@ Identifiers with more than one character (letter) are a **ibase** is a global variable determining how to interpret constant numbers. It is the "input" base, or the number base used for interpreting input numbers. -**ibase** is initially **10**. If the **-s** (**--standard**) and **-w** -(**--warn**) flags were not given on the command line, the max allowable value +**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w** +(**-\-warn**) flags were not given on the command line, the max allowable value for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for **ibase** is **2**. The max allowable value for **ibase** can be queried in bc(1) programs with the **maxibase()** built-in function. @@ -512,7 +511,7 @@ The following arithmetic and logical operators can be used. They are listed in order of decreasing precedence. Operators in the same group have the same precedence. -**++** **--** +**++** **-\-** : Type: Prefix and Postfix @@ -617,7 +616,7 @@ precedence. The operators will be described in more detail below. -**++** **--** +**++** **-\-** : The prefix and postfix **increment** and **decrement** operators behave exactly like they would in C. They require a named expression (see the @@ -962,12 +961,12 @@ This is a **non-portable extension**. {{ A H N P HN HP NP HNP }} All of the functions below, including the functions in the extended math library (see the *Extended Library* subsection below), are available when the -**-l** or **--mathlib** command-line flags are given, except that the extended +**-l** or **-\-mathlib** command-line flags are given, except that the extended math library is not available when the **-s** option, the **-w** option, or equivalents are given. {{ end }} {{ E EH EN EP EHN EHP ENP EHNP }} -All of the functions below are available when the **-l** or **--mathlib** +All of the functions below are available when the **-l** or **-\-mathlib** command-line flags are given. {{ end }} @@ -1020,8 +1019,8 @@ The [standard][1] defines the following functions for the math library: {{ A H N P HN HP NP HNP }} ## Extended Library -The extended library is *not* loaded when the **-s**/**--standard** or -**-w**/**--warn** options are given since they are not part of the library +The extended library is *not* loaded when the **-s**/**-\-standard** or +**-w**/**-\-warn** options are given since they are not part of the library defined by the [standard][1]. The extended library is a **non-portable extension**. @@ -1705,17 +1704,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode (see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the **RESET** section) and accepts more input when one of those errors occurs in interactive mode. This is also the case when interactive mode is forced by the -**-i** flag or **--interactive** option. +**-i** flag or **-\-interactive** option. These exit statuses allow bc(1) to be used in shell scripting with error checking, and its normal behavior can be forced by using the **-i** flag or -**--interactive** option. +**-\-interactive** option. # INTERACTIVE MODE Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode. Interactive mode is turned on automatically when both **stdin** and **stdout** -are hooked to a terminal, but the **-i** flag and **--interactive** option can +are hooked to a terminal, but the **-i** flag and **-\-interactive** option can turn it on in other cases. In interactive mode, bc(1) attempts to recover from errors (see the **RESET** diff --git a/contrib/bc/manuals/bc/A.1 b/contrib/bc/manuals/bc/A.1 index d1e80769c855..b38d8d35e71b 100644 --- a/contrib/bc/manuals/bc/A.1 +++ b/contrib/bc/manuals/bc/A.1 @@ -25,19 +25,18 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator .SH SYNOPSIS .PP -\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]] -[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]] -[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]] -[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]] -[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]] -[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R] -\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...] +\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]] +[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]] +[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]] +[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]] +[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R] +\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...] [\f[I]file\f[R]\&...] .SH DESCRIPTION .PP @@ -60,7 +59,7 @@ implementations. .PP The following are the options that bc(1) accepts. .TP -\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R] +\f[B]-g\f[R], \f[B]--global-stacks\f[R] Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and \f[B]seed\f[R] into stacks. .RS @@ -152,10 +151,10 @@ is ignored. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-h\f[R], \f[B]\[en]help\f[R] +\f[B]-h\f[R], \f[B]--help\f[R] Prints a usage message and quits. .TP -\f[B]-i\f[R], \f[B]\[en]interactive\f[R] +\f[B]-i\f[R], \f[B]--interactive\f[R] Forces interactive mode. (See the \f[B]INTERACTIVE MODE\f[R] section.) .RS @@ -163,7 +162,7 @@ Forces interactive mode. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-l\f[R], \f[B]\[en]mathlib\f[R] +\f[B]-l\f[R], \f[B]--mathlib\f[R] Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R] and loads the included math library and the extended math library before running any code, including any expressions or files specified on the @@ -173,7 +172,7 @@ command line. To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section. .RE .TP -\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R] +\f[B]-P\f[R], \f[B]--no-prompt\f[R] Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode. See the \f[B]TTY MODE\f[R] section) This is mostly for those users that @@ -185,18 +184,18 @@ Most of those users would want to put this option in This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-q\f[R], \f[B]\[en]quiet\f[R] +\f[B]-q\f[R], \f[B]--quiet\f[R] This option is for compatibility with the GNU bc(1) (https://www.gnu.org/software/bc/); it is a no-op. Without this option, GNU bc(1) prints a copyright header. This bc(1) only prints the copyright header if one or more of the -\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given. +\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given. .RS .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-s\f[R], \f[B]\[en]standard\f[R] +\f[B]-s\f[R], \f[B]--standard\f[R] Process exactly the language defined by the standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and error if any extensions are used. @@ -205,15 +204,15 @@ and error if any extensions are used. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R] +\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R] Print the version information (copyright header) and exit. .RS .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-w\f[R], \f[B]\[en]warn\f[R] -Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and +\f[B]-w\f[R], \f[B]--warn\f[R] +Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and not errors) are printed for non-standard extensions and execution continues normally. .RS @@ -221,7 +220,7 @@ continues normally. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R] +\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R] Evaluates \f[I]expr\f[R]. If multiple expressions are given, they are evaluated in order. If files are given as well (see below), the expressions and files are @@ -234,17 +233,17 @@ If this option is given on the command-line (i.e., not in \f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in \f[B]BC_ENV_ARGS\f[R]. -However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +However, if any other \f[B]-e\f[R], \f[B]--expression\f[R], +\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after \f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and exit. .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R] +\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R] Reads in \f[I]file\f[R] and evaluates it, line by line, as though it were read through \f[B]stdin\f[R]. If expressions are also given (see above), the expressions are evaluated @@ -255,9 +254,9 @@ If this option is given on the command-line (i.e., not in \f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. -However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f\f[R] or \f[B]--file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]--expression\f[R], +\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after \f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and exit. .PP @@ -322,8 +321,8 @@ constant numbers. It is the \[lq]input\[rq] base, or the number base used for interpreting input numbers. \f[B]ibase\f[R] is initially \f[B]10\f[R]. -If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R] -(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max +If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R] +(\f[B]--warn\f[R]) flags were not given on the command line, the max allowable value for \f[B]ibase\f[R] is \f[B]36\f[R]. Otherwise, it is \f[B]16\f[R]. The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R]. @@ -582,7 +581,7 @@ The following arithmetic and logical operators can be used. They are listed in order of decreasing precedence. Operators in the same group have the same precedence. .TP -\f[B]++\f[R] \f[B]\[en]\f[R] +\f[B]++\f[R] \f[B]--\f[R] Type: Prefix and Postfix .RS .PP @@ -692,7 +691,7 @@ Description: \f[B]boolean or\f[R] .PP The operators will be described in more detail below. .TP -\f[B]++\f[R] \f[B]\[en]\f[R] +\f[B]++\f[R] \f[B]--\f[R] The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R] operators behave exactly like they would in C. They require a named expression (see the \f[I]Named Expressions\f[R] @@ -1138,7 +1137,7 @@ This is a \f[B]non-portable extension\f[R]. .PP All of the functions below, including the functions in the extended math library (see the \f[I]Extended Library\f[R] subsection below), are -available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line +available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line flags are given, except that the extended math library is not available when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents are given. @@ -1199,7 +1198,7 @@ Functions\f[R] subsection below). .SS Extended Library .PP The extended library is \f[I]not\f[R] loaded when the -\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R] +\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R] options are given since they are not part of the library defined by the standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html). .PP @@ -1957,11 +1956,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts more input when one of those errors occurs in interactive mode. This is also the case when interactive mode is forced by the -\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option. +\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option. .PP These exit statuses allow bc(1) to be used in shell scripting with error checking, and its normal behavior can be forced by using the -\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option. +\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option. .SH INTERACTIVE MODE .PP Per the @@ -1969,7 +1968,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), bc(1) has an interactive mode and a non-interactive mode. Interactive mode is turned on automatically when both \f[B]stdin\f[R] and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag -and \f[B]\[en]interactive\f[R] option can turn it on in other cases. +and \f[B]--interactive\f[R] option can turn it on in other cases. .PP In interactive mode, bc(1) attempts to recover from errors (see the \f[B]RESET\f[R] section), and in normal execution, flushes diff --git a/contrib/bc/manuals/bc/A.1.md b/contrib/bc/manuals/bc/A.1.md index 0cf7a4a0d70e..04f37c6bb724 100644 --- a/contrib/bc/manuals/bc/A.1.md +++ b/contrib/bc/manuals/bc/A.1.md @@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator # SYNOPSIS -**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] -[*file*...] +**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...] # DESCRIPTION @@ -55,7 +54,7 @@ other implementations. The following are the options that bc(1) accepts. -**-g**, **--global-stacks** +**-g**, **-\-global-stacks** : Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks. @@ -123,17 +122,17 @@ The following are the options that bc(1) accepts. This is a **non-portable extension**. -**-h**, **--help** +**-h**, **-\-help** : Prints a usage message and quits. -**-i**, **--interactive** +**-i**, **-\-interactive** : Forces interactive mode. (See the **INTERACTIVE MODE** section.) This is a **non-portable extension**. -**-l**, **--mathlib** +**-l**, **-\-mathlib** : Sets **scale** (see the **SYNTAX** section) to **20** and loads the included math library and the extended math library before running any code, @@ -141,7 +140,7 @@ The following are the options that bc(1) accepts. To learn what is in the libraries, see the **LIBRARY** section. -**-P**, **--no-prompt** +**-P**, **-\-no-prompt** : Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode. See the **TTY MODE** section) This is mostly for those users that do not @@ -151,36 +150,36 @@ The following are the options that bc(1) accepts. This is a **non-portable extension**. -**-q**, **--quiet** +**-q**, **-\-quiet** : This option is for compatibility with the [GNU bc(1)][2]; it is a no-op. Without this option, GNU bc(1) prints a copyright header. This bc(1) only prints the copyright header if one or more of the **-v**, **-V**, or - **--version** options are given. + **-\-version** options are given. This is a **non-portable extension**. -**-s**, **--standard** +**-s**, **-\-standard** : Process exactly the language defined by the [standard][1] and error if any extensions are used. This is a **non-portable extension**. -**-v**, **-V**, **--version** +**-v**, **-V**, **-\-version** : Print the version information (copyright header) and exit. This is a **non-portable extension**. -**-w**, **--warn** +**-w**, **-\-warn** -: Like **-s** and **--standard**, except that warnings (and not errors) are +: Like **-s** and **-\-standard**, except that warnings (and not errors) are printed for non-standard extensions and execution continues normally. This is a **non-portable extension**. -**-e** *expr*, **--expression**=*expr* +**-e** *expr*, **-\-expression**=*expr* : Evaluates *expr*. If multiple expressions are given, they are evaluated in order. If files are given as well (see below), the expressions and files are @@ -190,14 +189,14 @@ The following are the options that bc(1) accepts. If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, see the **ENVIRONMENT VARIABLES** section), then after processing all expressions and files, bc(1) will exit, unless **-** (**stdin**) was given - as an argument at least once to **-f** or **--file**, whether on the + as an argument at least once to **-f** or **-\-file**, whether on the command-line or in **BC_ENV_ARGS**. However, if any other **-e**, - **--expression**, **-f**, or **--file** arguments are given after **-f-** or - equivalent is given, bc(1) will give a fatal error and exit. + **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-** + or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. -**-f** *file*, **--file**=*file* +**-f** *file*, **-\-file**=*file* : Reads in *file* and evaluates it, line by line, as though it were read through **stdin**. If expressions are also given (see above), the @@ -206,8 +205,8 @@ The following are the options that bc(1) accepts. If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, see the **ENVIRONMENT VARIABLES** section), then after processing all expressions and files, bc(1) will exit, unless **-** (**stdin**) was given - as an argument at least once to **-f** or **--file**. However, if any other - **-e**, **--expression**, **-f**, or **--file** arguments are given after + as an argument at least once to **-f** or **-\-file**. However, if any other + **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -262,8 +261,8 @@ Identifiers with more than one character (letter) are a **ibase** is a global variable determining how to interpret constant numbers. It is the "input" base, or the number base used for interpreting input numbers. -**ibase** is initially **10**. If the **-s** (**--standard**) and **-w** -(**--warn**) flags were not given on the command line, the max allowable value +**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w** +(**-\-warn**) flags were not given on the command line, the max allowable value for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for **ibase** is **2**. The max allowable value for **ibase** can be queried in bc(1) programs with the **maxibase()** built-in function. @@ -453,7 +452,7 @@ The following arithmetic and logical operators can be used. They are listed in order of decreasing precedence. Operators in the same group have the same precedence. -**++** **--** +**++** **-\-** : Type: Prefix and Postfix @@ -551,7 +550,7 @@ precedence. The operators will be described in more detail below. -**++** **--** +**++** **-\-** : The prefix and postfix **increment** and **decrement** operators behave exactly like they would in C. They require a named expression (see the @@ -882,7 +881,7 @@ This is a **non-portable extension**. All of the functions below, including the functions in the extended math library (see the *Extended Library* subsection below), are available when the -**-l** or **--mathlib** command-line flags are given, except that the extended +**-l** or **-\-mathlib** command-line flags are given, except that the extended math library is not available when the **-s** option, the **-w** option, or equivalents are given. @@ -934,8 +933,8 @@ The [standard][1] defines the following functions for the math library: ## Extended Library -The extended library is *not* loaded when the **-s**/**--standard** or -**-w**/**--warn** options are given since they are not part of the library +The extended library is *not* loaded when the **-s**/**-\-standard** or +**-w**/**-\-warn** options are given since they are not part of the library defined by the [standard][1]. The extended library is a **non-portable extension**. @@ -1603,17 +1602,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode (see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the **RESET** section) and accepts more input when one of those errors occurs in interactive mode. This is also the case when interactive mode is forced by the -**-i** flag or **--interactive** option. +**-i** flag or **-\-interactive** option. These exit statuses allow bc(1) to be used in shell scripting with error checking, and its normal behavior can be forced by using the **-i** flag or -**--interactive** option. +**-\-interactive** option. # INTERACTIVE MODE Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode. Interactive mode is turned on automatically when both **stdin** and **stdout** -are hooked to a terminal, but the **-i** flag and **--interactive** option can +are hooked to a terminal, but the **-i** flag and **-\-interactive** option can turn it on in other cases. In interactive mode, bc(1) attempts to recover from errors (see the **RESET** diff --git a/contrib/bc/manuals/bc/E.1 b/contrib/bc/manuals/bc/E.1 index 597cde782788..9023b07c6b87 100644 --- a/contrib/bc/manuals/bc/E.1 +++ b/contrib/bc/manuals/bc/E.1 @@ -25,19 +25,18 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator .SH SYNOPSIS .PP -\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]] -[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]] -[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]] -[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]] -[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]] -[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R] -\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...] +\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]] +[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]] +[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]] +[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]] +[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R] +\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...] [\f[I]file\f[R]\&...] .SH DESCRIPTION .PP @@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including .PP The following are the options that bc(1) accepts. .PP -\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R] +\f[B]-g\f[R], \f[B]--global-stacks\f[R] .IP .nf \f[C] @@ -115,10 +114,10 @@ This is a **non-portable extension**. \f[R] .fi .TP -\f[B]-h\f[R], \f[B]\[en]help\f[R] +\f[B]-h\f[R], \f[B]--help\f[R] Prints a usage message and quits. .TP -\f[B]-i\f[R], \f[B]\[en]interactive\f[R] +\f[B]-i\f[R], \f[B]--interactive\f[R] Forces interactive mode. (See the \f[B]INTERACTIVE MODE\f[R] section.) .RS @@ -126,7 +125,7 @@ Forces interactive mode. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-l\f[R], \f[B]\[en]mathlib\f[R] +\f[B]-l\f[R], \f[B]--mathlib\f[R] Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R] and loads the included math library before running any code, including any expressions or files specified on the command line. @@ -135,7 +134,7 @@ any expressions or files specified on the command line. To learn what is in the library, see the \f[B]LIBRARY\f[R] section. .RE .TP -\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R] +\f[B]-P\f[R], \f[B]--no-prompt\f[R] Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode. See the \f[B]TTY MODE\f[R] section) This is mostly for those users that @@ -147,18 +146,18 @@ Most of those users would want to put this option in This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-q\f[R], \f[B]\[en]quiet\f[R] +\f[B]-q\f[R], \f[B]--quiet\f[R] This option is for compatibility with the GNU bc(1) (https://www.gnu.org/software/bc/); it is a no-op. Without this option, GNU bc(1) prints a copyright header. This bc(1) only prints the copyright header if one or more of the -\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given. +\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given. .RS .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-s\f[R], \f[B]\[en]standard\f[R] +\f[B]-s\f[R], \f[B]--standard\f[R] Process exactly the language defined by the standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and error if any extensions are used. @@ -167,15 +166,15 @@ and error if any extensions are used. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R] +\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R] Print the version information (copyright header) and exit. .RS .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-w\f[R], \f[B]\[en]warn\f[R] -Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and +\f[B]-w\f[R], \f[B]--warn\f[R] +Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and not errors) are printed for non-standard extensions and execution continues normally. .RS @@ -183,7 +182,7 @@ continues normally. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R] +\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R] Evaluates \f[I]expr\f[R]. If multiple expressions are given, they are evaluated in order. If files are given as well (see below), the expressions and files are @@ -196,17 +195,17 @@ If this option is given on the command-line (i.e., not in \f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in \f[B]BC_ENV_ARGS\f[R]. -However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +However, if any other \f[B]-e\f[R], \f[B]--expression\f[R], +\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after \f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and exit. .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R] +\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R] Reads in \f[I]file\f[R] and evaluates it, line by line, as though it were read through \f[B]stdin\f[R]. If expressions are also given (see above), the expressions are evaluated @@ -217,9 +216,9 @@ If this option is given on the command-line (i.e., not in \f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. -However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f\f[R] or \f[B]--file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]--expression\f[R], +\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after \f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and exit. .PP @@ -284,8 +283,8 @@ constant numbers. It is the \[lq]input\[rq] base, or the number base used for interpreting input numbers. \f[B]ibase\f[R] is initially \f[B]10\f[R]. -If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R] -(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max +If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R] *** 11312 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Mar 8 20:43:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5752A557568; Mon, 8 Mar 2021 20:43: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 4DvVg820wVz3jMJ; Mon, 8 Mar 2021 20:43: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 37CCA7A8D; Mon, 8 Mar 2021 20:43: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 128KhmgN093934; Mon, 8 Mar 2021 20:43:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128KhmDL093933; Mon, 8 Mar 2021 20:43:48 GMT (envelope-from git) Date: Mon, 8 Mar 2021 20:43:48 GMT Message-Id: <202103082043.128KhmDL093933@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: 8cc15b0dfc2f - main - x86: tsc: deprioritize TSC on VirtualBox 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: 8cc15b0dfc2f3299662e78f18bd6127f83c14ab4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 20:43:48 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=8cc15b0dfc2f3299662e78f18bd6127f83c14ab4 commit 8cc15b0dfc2f3299662e78f18bd6127f83c14ab4 Author: Kyle Evans AuthorDate: 2021-03-08 20:20:10 +0000 Commit: Kyle Evans CommitDate: 2021-03-08 20:43:06 +0000 x86: tsc: deprioritize TSC on VirtualBox Misbehavior has been observed with TSC under VirtualBox, where threads doing small sleeps (~1 second) may miss their wake up and hang around in a sleep state indefinitely. Switching back to ACPI-fast decidedly fixes it, so stop using TSC on VirtualBox at least for the time being. This partially reverts 84eaf2ccc6aa, applying it only to VirtualBox and increasing the quality to 0. Negative qualities can never be chosen and cannot be chosen with the tunable recently added. If we do not have a timecounter with a higher quality than 0, then TSC does at least leave the system mostly usable. PR: 253087 Reviewed by: emaste, kib MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29132 --- sys/x86/x86/tsc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index de0a1505c2f6..5ffbb64229e9 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -503,6 +503,14 @@ test_tsc(int adj_max_count) if ((!smp_tsc && !tsc_is_invariant)) return (-100); + /* + * Misbehavior of TSC under VirtualBox has been observed. In + * particular, threads doing small (~1 second) sleeps may miss their + * wakeup and hang around in sleep state, causing hangs on shutdown. + */ + if (vm_guest == VM_GUEST_VBOX) + return (0); + size = (mp_maxid + 1) * 3; data = malloc(sizeof(*data) * size * N, M_TEMP, M_WAITOK); adj = 0; From owner-dev-commits-src-all@freebsd.org Mon Mar 8 20:53:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C38B9557E82; Mon, 8 Mar 2021 20:53: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 4DvVsr5BLbz3jmR; Mon, 8 Mar 2021 20:53: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 A4C887CA8; Mon, 8 Mar 2021 20:53: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 128Kr4Tk006931; Mon, 8 Mar 2021 20:53:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128Kr4P0006930; Mon, 8 Mar 2021 20:53:04 GMT (envelope-from git) Date: Mon, 8 Mar 2021 20:53:04 GMT Message-Id: <202103082053.128Kr4P0006930@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: f2f8405cf6b5 - main - if_vtbe: Add missing includes to fix build 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: f2f8405cf6b50a9d91acc02073abf1062d9d34f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 20:53:04 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=f2f8405cf6b50a9d91acc02073abf1062d9d34f4 commit f2f8405cf6b50a9d91acc02073abf1062d9d34f4 Author: Jessica Clarke AuthorDate: 2021-03-08 20:47:29 +0000 Commit: Jessica Clarke CommitDate: 2021-03-08 20:48:48 +0000 if_vtbe: Add missing includes to fix build PR: 254137 Reported by: Mina Galić MFC after: 3 days Fixes: f8bc74e2f4a5 ("tap: add support for virtio-net offloads") --- sys/dev/beri/virtio/network/if_vtbe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/beri/virtio/network/if_vtbe.c b/sys/dev/beri/virtio/network/if_vtbe.c index 69b40588a974..5959b621954b 100644 --- a/sys/dev/beri/virtio/network/if_vtbe.c +++ b/sys/dev/beri/virtio/network/if_vtbe.c @@ -70,6 +70,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include From owner-dev-commits-src-all@freebsd.org Mon Mar 8 21:05:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DC43558782; Mon, 8 Mar 2021 21:05: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 4DvW7c72jyz3lcM; Mon, 8 Mar 2021 21: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 E4ED17A5B; Mon, 8 Mar 2021 21: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 128L50qU021636; Mon, 8 Mar 2021 21: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 128L50Kt021635; Mon, 8 Mar 2021 21:05:00 GMT (envelope-from git) Date: Mon, 8 Mar 2021 21:05:00 GMT Message-Id: <202103082105.128L50Kt021635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: e3394851b5da - stable/13 - if_vtbe: Add missing includes to fix build 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e3394851b5da6ec46e655a4f801cd6cac0840445 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 21:05:01 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=e3394851b5da6ec46e655a4f801cd6cac0840445 commit e3394851b5da6ec46e655a4f801cd6cac0840445 Author: Jessica Clarke AuthorDate: 2021-03-08 20:47:29 +0000 Commit: Jessica Clarke CommitDate: 2021-03-08 21:04:40 +0000 if_vtbe: Add missing includes to fix build PR: 254137 Reported by: Mina Galić Fixes: f8bc74e2f4a5 ("tap: add support for virtio-net offloads") (cherry picked from commit f2f8405cf6b50a9d91acc02073abf1062d9d34f4) --- sys/dev/beri/virtio/network/if_vtbe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/beri/virtio/network/if_vtbe.c b/sys/dev/beri/virtio/network/if_vtbe.c index 69b40588a974..5959b621954b 100644 --- a/sys/dev/beri/virtio/network/if_vtbe.c +++ b/sys/dev/beri/virtio/network/if_vtbe.c @@ -70,6 +70,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include From owner-dev-commits-src-all@freebsd.org Mon Mar 8 21:28:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A680D558D2F; Mon, 8 Mar 2021 21:28: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 4DvWg14HHJz3mnc; Mon, 8 Mar 2021 21:28: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 8194E7DFD; Mon, 8 Mar 2021 21:28: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 128LSjB7047836; Mon, 8 Mar 2021 21:28:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128LSjLj047835; Mon, 8 Mar 2021 21:28:45 GMT (envelope-from git) Date: Mon, 8 Mar 2021 21:28:45 GMT Message-Id: <202103082128.128LSjLj047835@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: 7634919e15f1 - main - Fix 'in6_purgeaddr: err=65, destination address delete failed' message. 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: 7634919e15f1147b6f26d55354be375bc9b198db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 21:28:45 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=7634919e15f1147b6f26d55354be375bc9b198db commit 7634919e15f1147b6f26d55354be375bc9b198db Author: Alexander V. Chernikov AuthorDate: 2021-03-08 20:27:29 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-08 21:28:35 +0000 Fix 'in6_purgeaddr: err=65, destination address delete failed' message. P2P ifa may require 2 routes: one is the loopback route, another is the "prefix" route towards its destination. Current code marks loopback routes existence with IFA_RTSELF and "prefix" p2p routes with IFA_ROUTE. For historic reasons, we fill in ifa_dstaddr for loopback interfaces. To avoid installing the same route twice, we preemptively set IFA_RTSELF when adding "prefix" route for loopback. However, the teardown part doesn't have this hack, so we try to remove the same route twice. Fix this by checking if ifa_dstaddr is different from the ifa_addr and moving this logic into a separate function. Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D29121 MFC after: 3 days --- sys/netinet6/in6.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 4665a21c28fd..02cb9df7da3a 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1294,13 +1294,27 @@ in6_handle_dstaddr_rtrequest(int cmd, struct in6_ifaddr *ia) return (error); } +static bool +ifa_is_p2p(struct in6_ifaddr *ia) +{ + int plen; + + plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ + + if ((plen == 128) && (ia->ia_dstaddr.sin6_family == AF_INET6) && + !IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, &ia->ia_dstaddr.sin6_addr)) + return (true); + + return (false); +} + void in6_purgeaddr(struct ifaddr *ifa) { struct ifnet *ifp = ifa->ifa_ifp; struct in6_ifaddr *ia = (struct in6_ifaddr *) ifa; struct in6_multi_mship *imm; - int plen, error; + int error; if (ifa->ifa_carp) (*carp_detach_p)(ifa, false); @@ -1328,10 +1342,7 @@ in6_purgeaddr(struct ifaddr *ifa) free(imm, M_IP6MADDR); } /* Check if we need to remove p2p route */ - plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ - if (ia->ia_dstaddr.sin6_family != AF_INET6) - plen = 0; - if ((ia->ia_flags & IFA_ROUTE) && plen == 128) { + if ((ia->ia_flags & IFA_ROUTE) && ifa_is_p2p(ia)) { error = in6_handle_dstaddr_rtrequest(RTM_DELETE, ia); if (error != 0) log(LOG_INFO, "%s: err=%d, destination address delete " @@ -1434,7 +1445,7 @@ static int in6_notify_ifa(struct ifnet *ifp, struct in6_ifaddr *ia, struct in6_aliasreq *ifra, int hostIsNew) { - int error = 0, plen, ifacount = 0; + int error = 0, ifacount = 0; struct ifaddr *ifa; struct sockaddr_in6 *pdst; char ip6buf[INET6_ADDRSTRLEN]; @@ -1487,14 +1498,7 @@ in6_notify_ifa(struct ifnet *ifp, struct in6_ifaddr *ia, * XXX: the logic below rejects assigning multiple addresses on a p2p * interface that share the same destination. */ - plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ - if (!(ia->ia_flags & IFA_ROUTE) && plen == 128 && - ia->ia_dstaddr.sin6_family == AF_INET6) { - /* - * Handle the case for ::1 . - */ - if (ifp->if_flags & IFF_LOOPBACK) - ia->ia_flags |= IFA_RTSELF; + if (!(ia->ia_flags & IFA_ROUTE) && ifa_is_p2p(ia)) { error = in6_handle_dstaddr_rtrequest(RTM_ADD, ia); if (error) goto done; From owner-dev-commits-src-all@freebsd.org Mon Mar 8 21:34:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A253559338; Mon, 8 Mar 2021 21:34: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 4DvWnv34g8z3nT2; Mon, 8 Mar 2021 21:34: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 5CCCA10884; Mon, 8 Mar 2021 21:34: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 128LYh58060212; Mon, 8 Mar 2021 21:34:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128LYh6V060211; Mon, 8 Mar 2021 21:34:43 GMT (envelope-from git) Date: Mon, 8 Mar 2021 21:34:43 GMT Message-Id: <202103082134.128LYh6V060211@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: a239b47cc966 - releng/13.0 - if_vtbe: Add missing includes to fix build 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: a239b47cc966165d6f515c9787834abb7742cc95 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 21:34:43 -0000 The branch releng/13.0 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=a239b47cc966165d6f515c9787834abb7742cc95 commit a239b47cc966165d6f515c9787834abb7742cc95 Author: Jessica Clarke AuthorDate: 2021-03-08 20:47:29 +0000 Commit: Jessica Clarke CommitDate: 2021-03-08 21:33:27 +0000 if_vtbe: Add missing includes to fix build PR: 254137 Reported by: Mina Galić Fixes: f8bc74e2f4a5 ("tap: add support for virtio-net offloads") Approved by: re (gjb) (cherry picked from commit f2f8405cf6b50a9d91acc02073abf1062d9d34f4) (cherry picked from commit e3394851b5da6ec46e655a4f801cd6cac0840445) --- sys/dev/beri/virtio/network/if_vtbe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/beri/virtio/network/if_vtbe.c b/sys/dev/beri/virtio/network/if_vtbe.c index 69b40588a974..5959b621954b 100644 --- a/sys/dev/beri/virtio/network/if_vtbe.c +++ b/sys/dev/beri/virtio/network/if_vtbe.c @@ -70,6 +70,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include From owner-dev-commits-src-all@freebsd.org Mon Mar 8 22:47:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E2BE55BD6E; Mon, 8 Mar 2021 22:47: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 4DvYPW29Xqz3tNq; Mon, 8 Mar 2021 22:47: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 38FA311661; Mon, 8 Mar 2021 22:47: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 128MlB3O052704; Mon, 8 Mar 2021 22:47:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128MlBlZ052701; Mon, 8 Mar 2021 22:47:11 GMT (envelope-from git) Date: Mon, 8 Mar 2021 22:47:11 GMT Message-Id: <202103082247.128MlBlZ052701@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Stefan Eßer Subject: git: 456d11526393 - releng/13.0 - Upgrade to version 3.3.0 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 456d115263939751cd7b878ad039001f6a7e3694 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 22:47:11 -0000 The branch releng/13.0 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=456d115263939751cd7b878ad039001f6a7e3694 commit 456d115263939751cd7b878ad039001f6a7e3694 Author: Stefan Eßer AuthorDate: 2021-02-17 21:56:16 +0000 Commit: Stefan Eßer CommitDate: 2021-03-08 22:46:14 +0000 Upgrade to version 3.3.0 This update changes the behavior of "-e" or "-f" in BC_ENV_ARGS: Use of these options on the command line makes bc exit after executing the given commands. These options will not cause bc to exit when passed via the environment (but EOF in STDIN or -e or -f on the command line will make bc exit as before). The same applies to DC_ENV_ARGS with regard to the dc program. (cherry picked from commit 9a995fe186257315e7b3d01e24c55d86bb18fd32) Approved by: re --- contrib/bc/Makefile.in | 2 +- contrib/bc/NEWS.md | 20 ++++++++++++++++++++ contrib/bc/README.md | 2 +- contrib/bc/configure.sh | 7 +------ contrib/bc/include/args.h | 2 +- contrib/bc/include/status.h | 10 +++++++--- contrib/bc/include/vm.h | 1 + contrib/bc/manuals/bc.1.md.in | 23 ++++++++++++++++------- contrib/bc/manuals/bc/A.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/A.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/E.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/E.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EH.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EH.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EHN.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EHN.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EHNP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EHNP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EHP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EHP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EN.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EN.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/ENP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/ENP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/H.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/H.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/HN.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/HN.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/HNP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/HNP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/HP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/HP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/N.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/N.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/NP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/NP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/P.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/P.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bcl.3 | 2 +- contrib/bc/manuals/build.md | 16 ++++++++++++++++ contrib/bc/manuals/dc.1.md.in | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/A.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/A.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/E.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/E.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EH.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EH.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EHN.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EHN.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EHNP.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EHNP.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EHP.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EHP.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EN.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EN.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/ENP.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/ENP.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EP.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EP.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/H.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/H.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/HN.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/HN.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/HNP.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/HNP.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/HP.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/HP.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/N.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/N.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/NP.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/NP.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/P.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/P.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/header_bc.txt | 2 +- contrib/bc/manuals/header_bcl.txt | 2 +- contrib/bc/manuals/header_dc.txt | 2 +- contrib/bc/release.sh | 2 +- contrib/bc/src/args.c | 4 +++- contrib/bc/src/vm.c | 6 +++--- contrib/bc/tests/script.sh | 2 +- 82 files changed, 1262 insertions(+), 502 deletions(-) diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index 8ae982bd99fe..dbb5debd44cc 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.2.6 +VERSION = 3.3.0 SRC = %%SRC%% OBJ = %%OBJ%% diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index 5982defb754c..6a8899200f4a 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,25 @@ # News +## 3.3.0 + +This is a production release that changes one behavior and fixes documentation +bugs. + +The changed behavior is the treatment of `-e` and `-f` when given through +`BC_ENV_ARGS` or `DC_ENV_ARGS`. Now `bc` and `dc` do not exit when those options +(or their equivalents) are given through those environment variables. However, +`bc` and `dc` still exit when they or their equivalents are given on the +command-line. + +## 3.2.7 + +This is a production release that removes a small non-portable shell operation +in `configure.sh`. This problem was only noticed on OpenBSD, not FreeBSD or +Linux. + +Non-OpenBSD users do ***NOT*** need to upgrade, although NetBSD users may also +need to upgrade. + ## 3.2.6 This is a production release that fixes the build on FreeBSD. diff --git a/contrib/bc/README.md b/contrib/bc/README.md index beda88d23f90..2f95e16ed246 100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@ -342,7 +342,7 @@ Folders: [20]: https://git.yzena.com/gavin/bc [21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/ [22]: https://www.deepl.com/translator -[23]: https://svnweb.freebsd.org/base/head/contrib/bc/ +[23]: https://cgit.freebsd.org/src/tree/contrib/bc [24]: https://bugs.freebsd.org/ [25]: https://reviews.freebsd.org/ [26]: ./manuals/bcl.3.md diff --git a/contrib/bc/configure.sh b/contrib/bc/configure.sh index ae1675cde97d..310c26882906 100755 --- a/contrib/bc/configure.sh +++ b/contrib/bc/configure.sh @@ -253,7 +253,7 @@ replace_ext() { _replace_ext_ext1="$2" _replace_ext_ext2="$3" - _replace_ext_result=${_replace_ext_file%.$_replace_ext_ext1}.$_replace_ext_ext2 + _replace_ext_result="${_replace_ext_file%.$_replace_ext_ext1}.$_replace_ext_ext2" printf '%s\n' "$_replace_ext_result" } @@ -1199,17 +1199,12 @@ SRC_TARGETS="" src_files=$(find_src_files $unneeded) -temp_ifs="$IFS" -IFS=$'\n' - for f in $src_files; do o=$(replace_ext "$f" "c" "o") SRC_TARGETS=$(printf '%s\n\n%s: %s %s\n\t$(CC) $(CFLAGS) -o %s -c %s\n' \ "$SRC_TARGETS" "$o" "$headers" "$f" "$o" "$f") done -IFS="$temp_ifs" - contents=$(replace "$contents" "HEADERS" "$headers") contents=$(replace "$contents" "BC_ENABLED" "$bc") diff --git a/contrib/bc/include/args.h b/contrib/bc/include/args.h index 6b68ed300440..d53785067237 100644 --- a/contrib/bc/include/args.h +++ b/contrib/bc/include/args.h @@ -39,7 +39,7 @@ #include #include -void bc_args(int argc, char *argv[]); +void bc_args(int argc, char *argv[], bool exit_exprs); extern const char* const bc_args_env_name; diff --git a/contrib/bc/include/status.h b/contrib/bc/include/status.h index 3fa844485690..cf41a3ce4670 100644 --- a/contrib/bc/include/status.h +++ b/contrib/bc/include/status.h @@ -176,11 +176,15 @@ typedef enum BcErr { #endif // __STDC_VERSION__ #if defined(__clang__) || defined(__GNUC__) -#if defined(__has_attribute) && __has_attribute(fallthrough) +#if defined(__has_attribute) +#if __has_attribute(fallthrough) #define BC_FALLTHROUGH __attribute__((fallthrough)); -#else // defined(__has_attribute) && __has_attribute(fallthrough) +#else // __has_attribute(fallthrough) #define BC_FALLTHROUGH -#endif // defined(__has_attribute) && __has_attribute(fallthrough) +#endif // __has_attribute(fallthrough) +#else // defined(__has_attribute) +#define BC_FALLTHROUGH +#endif // defined(__has_attribute) #else // defined(__clang__) || defined(__GNUC__) #define BC_FALLTHROUGH #endif // defined(__clang__) || defined(__GNUC__) diff --git a/contrib/bc/include/vm.h b/contrib/bc/include/vm.h index 8b0babff4d81..80a060edd42f 100644 --- a/contrib/bc/include/vm.h +++ b/contrib/bc/include/vm.h @@ -356,6 +356,7 @@ typedef struct BcVm { uint16_t line_len; bool no_exit_exprs; + bool exit_exprs; bool eof; #endif // !BC_ENABLE_LIBRARY diff --git a/contrib/bc/manuals/bc.1.md.in b/contrib/bc/manuals/bc.1.md.in index 624ea3fb54ab..1ce83b8237cd 100644 --- a/contrib/bc/manuals/bc.1.md.in +++ b/contrib/bc/manuals/bc.1.md.in @@ -229,10 +229,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -242,8 +245,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -251,7 +258,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/A.1 b/contrib/bc/manuals/bc/A.1 index da35e8c7eaee..d1e80769c855 100644 --- a/contrib/bc/manuals/bc/A.1 +++ b/contrib/bc/manuals/bc/A.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -230,12 +230,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -247,9 +251,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -258,6 +268,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/A.1.md b/contrib/bc/manuals/bc/A.1.md index 293a21ad0259..0cf7a4a0d70e 100644 --- a/contrib/bc/manuals/bc/A.1.md +++ b/contrib/bc/manuals/bc/A.1.md @@ -187,10 +187,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -200,8 +203,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -209,7 +216,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/E.1 b/contrib/bc/manuals/bc/E.1 index 02a56e6c653c..597cde782788 100644 --- a/contrib/bc/manuals/bc/E.1 +++ b/contrib/bc/manuals/bc/E.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -192,12 +192,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -209,9 +213,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -220,6 +230,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/E.1.md b/contrib/bc/manuals/bc/E.1.md index 7cbc1a56548a..864cf32068bf 100644 --- a/contrib/bc/manuals/bc/E.1.md +++ b/contrib/bc/manuals/bc/E.1.md @@ -171,10 +171,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -184,8 +187,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -193,7 +200,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/EH.1 b/contrib/bc/manuals/bc/EH.1 index 8cb2a3bc8335..dca77a99162e 100644 --- a/contrib/bc/manuals/bc/EH.1 +++ b/contrib/bc/manuals/bc/EH.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -189,12 +189,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -206,9 +210,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -217,6 +227,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/EH.1.md b/contrib/bc/manuals/bc/EH.1.md index 351882878cd3..c1e324ab6ebc 100644 --- a/contrib/bc/manuals/bc/EH.1.md +++ b/contrib/bc/manuals/bc/EH.1.md @@ -168,10 +168,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -181,8 +184,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -190,7 +197,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/EHN.1 b/contrib/bc/manuals/bc/EHN.1 index f751f9d31beb..6b208ade85fd 100644 --- a/contrib/bc/manuals/bc/EHN.1 +++ b/contrib/bc/manuals/bc/EHN.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -189,12 +189,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -206,9 +210,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -217,6 +227,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/EHN.1.md b/contrib/bc/manuals/bc/EHN.1.md index dfe1c401970f..4ee01a4bbcc8 100644 --- a/contrib/bc/manuals/bc/EHN.1.md +++ b/contrib/bc/manuals/bc/EHN.1.md @@ -168,10 +168,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -181,8 +184,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -190,7 +197,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/EHNP.1 b/contrib/bc/manuals/bc/EHNP.1 index e25cd1a7da42..7bd46f38e104 100644 --- a/contrib/bc/manuals/bc/EHNP.1 +++ b/contrib/bc/manuals/bc/EHNP.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -184,12 +184,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -201,9 +205,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -212,6 +222,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/EHNP.1.md b/contrib/bc/manuals/bc/EHNP.1.md index e55673769736..8aca89e6f7b0 100644 --- a/contrib/bc/manuals/bc/EHNP.1.md +++ b/contrib/bc/manuals/bc/EHNP.1.md @@ -164,10 +164,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -177,8 +180,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -186,7 +193,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/EHP.1 b/contrib/bc/manuals/bc/EHP.1 index 7f35d1a1be7f..31c02f1b9591 100644 --- a/contrib/bc/manuals/bc/EHP.1 +++ b/contrib/bc/manuals/bc/EHP.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -184,12 +184,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -201,9 +205,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -212,6 +222,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/EHP.1.md b/contrib/bc/manuals/bc/EHP.1.md index 11050003420f..2c9ab3909dd6 100644 --- a/contrib/bc/manuals/bc/EHP.1.md +++ b/contrib/bc/manuals/bc/EHP.1.md @@ -164,10 +164,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -177,8 +180,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -186,7 +193,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/EN.1 b/contrib/bc/manuals/bc/EN.1 index c8e3a327b2f8..faa6bf488e28 100644 --- a/contrib/bc/manuals/bc/EN.1 +++ b/contrib/bc/manuals/bc/EN.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -192,12 +192,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -209,9 +213,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), *** 3438 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Mar 8 22:47:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 920E555BA29; Mon, 8 Mar 2021 22:47: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 4DvYPX3g3Mz3tRG; Mon, 8 Mar 2021 22:47: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 708BC111C3; Mon, 8 Mar 2021 22:47: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 128MlCqc052725; Mon, 8 Mar 2021 22:47:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128MlCJw052724; Mon, 8 Mar 2021 22:47:12 GMT (envelope-from git) Date: Mon, 8 Mar 2021 22:47:12 GMT Message-Id: <202103082247.128MlCJw052724@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Stefan Eßer Subject: git: 02a8fe639a43 - releng/13.0 - bc: Vendor import new version 3.3.3 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 02a8fe639a43de7717bc55a8da9851d20f33b2bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 22:47:12 -0000 The branch releng/13.0 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=02a8fe639a43de7717bc55a8da9851d20f33b2bc commit 02a8fe639a43de7717bc55a8da9851d20f33b2bc Author: Stefan Eßer AuthorDate: 2021-03-05 10:30:11 +0000 Commit: Stefan Eßer CommitDate: 2021-03-08 22:46:47 +0000 bc: Vendor import new version 3.3.3 (cherry picked from commit 028616d0dd69a3da7a30cb94d35f040bf2ced6b9) Make length(0) and length(0.0) return 1 for compatibility with GNU bc and the traditional FreeBSD bc. Fix a potential division by zero error in a non-standard (extended) math library function. (cherry picked from commit f165641df4da1752f8bb1f55c1e602cdb657fba4) Approved by: re --- contrib/bc/Makefile.in | 2 +- contrib/bc/NEWS.md | 26 +++++++ contrib/bc/gen/lib2.bc | 2 +- contrib/bc/karatsuba.py | 10 +-- contrib/bc/manuals/bc.1.md.in | 61 ++++++++-------- contrib/bc/manuals/bc/A.1 | 71 +++++++++--------- contrib/bc/manuals/bc/A.1.md | 59 ++++++++------- contrib/bc/manuals/bc/E.1 | 69 +++++++++--------- contrib/bc/manuals/bc/E.1.md | 55 +++++++------- contrib/bc/manuals/bc/EH.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EH.1.md | 55 +++++++------- contrib/bc/manuals/bc/EHN.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EHN.1.md | 55 +++++++------- contrib/bc/manuals/bc/EHNP.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EHNP.1.md | 55 +++++++------- contrib/bc/manuals/bc/EHP.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EHP.1.md | 55 +++++++------- contrib/bc/manuals/bc/EN.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EN.1.md | 55 +++++++------- contrib/bc/manuals/bc/ENP.1 | 69 +++++++++--------- contrib/bc/manuals/bc/ENP.1.md | 55 +++++++------- contrib/bc/manuals/bc/EP.1 | 69 +++++++++--------- contrib/bc/manuals/bc/EP.1.md | 55 +++++++------- contrib/bc/manuals/bc/H.1 | 71 +++++++++--------- contrib/bc/manuals/bc/H.1.md | 59 ++++++++------- contrib/bc/manuals/bc/HN.1 | 71 +++++++++--------- contrib/bc/manuals/bc/HN.1.md | 59 ++++++++------- contrib/bc/manuals/bc/HNP.1 | 71 +++++++++--------- contrib/bc/manuals/bc/HNP.1.md | 59 ++++++++------- contrib/bc/manuals/bc/HP.1 | 71 +++++++++--------- contrib/bc/manuals/bc/HP.1.md | 59 ++++++++------- contrib/bc/manuals/bc/N.1 | 71 +++++++++--------- contrib/bc/manuals/bc/N.1.md | 59 ++++++++------- contrib/bc/manuals/bc/NP.1 | 71 +++++++++--------- contrib/bc/manuals/bc/NP.1.md | 59 ++++++++------- contrib/bc/manuals/bc/P.1 | 71 +++++++++--------- contrib/bc/manuals/bc/P.1.md | 59 ++++++++------- contrib/bc/manuals/bcl.3 | 2 +- contrib/bc/manuals/bcl.3.md | 76 +++++++++---------- contrib/bc/manuals/dc.1.md.in | 38 +++++----- contrib/bc/manuals/dc/A.1 | 53 +++++++------- contrib/bc/manuals/dc/A.1.md | 38 +++++----- contrib/bc/manuals/dc/E.1 | 53 +++++++------- contrib/bc/manuals/dc/E.1.md | 38 +++++----- contrib/bc/manuals/dc/EH.1 | 53 +++++++------- contrib/bc/manuals/dc/EH.1.md | 38 +++++----- contrib/bc/manuals/dc/EHN.1 | 53 +++++++------- contrib/bc/manuals/dc/EHN.1.md | 38 +++++----- contrib/bc/manuals/dc/EHNP.1 | 53 +++++++------- contrib/bc/manuals/dc/EHNP.1.md | 38 +++++----- contrib/bc/manuals/dc/EHP.1 | 53 +++++++------- contrib/bc/manuals/dc/EHP.1.md | 38 +++++----- contrib/bc/manuals/dc/EN.1 | 53 +++++++------- contrib/bc/manuals/dc/EN.1.md | 38 +++++----- contrib/bc/manuals/dc/ENP.1 | 53 +++++++------- contrib/bc/manuals/dc/ENP.1.md | 38 +++++----- contrib/bc/manuals/dc/EP.1 | 53 +++++++------- contrib/bc/manuals/dc/EP.1.md | 38 +++++----- contrib/bc/manuals/dc/H.1 | 53 +++++++------- contrib/bc/manuals/dc/H.1.md | 38 +++++----- contrib/bc/manuals/dc/HN.1 | 53 +++++++------- contrib/bc/manuals/dc/HN.1.md | 38 +++++----- contrib/bc/manuals/dc/HNP.1 | 53 +++++++------- contrib/bc/manuals/dc/HNP.1.md | 38 +++++----- contrib/bc/manuals/dc/HP.1 | 53 +++++++------- contrib/bc/manuals/dc/HP.1.md | 38 +++++----- contrib/bc/manuals/dc/N.1 | 53 +++++++------- contrib/bc/manuals/dc/N.1.md | 38 +++++----- contrib/bc/manuals/dc/NP.1 | 53 +++++++------- contrib/bc/manuals/dc/NP.1.md | 38 +++++----- contrib/bc/manuals/dc/P.1 | 53 +++++++------- contrib/bc/manuals/dc/P.1.md | 38 +++++----- contrib/bc/manuals/header_bc.txt | 2 +- contrib/bc/manuals/header_bcl.txt | 2 +- contrib/bc/manuals/header_dc.txt | 2 +- contrib/bc/src/num.c | 2 +- contrib/bc/tests/bc/length.txt | 3 + contrib/bc/tests/bc/length_results.txt | 5 +- contrib/bc/tests/bc/lib2.txt | 6 ++ contrib/bc/tests/bc/lib2_results.txt | 6 ++ contrib/bc/tests/bc/scripts/bessel.bc | 9 ++- contrib/bc/tests/dc/all.txt | 1 + contrib/bc/tests/dc/length.txt | 129 +++++++++++++++++++++++++++++++++ contrib/bc/tests/dc/length_results.txt | 129 +++++++++++++++++++++++++++++++++ 84 files changed, 2130 insertions(+), 1871 deletions(-) diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index dbb5debd44cc..db8e24967996 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.3.0 +VERSION = 3.3.3 SRC = %%SRC%% OBJ = %%OBJ%% diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index 6a8899200f4a..3a3433077d50 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,31 @@ # News +## 3.3.3 + +This is a production release with one tweak and fixes for manuals. + +The tweak is that `length(0)` returns `1` instead of `0`. In `3.3.1`, I changed +it so `length(0.x)`, where `x` could be any number of digits, returned the +`scale`, but `length(0)` still returned `0` because I believe that `0` has `0` +significant digits. + +After request of FreeBSD and considering the arguments of a mathematician, +compatibility with other `bc`'s, and the expectations of users, I decided to +make the change. + +The fixes for manuals fixed a bug where `--` was rendered as `-`. + +## 3.3.2 + +This is a production release that fixes a divide-by-zero bug in `root()` in the +[extended math library][16]. All previous versions with `root()` have the bug. + +## 3.3.1 + +This is a production release that fixes a bug. + +The bug was in the reporting of number length when the value was 0. + ## 3.3.0 This is a production release that changes one behavior and fixes documentation diff --git a/contrib/bc/gen/lib2.bc b/contrib/bc/gen/lib2.bc index b0e651eddcbd..399c7ad3d313 100644 --- a/contrib/bc/gen/lib2.bc +++ b/contrib/bc/gen/lib2.bc @@ -110,7 +110,7 @@ define root(x,n){ if(n<0)sqrt(n) n=n$ if(n==0)x/n - if(n==1)return x + if(x==0||n==1)return x if(n==2)return sqrt(x) s=scale scale=0 diff --git a/contrib/bc/karatsuba.py b/contrib/bc/karatsuba.py index f8087301f54c..cfab4c4f4fbf 100755 --- a/contrib/bc/karatsuba.py +++ b/contrib/bc/karatsuba.py @@ -121,20 +121,20 @@ else: p = run([ "make", "clean" ]) -print("Testing \"make -j4\"") +print("Testing \"make -j12\"") if p.returncode != 0: print("make returned an error ({}); exiting...".format(p.returncode)) sys.exit(p.returncode) -p = run([ "make", "-j4" ]) +p = run([ "make", "-j12" ]) if p.returncode == 0: - makecmd = [ "make", "-j4" ] - print("Using \"make -j4\"") + makecmd = [ "make", "-j12" ] + print("Using \"make -j12\"") else: makecmd = [ "make" ] - print("Not using \"make -j4\"") + print("Not using \"make -j12\"") if test_num != 0: mx2 = test_num diff --git a/contrib/bc/manuals/bc.1.md.in b/contrib/bc/manuals/bc.1.md.in index 1ce83b8237cd..661fcdd45ae4 100644 --- a/contrib/bc/manuals/bc.1.md.in +++ b/contrib/bc/manuals/bc.1.md.in @@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator # SYNOPSIS -**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] -[*file*...] +**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...] # DESCRIPTION @@ -61,7 +60,7 @@ especially) the GNU bc(1). The following are the options that bc(1) accepts. -**-g**, **--global-stacks** +**-g**, **-\-global-stacks** {{ A H N P HN HP NP HNP }} : Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks. @@ -152,17 +151,17 @@ The following are the options that bc(1) accepts. This is a **non-portable extension**. -**-h**, **--help** +**-h**, **-\-help** : Prints a usage message and quits. -**-i**, **--interactive** +**-i**, **-\-interactive** : Forces interactive mode. (See the **INTERACTIVE MODE** section.) This is a **non-portable extension**. -**-l**, **--mathlib** +**-l**, **-\-mathlib** : Sets **scale** (see the **SYNTAX** section) to **20** and loads the included {{ A H N P HN HP NP HNP }} @@ -178,7 +177,7 @@ The following are the options that bc(1) accepts. To learn what is in the library, see the **LIBRARY** section. {{ end }} -**-P**, **--no-prompt** +**-P**, **-\-no-prompt** {{ A E H N EH EN HN EHN }} : Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode. @@ -193,36 +192,36 @@ The following are the options that bc(1) accepts. This is a **non-portable extension**. -**-q**, **--quiet** +**-q**, **-\-quiet** : This option is for compatibility with the [GNU bc(1)][2]; it is a no-op. Without this option, GNU bc(1) prints a copyright header. This bc(1) only prints the copyright header if one or more of the **-v**, **-V**, or - **--version** options are given. + **-\-version** options are given. This is a **non-portable extension**. -**-s**, **--standard** +**-s**, **-\-standard** : Process exactly the language defined by the [standard][1] and error if any extensions are used. This is a **non-portable extension**. -**-v**, **-V**, **--version** +**-v**, **-V**, **-\-version** : Print the version information (copyright header) and exit. This is a **non-portable extension**. -**-w**, **--warn** +**-w**, **-\-warn** -: Like **-s** and **--standard**, except that warnings (and not errors) are +: Like **-s** and **-\-standard**, except that warnings (and not errors) are printed for non-standard extensions and execution continues normally. This is a **non-portable extension**. -**-e** *expr*, **--expression**=*expr* +**-e** *expr*, **-\-expression**=*expr* : Evaluates *expr*. If multiple expressions are given, they are evaluated in order. If files are given as well (see below), the expressions and files are @@ -232,14 +231,14 @@ The following are the options that bc(1) accepts. If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, see the **ENVIRONMENT VARIABLES** section), then after processing all expressions and files, bc(1) will exit, unless **-** (**stdin**) was given - as an argument at least once to **-f** or **--file**, whether on the + as an argument at least once to **-f** or **-\-file**, whether on the command-line or in **BC_ENV_ARGS**. However, if any other **-e**, - **--expression**, **-f**, or **--file** arguments are given after **-f-** or - equivalent is given, bc(1) will give a fatal error and exit. + **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-** + or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. -**-f** *file*, **--file**=*file* +**-f** *file*, **-\-file**=*file* : Reads in *file* and evaluates it, line by line, as though it were read through **stdin**. If expressions are also given (see above), the @@ -248,8 +247,8 @@ The following are the options that bc(1) accepts. If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, see the **ENVIRONMENT VARIABLES** section), then after processing all expressions and files, bc(1) will exit, unless **-** (**stdin**) was given - as an argument at least once to **-f** or **--file**. However, if any other - **-e**, **--expression**, **-f**, or **--file** arguments are given after + as an argument at least once to **-f** or **-\-file**. However, if any other + **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -304,8 +303,8 @@ Identifiers with more than one character (letter) are a **ibase** is a global variable determining how to interpret constant numbers. It is the "input" base, or the number base used for interpreting input numbers. -**ibase** is initially **10**. If the **-s** (**--standard**) and **-w** -(**--warn**) flags were not given on the command line, the max allowable value +**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w** +(**-\-warn**) flags were not given on the command line, the max allowable value for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for **ibase** is **2**. The max allowable value for **ibase** can be queried in bc(1) programs with the **maxibase()** built-in function. @@ -512,7 +511,7 @@ The following arithmetic and logical operators can be used. They are listed in order of decreasing precedence. Operators in the same group have the same precedence. -**++** **--** +**++** **-\-** : Type: Prefix and Postfix @@ -617,7 +616,7 @@ precedence. The operators will be described in more detail below. -**++** **--** +**++** **-\-** : The prefix and postfix **increment** and **decrement** operators behave exactly like they would in C. They require a named expression (see the @@ -962,12 +961,12 @@ This is a **non-portable extension**. {{ A H N P HN HP NP HNP }} All of the functions below, including the functions in the extended math library (see the *Extended Library* subsection below), are available when the -**-l** or **--mathlib** command-line flags are given, except that the extended +**-l** or **-\-mathlib** command-line flags are given, except that the extended math library is not available when the **-s** option, the **-w** option, or equivalents are given. {{ end }} {{ E EH EN EP EHN EHP ENP EHNP }} -All of the functions below are available when the **-l** or **--mathlib** +All of the functions below are available when the **-l** or **-\-mathlib** command-line flags are given. {{ end }} @@ -1020,8 +1019,8 @@ The [standard][1] defines the following functions for the math library: {{ A H N P HN HP NP HNP }} ## Extended Library -The extended library is *not* loaded when the **-s**/**--standard** or -**-w**/**--warn** options are given since they are not part of the library +The extended library is *not* loaded when the **-s**/**-\-standard** or +**-w**/**-\-warn** options are given since they are not part of the library defined by the [standard][1]. The extended library is a **non-portable extension**. @@ -1705,17 +1704,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode (see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the **RESET** section) and accepts more input when one of those errors occurs in interactive mode. This is also the case when interactive mode is forced by the -**-i** flag or **--interactive** option. +**-i** flag or **-\-interactive** option. These exit statuses allow bc(1) to be used in shell scripting with error checking, and its normal behavior can be forced by using the **-i** flag or -**--interactive** option. +**-\-interactive** option. # INTERACTIVE MODE Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode. Interactive mode is turned on automatically when both **stdin** and **stdout** -are hooked to a terminal, but the **-i** flag and **--interactive** option can +are hooked to a terminal, but the **-i** flag and **-\-interactive** option can turn it on in other cases. In interactive mode, bc(1) attempts to recover from errors (see the **RESET** diff --git a/contrib/bc/manuals/bc/A.1 b/contrib/bc/manuals/bc/A.1 index d1e80769c855..b38d8d35e71b 100644 --- a/contrib/bc/manuals/bc/A.1 +++ b/contrib/bc/manuals/bc/A.1 @@ -25,19 +25,18 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator .SH SYNOPSIS .PP -\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]] -[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]] -[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]] -[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]] -[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]] -[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R] -\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...] +\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]] +[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]] +[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]] +[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]] +[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R] +\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...] [\f[I]file\f[R]\&...] .SH DESCRIPTION .PP @@ -60,7 +59,7 @@ implementations. .PP The following are the options that bc(1) accepts. .TP -\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R] +\f[B]-g\f[R], \f[B]--global-stacks\f[R] Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and \f[B]seed\f[R] into stacks. .RS @@ -152,10 +151,10 @@ is ignored. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-h\f[R], \f[B]\[en]help\f[R] +\f[B]-h\f[R], \f[B]--help\f[R] Prints a usage message and quits. .TP -\f[B]-i\f[R], \f[B]\[en]interactive\f[R] +\f[B]-i\f[R], \f[B]--interactive\f[R] Forces interactive mode. (See the \f[B]INTERACTIVE MODE\f[R] section.) .RS @@ -163,7 +162,7 @@ Forces interactive mode. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-l\f[R], \f[B]\[en]mathlib\f[R] +\f[B]-l\f[R], \f[B]--mathlib\f[R] Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R] and loads the included math library and the extended math library before running any code, including any expressions or files specified on the @@ -173,7 +172,7 @@ command line. To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section. .RE .TP -\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R] +\f[B]-P\f[R], \f[B]--no-prompt\f[R] Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode. See the \f[B]TTY MODE\f[R] section) This is mostly for those users that @@ -185,18 +184,18 @@ Most of those users would want to put this option in This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-q\f[R], \f[B]\[en]quiet\f[R] +\f[B]-q\f[R], \f[B]--quiet\f[R] This option is for compatibility with the GNU bc(1) (https://www.gnu.org/software/bc/); it is a no-op. Without this option, GNU bc(1) prints a copyright header. This bc(1) only prints the copyright header if one or more of the -\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given. +\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given. .RS .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-s\f[R], \f[B]\[en]standard\f[R] +\f[B]-s\f[R], \f[B]--standard\f[R] Process exactly the language defined by the standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and error if any extensions are used. @@ -205,15 +204,15 @@ and error if any extensions are used. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R] +\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R] Print the version information (copyright header) and exit. .RS .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-w\f[R], \f[B]\[en]warn\f[R] -Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and +\f[B]-w\f[R], \f[B]--warn\f[R] +Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and not errors) are printed for non-standard extensions and execution continues normally. .RS @@ -221,7 +220,7 @@ continues normally. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R] +\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R] Evaluates \f[I]expr\f[R]. If multiple expressions are given, they are evaluated in order. If files are given as well (see below), the expressions and files are @@ -234,17 +233,17 @@ If this option is given on the command-line (i.e., not in \f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in \f[B]BC_ENV_ARGS\f[R]. -However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +However, if any other \f[B]-e\f[R], \f[B]--expression\f[R], +\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after \f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and exit. .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R] +\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R] Reads in \f[I]file\f[R] and evaluates it, line by line, as though it were read through \f[B]stdin\f[R]. If expressions are also given (see above), the expressions are evaluated @@ -255,9 +254,9 @@ If this option is given on the command-line (i.e., not in \f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. -However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f\f[R] or \f[B]--file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]--expression\f[R], +\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after \f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and exit. .PP @@ -322,8 +321,8 @@ constant numbers. It is the \[lq]input\[rq] base, or the number base used for interpreting input numbers. \f[B]ibase\f[R] is initially \f[B]10\f[R]. -If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R] -(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max +If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R] +(\f[B]--warn\f[R]) flags were not given on the command line, the max allowable value for \f[B]ibase\f[R] is \f[B]36\f[R]. Otherwise, it is \f[B]16\f[R]. The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R]. @@ -582,7 +581,7 @@ The following arithmetic and logical operators can be used. They are listed in order of decreasing precedence. Operators in the same group have the same precedence. .TP -\f[B]++\f[R] \f[B]\[en]\f[R] +\f[B]++\f[R] \f[B]--\f[R] Type: Prefix and Postfix .RS .PP @@ -692,7 +691,7 @@ Description: \f[B]boolean or\f[R] .PP The operators will be described in more detail below. .TP -\f[B]++\f[R] \f[B]\[en]\f[R] +\f[B]++\f[R] \f[B]--\f[R] The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R] operators behave exactly like they would in C. They require a named expression (see the \f[I]Named Expressions\f[R] @@ -1138,7 +1137,7 @@ This is a \f[B]non-portable extension\f[R]. .PP All of the functions below, including the functions in the extended math library (see the \f[I]Extended Library\f[R] subsection below), are -available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line +available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line flags are given, except that the extended math library is not available when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents are given. @@ -1199,7 +1198,7 @@ Functions\f[R] subsection below). .SS Extended Library .PP The extended library is \f[I]not\f[R] loaded when the -\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R] +\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R] options are given since they are not part of the library defined by the standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html). .PP @@ -1957,11 +1956,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts more input when one of those errors occurs in interactive mode. This is also the case when interactive mode is forced by the -\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option. +\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option. .PP These exit statuses allow bc(1) to be used in shell scripting with error checking, and its normal behavior can be forced by using the -\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option. +\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option. .SH INTERACTIVE MODE .PP Per the @@ -1969,7 +1968,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), bc(1) has an interactive mode and a non-interactive mode. Interactive mode is turned on automatically when both \f[B]stdin\f[R] and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag -and \f[B]\[en]interactive\f[R] option can turn it on in other cases. +and \f[B]--interactive\f[R] option can turn it on in other cases. .PP In interactive mode, bc(1) attempts to recover from errors (see the \f[B]RESET\f[R] section), and in normal execution, flushes diff --git a/contrib/bc/manuals/bc/A.1.md b/contrib/bc/manuals/bc/A.1.md index 0cf7a4a0d70e..04f37c6bb724 100644 --- a/contrib/bc/manuals/bc/A.1.md +++ b/contrib/bc/manuals/bc/A.1.md @@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator # SYNOPSIS -**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] -[*file*...] +**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...] # DESCRIPTION @@ -55,7 +54,7 @@ other implementations. The following are the options that bc(1) accepts. -**-g**, **--global-stacks** +**-g**, **-\-global-stacks** : Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks. @@ -123,17 +122,17 @@ The following are the options that bc(1) accepts. This is a **non-portable extension**. -**-h**, **--help** +**-h**, **-\-help** : Prints a usage message and quits. -**-i**, **--interactive** +**-i**, **-\-interactive** : Forces interactive mode. (See the **INTERACTIVE MODE** section.) This is a **non-portable extension**. -**-l**, **--mathlib** +**-l**, **-\-mathlib** : Sets **scale** (see the **SYNTAX** section) to **20** and loads the included math library and the extended math library before running any code, @@ -141,7 +140,7 @@ The following are the options that bc(1) accepts. To learn what is in the libraries, see the **LIBRARY** section. -**-P**, **--no-prompt** +**-P**, **-\-no-prompt** : Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode. See the **TTY MODE** section) This is mostly for those users that do not @@ -151,36 +150,36 @@ The following are the options that bc(1) accepts. This is a **non-portable extension**. -**-q**, **--quiet** +**-q**, **-\-quiet** : This option is for compatibility with the [GNU bc(1)][2]; it is a no-op. Without this option, GNU bc(1) prints a copyright header. This bc(1) only prints the copyright header if one or more of the **-v**, **-V**, or - **--version** options are given. + **-\-version** options are given. This is a **non-portable extension**. -**-s**, **--standard** +**-s**, **-\-standard** : Process exactly the language defined by the [standard][1] and error if any extensions are used. This is a **non-portable extension**. -**-v**, **-V**, **--version** +**-v**, **-V**, **-\-version** : Print the version information (copyright header) and exit. This is a **non-portable extension**. -**-w**, **--warn** +**-w**, **-\-warn** -: Like **-s** and **--standard**, except that warnings (and not errors) are +: Like **-s** and **-\-standard**, except that warnings (and not errors) are printed for non-standard extensions and execution continues normally. This is a **non-portable extension**. -**-e** *expr*, **--expression**=*expr* +**-e** *expr*, **-\-expression**=*expr* : Evaluates *expr*. If multiple expressions are given, they are evaluated in order. If files are given as well (see below), the expressions and files are @@ -190,14 +189,14 @@ The following are the options that bc(1) accepts. If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, see the **ENVIRONMENT VARIABLES** section), then after processing all expressions and files, bc(1) will exit, unless **-** (**stdin**) was given - as an argument at least once to **-f** or **--file**, whether on the + as an argument at least once to **-f** or **-\-file**, whether on the command-line or in **BC_ENV_ARGS**. However, if any other **-e**, - **--expression**, **-f**, or **--file** arguments are given after **-f-** or - equivalent is given, bc(1) will give a fatal error and exit. + **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-** + or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. -**-f** *file*, **--file**=*file* +**-f** *file*, **-\-file**=*file* : Reads in *file* and evaluates it, line by line, as though it were read through **stdin**. If expressions are also given (see above), the @@ -206,8 +205,8 @@ The following are the options that bc(1) accepts. If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, see the **ENVIRONMENT VARIABLES** section), then after processing all expressions and files, bc(1) will exit, unless **-** (**stdin**) was given - as an argument at least once to **-f** or **--file**. However, if any other - **-e**, **--expression**, **-f**, or **--file** arguments are given after + as an argument at least once to **-f** or **-\-file**. However, if any other + **-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -262,8 +261,8 @@ Identifiers with more than one character (letter) are a **ibase** is a global variable determining how to interpret constant numbers. It is the "input" base, or the number base used for interpreting input numbers. -**ibase** is initially **10**. If the **-s** (**--standard**) and **-w** -(**--warn**) flags were not given on the command line, the max allowable value +**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w** +(**-\-warn**) flags were not given on the command line, the max allowable value for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for **ibase** is **2**. The max allowable value for **ibase** can be queried in bc(1) programs with the **maxibase()** built-in function. @@ -453,7 +452,7 @@ The following arithmetic and logical operators can be used. They are listed in order of decreasing precedence. Operators in the same group have the same precedence. -**++** **--** +**++** **-\-** : Type: Prefix and Postfix @@ -551,7 +550,7 @@ precedence. The operators will be described in more detail below. -**++** **--** +**++** **-\-** : The prefix and postfix **increment** and **decrement** operators behave exactly like they would in C. They require a named expression (see the @@ -882,7 +881,7 @@ This is a **non-portable extension**. All of the functions below, including the functions in the extended math library (see the *Extended Library* subsection below), are available when the -**-l** or **--mathlib** command-line flags are given, except that the extended +**-l** or **-\-mathlib** command-line flags are given, except that the extended math library is not available when the **-s** option, the **-w** option, or equivalents are given. @@ -934,8 +933,8 @@ The [standard][1] defines the following functions for the math library: ## Extended Library -The extended library is *not* loaded when the **-s**/**--standard** or -**-w**/**--warn** options are given since they are not part of the library +The extended library is *not* loaded when the **-s**/**-\-standard** or +**-w**/**-\-warn** options are given since they are not part of the library defined by the [standard][1]. The extended library is a **non-portable extension**. @@ -1603,17 +1602,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode (see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the **RESET** section) and accepts more input when one of those errors occurs in interactive mode. This is also the case when interactive mode is forced by the -**-i** flag or **--interactive** option. +**-i** flag or **-\-interactive** option. These exit statuses allow bc(1) to be used in shell scripting with error checking, and its normal behavior can be forced by using the **-i** flag or -**--interactive** option. +**-\-interactive** option. # INTERACTIVE MODE Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode. Interactive mode is turned on automatically when both **stdin** and **stdout** -are hooked to a terminal, but the **-i** flag and **--interactive** option can +are hooked to a terminal, but the **-i** flag and **-\-interactive** option can turn it on in other cases. In interactive mode, bc(1) attempts to recover from errors (see the **RESET** diff --git a/contrib/bc/manuals/bc/E.1 b/contrib/bc/manuals/bc/E.1 index 597cde782788..9023b07c6b87 100644 --- a/contrib/bc/manuals/bc/E.1 +++ b/contrib/bc/manuals/bc/E.1 @@ -25,19 +25,18 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator .SH SYNOPSIS .PP -\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]] -[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]] -[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]] -[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]] -[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]] -[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R] -\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...] +\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]] +[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]] +[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]] +[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]] +[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R] +\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...] [\f[I]file\f[R]\&...] .SH DESCRIPTION .PP @@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including .PP The following are the options that bc(1) accepts. .PP -\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R] +\f[B]-g\f[R], \f[B]--global-stacks\f[R] .IP .nf \f[C] @@ -115,10 +114,10 @@ This is a **non-portable extension**. \f[R] .fi .TP -\f[B]-h\f[R], \f[B]\[en]help\f[R] +\f[B]-h\f[R], \f[B]--help\f[R] Prints a usage message and quits. .TP -\f[B]-i\f[R], \f[B]\[en]interactive\f[R] +\f[B]-i\f[R], \f[B]--interactive\f[R] Forces interactive mode. (See the \f[B]INTERACTIVE MODE\f[R] section.) .RS @@ -126,7 +125,7 @@ Forces interactive mode. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-l\f[R], \f[B]\[en]mathlib\f[R] +\f[B]-l\f[R], \f[B]--mathlib\f[R] Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R] and loads the included math library before running any code, including any expressions or files specified on the command line. @@ -135,7 +134,7 @@ any expressions or files specified on the command line. To learn what is in the library, see the \f[B]LIBRARY\f[R] section. .RE .TP -\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R] +\f[B]-P\f[R], \f[B]--no-prompt\f[R] Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode. See the \f[B]TTY MODE\f[R] section) This is mostly for those users that @@ -147,18 +146,18 @@ Most of those users would want to put this option in This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-q\f[R], \f[B]\[en]quiet\f[R] +\f[B]-q\f[R], \f[B]--quiet\f[R] This option is for compatibility with the GNU bc(1) (https://www.gnu.org/software/bc/); it is a no-op. Without this option, GNU bc(1) prints a copyright header. This bc(1) only prints the copyright header if one or more of the -\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]\[en]version\f[R] options are given. +\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given. .RS .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-s\f[R], \f[B]\[en]standard\f[R] +\f[B]-s\f[R], \f[B]--standard\f[R] Process exactly the language defined by the standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and error if any extensions are used. @@ -167,15 +166,15 @@ and error if any extensions are used. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R] +\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R] Print the version information (copyright header) and exit. .RS .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-w\f[R], \f[B]\[en]warn\f[R] -Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and +\f[B]-w\f[R], \f[B]--warn\f[R] +Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and not errors) are printed for non-standard extensions and execution continues normally. .RS @@ -183,7 +182,7 @@ continues normally. This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R] +\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R] Evaluates \f[I]expr\f[R]. If multiple expressions are given, they are evaluated in order. If files are given as well (see below), the expressions and files are @@ -196,17 +195,17 @@ If this option is given on the command-line (i.e., not in \f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in \f[B]BC_ENV_ARGS\f[R]. -However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +However, if any other \f[B]-e\f[R], \f[B]--expression\f[R], +\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after \f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and exit. .PP This is a \f[B]non-portable extension\f[R]. .RE .TP -\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R] +\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R] Reads in \f[I]file\f[R] and evaluates it, line by line, as though it were read through \f[B]stdin\f[R]. If expressions are also given (see above), the expressions are evaluated @@ -217,9 +216,9 @@ If this option is given on the command-line (i.e., not in \f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. -However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f\f[R] or \f[B]--file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]--expression\f[R], +\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after \f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and exit. .PP @@ -284,8 +283,8 @@ constant numbers. It is the \[lq]input\[rq] base, or the number base used for interpreting input numbers. *** 11316 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Mar 8 23:01:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B492255C9A5; Mon, 8 Mar 2021 23:01: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 4DvYkC4n9cz3vqq; Mon, 8 Mar 2021 23:01: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 9795E114FB; Mon, 8 Mar 2021 23:01: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 128N1dm6078407; Mon, 8 Mar 2021 23:01:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128N1d79078406; Mon, 8 Mar 2021 23:01:39 GMT (envelope-from git) Date: Mon, 8 Mar 2021 23:01:39 GMT Message-Id: <202103082301.128N1d79078406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 88a55912032a - main - config_intrhook: Move from TAILQ to STAILQ and padding MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88a55912032a981bfdb62d340cab058188dd1dc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 23:01:39 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=88a55912032a981bfdb62d340cab058188dd1dc2 commit 88a55912032a981bfdb62d340cab058188dd1dc2 Author: Warner Losh AuthorDate: 2021-03-08 21:41:37 +0000 Commit: Warner Losh CommitDate: 2021-03-08 22:59:00 +0000 config_intrhook: Move from TAILQ to STAILQ and padding config_intrhook doesn't need to be a two-pointer TAILQ. We rarely add/delete from this and so those need not be optimized. Instaed, use the one-pointer STAILQ plus a uintptr_t to be used as a flags word. This will allow these changes to be MFC'd to 12 and 13 to fix a race in removable devices. Feedback from: jhb Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D29004 --- sys/kern/subr_autoconf.c | 22 +++++++++++----------- sys/sys/kernel.h | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index 6a998a533801..063396a8e139 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -56,8 +56,8 @@ __FBSDID("$FreeBSD$"); /* * "Interrupt driven config" functions. */ -static TAILQ_HEAD(, intr_config_hook) intr_config_hook_list = - TAILQ_HEAD_INITIALIZER(intr_config_hook_list); +static STAILQ_HEAD(, intr_config_hook) intr_config_hook_list = + STAILQ_HEAD_INITIALIZER(intr_config_hook_list); static struct intr_config_hook *next_to_notify; static struct mtx intr_config_hook_lock; MTX_SYSINIT(intr_config_hook, &intr_config_hook_lock, "intr config", MTX_DEF); @@ -101,7 +101,7 @@ run_interrupt_driven_config_hooks_warning(int warned) if (warned < 6) { printf("run_interrupt_driven_hooks: still waiting after %d " "seconds for", warned * WARNING_INTERVAL_SECS); - TAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) { + STAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) { if (linker_search_symbol_name( (caddr_t)hook_entry->ich_func, namebuf, sizeof(namebuf), &offset) == 0) @@ -137,7 +137,7 @@ run_interrupt_driven_config_hooks() while (next_to_notify != NULL) { hook_entry = next_to_notify; - next_to_notify = TAILQ_NEXT(hook_entry, ich_links); + next_to_notify = STAILQ_NEXT(hook_entry, ich_links); mtx_unlock(&intr_config_hook_lock); (*hook_entry->ich_func)(hook_entry->ich_arg); mtx_lock(&intr_config_hook_lock); @@ -158,7 +158,7 @@ boot_run_interrupt_driven_config_hooks(void *dummy) TSWAIT("config hooks"); mtx_lock(&intr_config_hook_lock); warned = 0; - while (!TAILQ_EMPTY(&intr_config_hook_list)) { + while (!STAILQ_EMPTY(&intr_config_hook_list)) { if (msleep(&intr_config_hook_list, &intr_config_hook_lock, 0, "conifhk", WARNING_INTERVAL_SECS * hz) == EWOULDBLOCK) { @@ -187,7 +187,7 @@ config_intrhook_establish(struct intr_config_hook *hook) TSHOLD("config hooks"); mtx_lock(&intr_config_hook_lock); - TAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) + STAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) if (hook_entry == hook) break; if (hook_entry != NULL) { @@ -196,7 +196,7 @@ config_intrhook_establish(struct intr_config_hook *hook) "already established hook.\n"); return (1); } - TAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links); + STAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links); if (next_to_notify == NULL) next_to_notify = hook; mtx_unlock(&intr_config_hook_lock); @@ -232,7 +232,7 @@ config_intrhook_disestablish(struct intr_config_hook *hook) struct intr_config_hook *hook_entry; mtx_lock(&intr_config_hook_lock); - TAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) + STAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) if (hook_entry == hook) break; if (hook_entry == NULL) @@ -240,8 +240,8 @@ config_intrhook_disestablish(struct intr_config_hook *hook) "unestablished hook"); if (next_to_notify == hook) - next_to_notify = TAILQ_NEXT(hook, ich_links); - TAILQ_REMOVE(&intr_config_hook_list, hook, ich_links); + next_to_notify = STAILQ_NEXT(hook, ich_links); + STAILQ_REMOVE(&intr_config_hook_list, hook, intr_config_hook, ich_links); TSRELEASE("config hooks"); /* Wakeup anyone watching the list */ @@ -258,7 +258,7 @@ DB_SHOW_COMMAND(conifhk, db_show_conifhk) char namebuf[64]; long offset; - TAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) { + STAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) { if (linker_ddb_search_symbol_name( (caddr_t)hook_entry->ich_func, namebuf, sizeof(namebuf), &offset) == 0) { diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index 181036c98a6a..89582ca5403d 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -466,7 +466,8 @@ struct tunable_str { typedef void (*ich_func_t)(void *_arg); struct intr_config_hook { - TAILQ_ENTRY(intr_config_hook) ich_links; + STAILQ_ENTRY(intr_config_hook) ich_links; + uintptr_t ich_padding; ich_func_t ich_func; void *ich_arg; }; From owner-dev-commits-src-all@freebsd.org Mon Mar 8 23:01:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0CCF55CC08; Mon, 8 Mar 2021 23:01: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 4DvYkD6571z3vtJ; Mon, 8 Mar 2021 23:01: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 C3D8E114FE; Mon, 8 Mar 2021 23:01: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 128N1eP0078427; Mon, 8 Mar 2021 23:01:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128N1eQk078426; Mon, 8 Mar 2021 23:01:40 GMT (envelope-from git) Date: Mon, 8 Mar 2021 23:01:40 GMT Message-Id: <202103082301.128N1eQk078426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 6ffdaa5f2d4f - main - Move back the isa non-PNP driver deadline to FreeBSD 14. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ffdaa5f2d4f0881557f64dabf61fb57541e0fba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 23:01:40 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6ffdaa5f2d4f0881557f64dabf61fb57541e0fba commit 6ffdaa5f2d4f0881557f64dabf61fb57541e0fba Author: Warner Losh AuthorDate: 2021-03-08 22:59:48 +0000 Commit: Warner Losh CommitDate: 2021-03-08 23:00:23 +0000 Move back the isa non-PNP driver deadline to FreeBSD 14. --- sys/isa/isa_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c index 56fa0f2ba987..7bc66d552e31 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -576,7 +576,7 @@ isa_probe_children(device_t dev) strcmp(kern_ident, "GENERIC") == 0 && device_is_attached(child)) device_printf(child, - "non-PNP ISA device will be removed from GENERIC in FreeBSD 12.\n"); + "non-PNP ISA device will be removed from GENERIC in FreeBSD 14.\n"); } /* From owner-dev-commits-src-all@freebsd.org Mon Mar 8 23:03:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E028655CD87; Mon, 8 Mar 2021 23:03: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 4DvYmM5zWJz3wFV; Mon, 8 Mar 2021 23:03: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 C00421153E; Mon, 8 Mar 2021 23:03: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 128N3Vif079514; Mon, 8 Mar 2021 23:03:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128N3VqA079513; Mon, 8 Mar 2021 23:03:31 GMT (envelope-from git) Date: Mon, 8 Mar 2021 23:03:31 GMT Message-Id: <202103082303.128N3VqA079513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 832d0719d6e5 - stable/13 - Move back the isa non-PNP driver deadline to FreeBSD 14. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 832d0719d6e5eb4ee2dec62f88ec79bfb617cd9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 23:03:31 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=832d0719d6e5eb4ee2dec62f88ec79bfb617cd9d commit 832d0719d6e5eb4ee2dec62f88ec79bfb617cd9d Author: Warner Losh AuthorDate: 2021-03-08 22:59:48 +0000 Commit: Warner Losh CommitDate: 2021-03-08 23:02:44 +0000 Move back the isa non-PNP driver deadline to FreeBSD 14. (cherry picked from commit 6ffdaa5f2d4f0881557f64dabf61fb57541e0fba) --- sys/isa/isa_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c index 56fa0f2ba987..7bc66d552e31 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -576,7 +576,7 @@ isa_probe_children(device_t dev) strcmp(kern_ident, "GENERIC") == 0 && device_is_attached(child)) device_printf(child, - "non-PNP ISA device will be removed from GENERIC in FreeBSD 12.\n"); + "non-PNP ISA device will be removed from GENERIC in FreeBSD 14.\n"); } /* From owner-dev-commits-src-all@freebsd.org Mon Mar 8 23:03:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05F6D55C9F5; Mon, 8 Mar 2021 23:03: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 4DvYms6rr7z4Qrd; Mon, 8 Mar 2021 23:03: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 DDD7B1153F; Mon, 8 Mar 2021 23:03: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 128N3vD5079682; Mon, 8 Mar 2021 23:03:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128N3vCo079681; Mon, 8 Mar 2021 23:03:57 GMT (envelope-from git) Date: Mon, 8 Mar 2021 23:03:57 GMT Message-Id: <202103082303.128N3vCo079681@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f58d396cce14 - stable/12 - Move back the isa non-PNP driver deadline to FreeBSD 14. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f58d396cce14bd1af46be54b90b4d9264dfc3c36 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 23:03:58 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f58d396cce14bd1af46be54b90b4d9264dfc3c36 commit f58d396cce14bd1af46be54b90b4d9264dfc3c36 Author: Warner Losh AuthorDate: 2021-03-08 22:59:48 +0000 Commit: Warner Losh CommitDate: 2021-03-08 23:03:09 +0000 Move back the isa non-PNP driver deadline to FreeBSD 14. (cherry picked from commit 6ffdaa5f2d4f0881557f64dabf61fb57541e0fba) --- sys/isa/isa_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c index 56fa0f2ba987..7bc66d552e31 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -576,7 +576,7 @@ isa_probe_children(device_t dev) strcmp(kern_ident, "GENERIC") == 0 && device_is_attached(child)) device_printf(child, - "non-PNP ISA device will be removed from GENERIC in FreeBSD 12.\n"); + "non-PNP ISA device will be removed from GENERIC in FreeBSD 14.\n"); } /* From owner-dev-commits-src-all@freebsd.org Mon Mar 8 23:05:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA04C55CCBF; Mon, 8 Mar 2021 23:05: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 4DvYpb4r1yz3wLw; Mon, 8 Mar 2021 23:05: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 8E9F011B0B; Mon, 8 Mar 2021 23:05: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 128N5RkV080012; Mon, 8 Mar 2021 23:05:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128N5RJF080011; Mon, 8 Mar 2021 23:05:27 GMT (envelope-from git) Date: Mon, 8 Mar 2021 23:05:27 GMT Message-Id: <202103082305.128N5RJF080011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 03572a87a84c - releng/13.0 - riscv: fix errors in some atomic type aliases 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 03572a87a84cde47f672480d3c5485713b7c39fb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 23:05:27 -0000 The branch releng/13.0 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=03572a87a84cde47f672480d3c5485713b7c39fb commit 03572a87a84cde47f672480d3c5485713b7c39fb Author: Mitchell Horne AuthorDate: 2021-03-04 17:52:45 +0000 Commit: Mitchell Horne CommitDate: 2021-03-08 23:04:25 +0000 riscv: fix errors in some atomic type aliases This appears to be a copy-and-paste error that has simply been overlooked. The tree contains only two calls to any of the affected variants, but recent additions to the test suite started exercising the call to atomic_clear_rel_int() in ng_leave_write(), reliably causing panics. Apparently, the issue was inherited from the arm64 atomic header. That instance was addressed in c90baf6817a0, but the fix did not make its way to RISC-V. Note that the particular test case ng_macfilter_test:main still appears to fail on this platform, but this change reduces the panic to a timeout. PR: 253237 Reported by: Jenkins, arichardson Reviewed by: kp, arichardson Approved by: re (gjb) (cherry picked from commit 0d3b3beeb253e09b2b6b3805065594aecc7e2c2f) (cherry picked from commit cc24f5bc6f6eb56a959bd23ebb051d3bf6ebf670) --- sys/riscv/include/atomic.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/riscv/include/atomic.h b/sys/riscv/include/atomic.h index d08047593861..d743fce6f1ff 100644 --- a/sys/riscv/include/atomic.h +++ b/sys/riscv/include/atomic.h @@ -288,7 +288,7 @@ atomic_store_rel_32(volatile uint32_t *p, uint32_t val) #define atomic_subtract_acq_int atomic_subtract_acq_32 #define atomic_add_rel_int atomic_add_rel_32 -#define atomic_clear_rel_int atomic_add_rel_32 +#define atomic_clear_rel_int atomic_clear_rel_32 #define atomic_cmpset_rel_int atomic_cmpset_rel_32 #define atomic_fcmpset_rel_int atomic_fcmpset_rel_32 #define atomic_set_rel_int atomic_set_rel_32 @@ -490,7 +490,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) } #define atomic_add_acq_long atomic_add_acq_64 -#define atomic_clear_acq_long atomic_add_acq_64 +#define atomic_clear_acq_long atomic_clear_acq_64 #define atomic_cmpset_acq_long atomic_cmpset_acq_64 #define atomic_fcmpset_acq_long atomic_fcmpset_acq_64 #define atomic_load_acq_long atomic_load_acq_64 @@ -498,7 +498,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_subtract_acq_long atomic_subtract_acq_64 #define atomic_add_acq_ptr atomic_add_acq_64 -#define atomic_clear_acq_ptr atomic_add_acq_64 +#define atomic_clear_acq_ptr atomic_clear_acq_64 #define atomic_cmpset_acq_ptr atomic_cmpset_acq_64 #define atomic_fcmpset_acq_ptr atomic_fcmpset_acq_64 #define atomic_load_acq_ptr atomic_load_acq_64 From owner-dev-commits-src-all@freebsd.org Mon Mar 8 23:27:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B03755D41C; Mon, 8 Mar 2021 23:27: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 4DvZJG2Znsz4RnZ; Mon, 8 Mar 2021 23:27: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 4B26611E9F; Mon, 8 Mar 2021 23:27: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 128NRguw006790; Mon, 8 Mar 2021 23:27:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128NRg4J006789; Mon, 8 Mar 2021 23:27:42 GMT (envelope-from git) Date: Mon, 8 Mar 2021 23:27:42 GMT Message-Id: <202103082327.128NRg4J006789@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: 455219675dbd - main - Change mwait_bm_avoidance use to match Linux. 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: 455219675dbd61010e180cacdfed51e7e34111e1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 23:27:42 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=455219675dbd61010e180cacdfed51e7e34111e1 commit 455219675dbd61010e180cacdfed51e7e34111e1 Author: Alexander Motin AuthorDate: 2021-03-08 22:57:46 +0000 Commit: Alexander Motin CommitDate: 2021-03-08 23:27:36 +0000 Change mwait_bm_avoidance use to match Linux. Even though the information is very limited, it seems the intent of this flag is to control ACPI_BITREG_BUS_MASTER_STATUS use for C3, not force ACPI_BITREG_ARB_DISABLE manipulations for C2, where it was never needed, and which register not really doing anything for years. It wasted lots of CPU time on congested global ACPI hardware lock when many CPU cores were trying to enter/exit deep C-states same time. On idle 80-core system it pushed ping localhost latency up to 20ms, since badport_bandlim() via counter_ratecheck() wakes up all CPUs same time once a second just to synchronously reset the counters. Now enabling C-states increases the latency from 0.1 to just 0.25ms. Discussed with: kib MFC after: 1 month --- sys/dev/acpica/acpi_cpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index ce252ab92816..436dd9ddaa93 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -1153,17 +1153,19 @@ acpi_cpu_idle(sbintime_t sbt) * driver polling for new devices keeps this bit set all the * time if USB is loaded. */ + cx_next = &sc->cpu_cx_states[cx_next_idx]; if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0 && - cx_next_idx > sc->cpu_non_c3) { + cx_next_idx > sc->cpu_non_c3 && + (!cx_next->do_mwait || cx_next->mwait_bm_avoidance)) { status = AcpiReadBitRegister(ACPI_BITREG_BUS_MASTER_STATUS, &bm_active); if (ACPI_SUCCESS(status) && bm_active != 0) { AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_STATUS, 1); cx_next_idx = sc->cpu_non_c3; + cx_next = &sc->cpu_cx_states[cx_next_idx]; } } /* Select the next state and update statistics. */ - cx_next = &sc->cpu_cx_states[cx_next_idx]; sc->cpu_cx_stats[cx_next_idx]++; KASSERT(cx_next->type != ACPI_STATE_C0, ("acpi_cpu_idle: C0 sleep")); @@ -1197,7 +1199,7 @@ acpi_cpu_idle(sbintime_t sbt) * For C3, disable bus master arbitration and enable bus master wake * if BM control is available, otherwise flush the CPU cache. */ - if (cx_next->type == ACPI_STATE_C3 || cx_next->mwait_bm_avoidance) { + if (cx_next->type == ACPI_STATE_C3) { if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) { AcpiWriteBitRegister(ACPI_BITREG_ARB_DISABLE, 1); AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_RLD, 1); @@ -1237,7 +1239,7 @@ acpi_cpu_idle(sbintime_t sbt) end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); /* Enable bus master arbitration and disable bus master wakeup. */ - if ((cx_next->type == ACPI_STATE_C3 || cx_next->mwait_bm_avoidance) && + if (cx_next->type == ACPI_STATE_C3 && (cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) { AcpiWriteBitRegister(ACPI_BITREG_ARB_DISABLE, 0); AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_RLD, 0); From owner-dev-commits-src-all@freebsd.org Mon Mar 8 23:54:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F6A355E12A; Mon, 8 Mar 2021 23:54: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 4DvZvC2DzVz4T2Y; Mon, 8 Mar 2021 23:54: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 3B4D011FEA; Mon, 8 Mar 2021 23:54: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 128NsV3b044890; Mon, 8 Mar 2021 23:54:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128NsVrA044889; Mon, 8 Mar 2021 23:54:31 GMT (envelope-from git) Date: Mon, 8 Mar 2021 23:54:31 GMT Message-Id: <202103082354.128NsVrA044889@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: 075e4807df3e - main - Do not read timer extra time when MWAIT is used. 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: 075e4807df3e6b0d9196d56e4dbc33765d57e1f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 23:54:31 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=075e4807df3e6b0d9196d56e4dbc33765d57e1f8 commit 075e4807df3e6b0d9196d56e4dbc33765d57e1f8 Author: Alexander Motin AuthorDate: 2021-03-08 23:43:47 +0000 Commit: Alexander Motin CommitDate: 2021-03-08 23:43:47 +0000 Do not read timer extra time when MWAIT is used. When we enter C2+ state via memory read, it may take chipset some time to stop CPU. Extra register read covers that time. But MWAIT makes CPU stop immediately, so we don't need to waste time after wakeup with interrupts still disabled, increasing latency. On my system it reduces ping localhost latency, waking up all CPUs once a second, from 277us to 242us. MFC after: 1 month --- sys/dev/acpica/acpi_cpu.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 436dd9ddaa93..56182ed743de 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -1220,18 +1220,19 @@ acpi_cpu_idle(sbintime_t sbt) start_time = 0; cputicks = cpu_ticks(); } - if (cx_next->do_mwait) + if (cx_next->do_mwait) { acpi_cpu_idle_mwait(cx_next->mwait_hint); - else + } else { CPU_GET_REG(cx_next->p_lvlx, 1); + /* + * Read the end time twice. Since it may take an arbitrary time + * to enter the idle state, the first read may be executed before + * the processor has stopped. Doing it again provides enough + * margin that we are certain to have a correct value. + */ + AcpiGetTimer(&end_time); + } - /* - * Read the end time twice. Since it may take an arbitrary time - * to enter the idle state, the first read may be executed before - * the processor has stopped. Doing it again provides enough - * margin that we are certain to have a correct value. - */ - AcpiGetTimer(&end_time); if (cx_next->type == ACPI_STATE_C3) { AcpiGetTimer(&end_time); AcpiGetTimerDuration(start_time, end_time, &end_time); From owner-dev-commits-src-all@freebsd.org Mon Mar 8 23:57:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57B5155D9BC; Mon, 8 Mar 2021 23:57: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 4DvZyc24ySz4T7t; Mon, 8 Mar 2021 23:57: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 368A712494; Mon, 8 Mar 2021 23:57: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 128NvSfu045449; Mon, 8 Mar 2021 23:57:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 128NvSlO045448; Mon, 8 Mar 2021 23:57:28 GMT (envelope-from git) Date: Mon, 8 Mar 2021 23:57:28 GMT Message-Id: <202103082357.128NvSlO045448@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: c7ea14ed6188 - releng/13.0 - Move back the isa non-PNP driver deadline to FreeBSD 14. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: c7ea14ed61888b99ad9c23e1f6d9eb4e5935fc78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 23:57:28 -0000 The branch releng/13.0 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c7ea14ed61888b99ad9c23e1f6d9eb4e5935fc78 commit c7ea14ed61888b99ad9c23e1f6d9eb4e5935fc78 Author: Warner Losh AuthorDate: 2021-03-08 22:59:48 +0000 Commit: Warner Losh CommitDate: 2021-03-08 23:56:37 +0000 Move back the isa non-PNP driver deadline to FreeBSD 14. Approved by: re@ (gjb) (cherry picked from commit 6ffdaa5f2d4f0881557f64dabf61fb57541e0fba) (cherry picked from commit 832d0719d6e5eb4ee2dec62f88ec79bfb617cd9d) --- sys/isa/isa_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c index 56fa0f2ba987..7bc66d552e31 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -576,7 +576,7 @@ isa_probe_children(device_t dev) strcmp(kern_ident, "GENERIC") == 0 && device_is_attached(child)) device_printf(child, - "non-PNP ISA device will be removed from GENERIC in FreeBSD 12.\n"); + "non-PNP ISA device will be removed from GENERIC in FreeBSD 14.\n"); } /* From owner-dev-commits-src-all@freebsd.org Tue Mar 9 00:09:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25E1355EFA0; Tue, 9 Mar 2021 00:09: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 4DvbDs0cMsz4V3s; Tue, 9 Mar 2021 00:09: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 F126D1270A; Tue, 9 Mar 2021 00:09: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 12909meX060202; Tue, 9 Mar 2021 00:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12909mew060201; Tue, 9 Mar 2021 00:09:48 GMT (envelope-from git) Date: Tue, 9 Mar 2021 00:09:48 GMT Message-Id: <202103090009.12909mew060201@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: 09673fc0f36d - main - mountd(8): generate a syslog message when the "V4:" line is missing 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: 09673fc0f36dd1cca74940a240a9ed0f62228084 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 00:09:49 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=09673fc0f36dd1cca74940a240a9ed0f62228084 commit 09673fc0f36dd1cca74940a240a9ed0f62228084 Author: Rick Macklem AuthorDate: 2021-03-09 00:08:02 +0000 Commit: Rick Macklem CommitDate: 2021-03-09 00:08:02 +0000 mountd(8): generate a syslog message when the "V4:" line is missing Daniel reported that NFSv4 mounts were not working despite having set "nfsv4_server_enable=YES" in /etc/rc.conf. Mountd was logging a message that there was no /etc/exports file. He noted that creating a /etc/exports file with a "V4:" line in it was needed make NFSv4 mounts work. At least one "V4:" line in one of the exports(5) file(s) is needed to make NFSv4 mounts work. This patch fixes mountd.c so that it logs a message indicting that there is no "V4:" line in any exports(5) file when NFSv4 mounts are enabled. To avoid this message being generated erroneously, /etc/rc.d/mountd is updated to make sure vfs.nfsd.server_max_nfsvers is properly set before mountd(8) is started. Reported by: debdrup PR: 253901 MFC after: 2 weeks --- libexec/rc/rc.d/mountd | 3 +++ usr.sbin/mountd/mountd.c | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/mountd b/libexec/rc/rc.d/mountd index 85d04c37a018..ba573ad732cc 100755 --- a/libexec/rc/rc.d/mountd +++ b/libexec/rc/rc.d/mountd @@ -34,6 +34,9 @@ mountd_precmd() rc_flags="${rc_flags} -R" else force_depend rpcbind || return 1 + if ! checkyesno nfsv4_server_enable; then + sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null + fi fi # mountd flags will differ depending on rc.conf settings diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 76972c66a6ed..c66ac13b3016 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -1888,10 +1888,11 @@ get_exportlist(int passno) struct iovec *iov; struct statfs *mntbufp; char errmsg[255]; - int num, i; + int error, i, nfs_maxvers, num; int iovlen; struct nfsex_args eargs; FILE *debug_file; + size_t nfs_maxvers_size; if ((debug_file = fopen(_PATH_MOUNTDDEBUG, "r")) != NULL) { fclose(debug_file); @@ -2015,6 +2016,21 @@ get_exportlist(int passno) read_exportfile(0); } + if (strlen(v4root_dirpath) == 0) { + /* Check to see if a V4: line is needed. */ + nfs_maxvers_size = sizeof(nfs_maxvers); + error = sysctlbyname("vfs.nfsd.server_max_nfsvers", + &nfs_maxvers, &nfs_maxvers_size, NULL, 0); + if (error != 0 || nfs_maxvers < NFS_VER2 || nfs_maxvers > + NFS_VER4) { + syslog(LOG_ERR, "sysctlbyname(vfs.nfsd." + "server_max_nfsvers) failed, defaulting to NFSv3"); + nfs_maxvers = NFS_VER3; + } + if (nfs_maxvers == NFS_VER4) + syslog(LOG_ERR, "NFSv4 requires at least one V4: line"); + } + if (iov != NULL) { /* Free strings allocated by strdup() in getmntopts.c */ free(iov[0].iov_base); /* fstype */ From owner-dev-commits-src-all@freebsd.org Tue Mar 9 02:47:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6F555659EA; Tue, 9 Mar 2021 02:47: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 4Dvfkk4NCHz4hJD; Tue, 9 Mar 2021 02:47: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 891BC14945; Tue, 9 Mar 2021 02:47: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 1292lQ1j069411; Tue, 9 Mar 2021 02:47:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1292lQxL069410; Tue, 9 Mar 2021 02:47:26 GMT (envelope-from git) Date: Tue, 9 Mar 2021 02:47:26 GMT Message-Id: <202103090247.1292lQxL069410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: a3d416f3daaf - stable/13 - Do not exit ctl_be_block_worker() prematurely. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a3d416f3daafc59bc2f4ee278593c8a3f7a30d2b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 02:47:26 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=a3d416f3daafc59bc2f4ee278593c8a3f7a30d2b commit a3d416f3daafc59bc2f4ee278593c8a3f7a30d2b Author: Alexander Motin AuthorDate: 2021-03-06 03:39:52 +0000 Commit: Alexander Motin CommitDate: 2021-03-09 02:47:22 +0000 Do not exit ctl_be_block_worker() prematurely. Return while there are any I/Os in a queue may result in them stuck indefinitely, since there is only one taskqueue task for all of them. I think I've reproduced this by switching ha_role to secondary under heavy load. MFC after: 3 days (cherry picked from commit 6ed39db2573bb808ac2c206cd6c831f0be86219c) --- sys/cam/ctl/ctl_backend_block.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index c4e5e0dcf26d..26fb13080171 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -1705,7 +1705,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_complete_beio(beio); - return; + continue; } be_lun->dispatch(be_lun, beio); continue; @@ -1719,7 +1719,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_config_write_done(io); - return; + continue; } ctl_be_block_cw_dispatch(be_lun, io); continue; @@ -1733,7 +1733,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_config_read_done(io); - return; + continue; } ctl_be_block_cr_dispatch(be_lun, io); continue; @@ -1747,7 +1747,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_data_submit_done(io); - return; + continue; } ctl_be_block_dispatch(be_lun, io); continue; From owner-dev-commits-src-all@freebsd.org Tue Mar 9 02:47:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CA28565A24; Tue, 9 Mar 2021 02:47: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 4DvflL3Rclz4hH2; Tue, 9 Mar 2021 02:47: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 61793148C1; Tue, 9 Mar 2021 02:47: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 1292lwRT069585; Tue, 9 Mar 2021 02:47:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1292lwI5069584; Tue, 9 Mar 2021 02:47:58 GMT (envelope-from git) Date: Tue, 9 Mar 2021 02:47:58 GMT Message-Id: <202103090247.1292lwI5069584@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: c120ef9e141e - stable/12 - Do not exit ctl_be_block_worker() prematurely. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: c120ef9e141e3c8b9b6025aa947dcc7c693ee2b8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 02:47:58 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c120ef9e141e3c8b9b6025aa947dcc7c693ee2b8 commit c120ef9e141e3c8b9b6025aa947dcc7c693ee2b8 Author: Alexander Motin AuthorDate: 2021-03-06 03:39:52 +0000 Commit: Alexander Motin CommitDate: 2021-03-09 02:47:53 +0000 Do not exit ctl_be_block_worker() prematurely. Return while there are any I/Os in a queue may result in them stuck indefinitely, since there is only one taskqueue task for all of them. I think I've reproduced this by switching ha_role to secondary under heavy load. MFC after: 3 days (cherry picked from commit 6ed39db2573bb808ac2c206cd6c831f0be86219c) --- sys/cam/ctl/ctl_backend_block.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 85787d35eb6c..d876691a9fa1 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -1696,7 +1696,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_complete_beio(beio); - return; + continue; } be_lun->dispatch(be_lun, beio); continue; @@ -1710,7 +1710,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_config_write_done(io); - return; + continue; } ctl_be_block_cw_dispatch(be_lun, io); continue; @@ -1724,7 +1724,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_config_read_done(io); - return; + continue; } ctl_be_block_cr_dispatch(be_lun, io); continue; @@ -1738,7 +1738,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_data_submit_done(io); - return; + continue; } ctl_be_block_dispatch(be_lun, io); continue; From owner-dev-commits-src-all@freebsd.org Tue Mar 9 03:16:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C59C5567181; Tue, 9 Mar 2021 03:16: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 4DvgMw5CXJz4kH8; Tue, 9 Mar 2021 03:16: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 A3CDC14C79; Tue, 9 Mar 2021 03:16: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 1293GCJ9010496; Tue, 9 Mar 2021 03:16:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1293GCmv010495; Tue, 9 Mar 2021 03:16:12 GMT (envelope-from git) Date: Tue, 9 Mar 2021 03:16:12 GMT Message-Id: <202103090316.1293GCmv010495@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 84e5f9455a18 - releng/13.0 - Do not exit ctl_be_block_worker() prematurely. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 84e5f9455a181a792dfea7bbf3d43a3e2777c436 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 03:16:12 -0000 The branch releng/13.0 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=84e5f9455a181a792dfea7bbf3d43a3e2777c436 commit 84e5f9455a181a792dfea7bbf3d43a3e2777c436 Author: Alexander Motin AuthorDate: 2021-03-06 03:39:52 +0000 Commit: Alexander Motin CommitDate: 2021-03-09 03:15:38 +0000 Do not exit ctl_be_block_worker() prematurely. Return while there are any I/Os in a queue may result in them stuck indefinitely, since there is only one taskqueue task for all of them. I think I've reproduced this by switching ha_role to secondary under heavy load. Approved by: re (delphij) (cherry picked from commit 6ed39db2573bb808ac2c206cd6c831f0be86219c) (cherry picked from commit a3d416f3daafc59bc2f4ee278593c8a3f7a30d2b) --- sys/cam/ctl/ctl_backend_block.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index cd4fab766844..92fee127c233 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -1705,7 +1705,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_complete_beio(beio); - return; + continue; } be_lun->dispatch(be_lun, beio); continue; @@ -1719,7 +1719,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_config_write_done(io); - return; + continue; } ctl_be_block_cw_dispatch(be_lun, io); continue; @@ -1733,7 +1733,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_config_read_done(io); - return; + continue; } ctl_be_block_cr_dispatch(be_lun, io); continue; @@ -1747,7 +1747,7 @@ ctl_be_block_worker(void *context, int pending) if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); ctl_data_submit_done(io); - return; + continue; } ctl_be_block_dispatch(be_lun, io); continue; From owner-dev-commits-src-all@freebsd.org Tue Mar 9 04:22:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4675A568C04; Tue, 9 Mar 2021 04: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 4Dvhqw1RsZz4n8D; Tue, 9 Mar 2021 04: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 249B715D90; Tue, 9 Mar 2021 04: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 1294M4C7001873; Tue, 9 Mar 2021 04: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 1294M4dO001872; Tue, 9 Mar 2021 04:22:04 GMT (envelope-from git) Date: Tue, 9 Mar 2021 04:22:04 GMT Message-Id: <202103090422.1294M4dO001872@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 8fb8f26ab4b6 - stable/13 - atomic(9): note that atomic_interrupt_fence first appeared in 13.0 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8fb8f26ab4b62891be27402e4335c27cb6839d9e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 04:22:04 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8fb8f26ab4b62891be27402e4335c27cb6839d9e commit 8fb8f26ab4b62891be27402e4335c27cb6839d9e Author: Konstantin Belousov AuthorDate: 2021-03-06 05:21:40 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-09 04:21:34 +0000 atomic(9): note that atomic_interrupt_fence first appeared in 13.0 (cherry picked from commit f5e930b369c6ea7a3f81d8e5b52cc395bb7b4187) --- share/man/man9/atomic.9 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9 index 397a8fcd6b18..ebc6ed791f37 100644 --- a/share/man/man9/atomic.9 +++ b/share/man/man9/atomic.9 @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 24, 2021 +.Dd March 6, 2021 .Dt ATOMIC 9 .Os .Sh NAME @@ -612,3 +612,8 @@ and .Fn atomic_store were added in .Fx 12.0 . +.Pp +The +.Fn atomic_interrupt_fence +operation was added in +.Fx 13.0 . From owner-dev-commits-src-all@freebsd.org Tue Mar 9 05:55:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 730E256A336; Tue, 9 Mar 2021 05:55: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 4DvkvR2kFFz4rj8; Tue, 9 Mar 2021 05:55: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 5049A170E5; Tue, 9 Mar 2021 05:55: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 1295tFAK020223; Tue, 9 Mar 2021 05:55:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1295tFLk020222; Tue, 9 Mar 2021 05:55:15 GMT (envelope-from git) Date: Tue, 9 Mar 2021 05:55:15 GMT Message-Id: <202103090555.1295tFLk020222@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f279cbcbdf76 - releng/13.0 - atomic: add atomic_interrupt_fence() 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: f279cbcbdf765cb1f3e419605efeb3c397b6c806 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 05:55:15 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f279cbcbdf765cb1f3e419605efeb3c397b6c806 commit f279cbcbdf765cb1f3e419605efeb3c397b6c806 Author: Konstantin Belousov AuthorDate: 2021-02-23 22:12:29 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-09 05:54:33 +0000 atomic: add atomic_interrupt_fence() Approved by: re (gjb) (cherry picked from commit e2494f7561c852951d8ac567314f5e12f19ee7af) --- share/man/man9/atomic.9 | 13 ++++++++++++- sys/sys/atomic_common.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9 index 39a4fa9c6f96..397a8fcd6b18 100644 --- a/share/man/man9/atomic.9 +++ b/share/man/man9/atomic.9 @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 18, 2019 +.Dd February 24, 2021 .Dt ATOMIC 9 .Os .Sh NAME @@ -31,6 +31,7 @@ .Nm atomic_cmpset , .Nm atomic_fcmpset , .Nm atomic_fetchadd , +.Nm atomic_interrupt_fence , .Nm atomic_load , .Nm atomic_readandclear , .Nm atomic_set , @@ -59,6 +60,8 @@ .Fc .Ft .Fn atomic_fetchadd_ "volatile *p" " v" +.Ft void +.Fn atomic_interrupt_fence "void" .Ft .Fn atomic_load_[acq_] "volatile *p" .Ft @@ -292,6 +295,14 @@ release stores, by separating access from ordering, they can sometimes facilitate more efficient implementations of synchronization primitives. For example, they can be used to avoid executing a memory barrier until a memory access shows that some condition is satisfied. +.Ss Interrupt Fence Operations +The +.Fn atomic_interrupt_fence() +function establishes ordering between its call location and any interrupt +handler executing on the same CPU. +It is modeled after the similar C11 function +.Fn atomic_signal_fence() , +and adapted for the kernel environment. .Ss Multiple Processors In multiprocessor systems, the atomicity of the atomic operations on memory depends on support for cache coherence in the underlying architecture. diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h index 48f0a8b8939c..403b3de8a092 100644 --- a/sys/sys/atomic_common.h +++ b/sys/sys/atomic_common.h @@ -78,4 +78,6 @@ #define atomic_load_consume_ptr(p) \ ((__typeof(*p)) atomic_load_acq_ptr((uintptr_t *)p)) +#define atomic_interrupt_fence() __compiler_membar() + #endif From owner-dev-commits-src-all@freebsd.org Tue Mar 9 05:55:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87CD856A15C; Tue, 9 Mar 2021 05:55: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 4DvkvS3PJ0z4rRM; Tue, 9 Mar 2021 05:55: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 667BF16F4A; Tue, 9 Mar 2021 05:55: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 1295tGTd020242; Tue, 9 Mar 2021 05:55:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1295tG7G020241; Tue, 9 Mar 2021 05:55:16 GMT (envelope-from git) Date: Tue, 9 Mar 2021 05:55:16 GMT Message-Id: <202103090555.1295tG7G020241@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 04b20818b986 - releng/13.0 - kcsan: add atomic_interrupt_fence 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 04b20818b986be7544be8a42edd2681b93bfdee3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 05:55:16 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=04b20818b986be7544be8a42edd2681b93bfdee3 commit 04b20818b986be7544be8a42edd2681b93bfdee3 Author: Mateusz Guzik AuthorDate: 2021-03-01 07:42:15 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-09 05:54:37 +0000 kcsan: add atomic_interrupt_fence Approved by: re (gjb) (cherry picked from commit 2c1c1255e41ac3fecd79f9f704c934642f34fd60) (cherry picked from commit a552da13fc8f803ffc51755436441f3c14e3c817) --- sys/sys/_cscan_atomic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/_cscan_atomic.h b/sys/sys/_cscan_atomic.h index aed96580e1e4..b458c24841bf 100644 --- a/sys/sys/_cscan_atomic.h +++ b/sys/sys/_cscan_atomic.h @@ -373,6 +373,7 @@ void kcsan_atomic_thread_fence_seq_cst(void); #define atomic_thread_fence_acq_rel kcsan_atomic_thread_fence_acq_rel #define atomic_thread_fence_rel kcsan_atomic_thread_fence_rel #define atomic_thread_fence_seq_cst kcsan_atomic_thread_fence_seq_cst +#define atomic_interrupt_fence __compiler_membar #endif /* !KCSAN_RUNTIME */ From owner-dev-commits-src-all@freebsd.org Tue Mar 9 05:55:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6494656A07D; Tue, 9 Mar 2021 05:55: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 4DvkvV4zhVz4rRb; Tue, 9 Mar 2021 05:55: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 BAD6F16CC1; Tue, 9 Mar 2021 05:55: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 1295tHqP020264; Tue, 9 Mar 2021 05:55:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1295tHwK020263; Tue, 9 Mar 2021 05:55:17 GMT (envelope-from git) Date: Tue, 9 Mar 2021 05:55:17 GMT Message-Id: <202103090555.1295tHwK020263@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5235fb3137ee - releng/13.0 - Use atomic_interrupt_fence() instead of bare __compiler_membar() 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 5235fb3137eee125c5b61616da9e6e65472fa296 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 05:55:19 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5235fb3137eee125c5b61616da9e6e65472fa296 commit 5235fb3137eee125c5b61616da9e6e65472fa296 Author: Konstantin Belousov AuthorDate: 2021-02-26 23:54:17 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-09 05:54:41 +0000 Use atomic_interrupt_fence() instead of bare __compiler_membar() Approved by: re (gjb) (cherry picked from commit b5449c92b489445635c7962875ce73b2c9211bba) (cherry picked from commit c10e0a4656bfe650bb3bf46fcf026a8a51a34a69) --- sys/kern/kern_rmlock.c | 32 +++++++++++++++----------------- sys/sys/kpilite.h | 5 ++--- sys/sys/mount.h | 4 ++-- sys/sys/sched.h | 4 ++-- sys/sys/systm.h | 6 +++--- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index 9135709d88cf..f661e209b633 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -366,7 +366,7 @@ _rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) * Check to see if the IPI granted us the lock after all. The load of * rmp_flags must happen after the tracker is removed from the list. */ - __compiler_membar(); + atomic_interrupt_fence(); if (tracker->rmp_flags) { /* Just add back tracker - we hold the lock. */ rm_tracker_add(pc, tracker); @@ -448,7 +448,7 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) td->td_critnest++; /* critical_enter(); */ - __compiler_membar(); + atomic_interrupt_fence(); pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */ @@ -456,7 +456,7 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock) sched_pin(); - __compiler_membar(); + atomic_interrupt_fence(); td->td_critnest--; @@ -873,17 +873,15 @@ db_show_rm(const struct lock_object *lock) * Concurrent writers take turns taking the lock while going off cpu. If this is * of concern for your usecase, this is not the right primitive. * - * Neither rms_rlock nor rms_runlock use fences. Instead compiler barriers are - * inserted to prevert reordering of generated code. Execution ordering is - * provided with the use of an IPI handler. + * Neither rms_rlock nor rms_runlock use thread fences. Instead interrupt + * fences are inserted to ensure ordering with the code executed in the IPI + * handler. * * No attempt is made to track which CPUs read locked at least once, * consequently write locking sends IPIs to all of them. This will become a * problem at some point. The easiest way to lessen it is to provide a bitmap. */ -#define rms_int_membar() __compiler_membar() - #define RMS_NOOWNER ((void *)0x1) #define RMS_TRANSIENT ((void *)0x2) #define RMS_FLAGMASK 0xf @@ -1030,14 +1028,14 @@ rms_rlock(struct rmslock *rms) critical_enter(); pcpu = rms_int_pcpu(rms); rms_int_influx_enter(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); if (__predict_false(rms->writers > 0)) { rms_rlock_fallback(rms); return; } - rms_int_membar(); + atomic_interrupt_fence(); rms_int_readers_inc(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); } @@ -1052,15 +1050,15 @@ rms_try_rlock(struct rmslock *rms) critical_enter(); pcpu = rms_int_pcpu(rms); rms_int_influx_enter(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); if (__predict_false(rms->writers > 0)) { rms_int_influx_exit(rms, pcpu); critical_exit(); return (0); } - rms_int_membar(); + atomic_interrupt_fence(); rms_int_readers_inc(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); return (1); @@ -1092,14 +1090,14 @@ rms_runlock(struct rmslock *rms) critical_enter(); pcpu = rms_int_pcpu(rms); rms_int_influx_enter(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); if (__predict_false(rms->writers > 0)) { rms_runlock_fallback(rms); return; } - rms_int_membar(); + atomic_interrupt_fence(); rms_int_readers_dec(rms, pcpu); - rms_int_membar(); + atomic_interrupt_fence(); rms_int_influx_exit(rms, pcpu); critical_exit(); } diff --git a/sys/sys/kpilite.h b/sys/sys/kpilite.h index 8742ef5cfbe8..2a7e9743f799 100644 --- a/sys/sys/kpilite.h +++ b/sys/sys/kpilite.h @@ -38,7 +38,7 @@ sched_pin_lite(struct thread_lite *td) KASSERT((struct thread *)td == curthread, ("sched_pin called on non curthread")); td->td_pinned++; - __compiler_membar(); + atomic_interrupt_fence(); } static __inline void @@ -47,9 +47,8 @@ sched_unpin_lite(struct thread_lite *td) KASSERT((struct thread *)td == curthread, ("sched_unpin called on non curthread")); KASSERT(td->td_pinned > 0, ("sched_unpin called on non pinned thread")); - __compiler_membar(); + atomic_interrupt_fence(); td->td_pinned--; - __compiler_membar(); } #endif #endif diff --git a/sys/sys/mount.h b/sys/sys/mount.h index f965dd72d7ba..98d50161bed5 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1086,7 +1086,7 @@ void resume_all_fs(void); _mpcpu = vfs_mount_pcpu(mp); \ MPASS(mpcpu->mntp_thread_in_ops == 0); \ _mpcpu->mntp_thread_in_ops = 1; \ - __compiler_membar(); \ + atomic_interrupt_fence(); \ if (__predict_false(mp->mnt_vfs_ops > 0)) { \ vfs_op_thread_exit_crit(mp, _mpcpu); \ _retval_crit = false; \ @@ -1106,7 +1106,7 @@ void resume_all_fs(void); #define vfs_op_thread_exit_crit(mp, _mpcpu) do { \ MPASS(_mpcpu == vfs_mount_pcpu(mp)); \ MPASS(_mpcpu->mntp_thread_in_ops == 1); \ - __compiler_membar(); \ + atomic_interrupt_fence(); \ _mpcpu->mntp_thread_in_ops = 0; \ } while (0) diff --git a/sys/sys/sched.h b/sys/sys/sched.h index d734ec61266e..64651ffa9c90 100644 --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -173,13 +173,13 @@ static __inline void sched_pin(void) { curthread->td_pinned++; - __compiler_membar(); + atomic_interrupt_fence(); } static __inline void sched_unpin(void) { - __compiler_membar(); + atomic_interrupt_fence(); curthread->td_pinned--; } diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 5de12e5bc1e5..72a10c401af9 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -284,7 +284,7 @@ critical_enter(void) td = (struct thread_lite *)curthread; td->td_critnest++; - __compiler_membar(); + atomic_interrupt_fence(); } static __inline void @@ -295,9 +295,9 @@ critical_exit(void) td = (struct thread_lite *)curthread; KASSERT(td->td_critnest != 0, ("critical_exit: td_critnest == 0")); - __compiler_membar(); + atomic_interrupt_fence(); td->td_critnest--; - __compiler_membar(); + atomic_interrupt_fence(); if (__predict_false(td->td_owepreempt)) critical_exit_preempt(); From owner-dev-commits-src-all@freebsd.org Tue Mar 9 05:55:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA94256A385; Tue, 9 Mar 2021 05:55: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 4DvkvW4RTxz4rV0; Tue, 9 Mar 2021 05:55: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 BB37E17101; Tue, 9 Mar 2021 05:55: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 1295tIHB020284; Tue, 9 Mar 2021 05:55:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1295tIGS020283; Tue, 9 Mar 2021 05:55:18 GMT (envelope-from git) Date: Tue, 9 Mar 2021 05:55:18 GMT Message-Id: <202103090555.1295tIGS020283@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 677a7288adf1 - releng/13.0 - atomic(9): note that atomic_interrupt_fence first appeared in 13.0 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 677a7288adf1034395245ec60ea76300b015aeff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 05:55:21 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=677a7288adf1034395245ec60ea76300b015aeff commit 677a7288adf1034395245ec60ea76300b015aeff Author: Konstantin Belousov AuthorDate: 2021-03-06 05:21:40 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-09 05:54:45 +0000 atomic(9): note that atomic_interrupt_fence first appeared in 13.0 Approved by: re (gjb) (cherry picked from commit f5e930b369c6ea7a3f81d8e5b52cc395bb7b4187) (cherry picked from commit 8fb8f26ab4b62891be27402e4335c27cb6839d9e) --- share/man/man9/atomic.9 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9 index 397a8fcd6b18..ebc6ed791f37 100644 --- a/share/man/man9/atomic.9 +++ b/share/man/man9/atomic.9 @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 24, 2021 +.Dd March 6, 2021 .Dt ATOMIC 9 .Os .Sh NAME @@ -612,3 +612,8 @@ and .Fn atomic_store were added in .Fx 12.0 . +.Pp +The +.Fn atomic_interrupt_fence +operation was added in +.Fx 13.0 . From owner-dev-commits-src-all@freebsd.org Tue Mar 9 07:33:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5396E56D274; Tue, 9 Mar 2021 07:33: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 4Dvn4K1vtJz3FZt; Tue, 9 Mar 2021 07:33: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 3478C18379; Tue, 9 Mar 2021 07:33: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 1297X5Ym051599; Tue, 9 Mar 2021 07:33:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1297X5j0051598; Tue, 9 Mar 2021 07:33:05 GMT (envelope-from git) Date: Tue, 9 Mar 2021 07:33:05 GMT Message-Id: <202103090733.1297X5j0051598@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: 38fe00d43dcc - stable/13 - loader: cursor off should restore display content 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 38fe00d43dccb3bf4d49c60ab808bc0502753b29 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 07:33:05 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=38fe00d43dccb3bf4d49c60ab808bc0502753b29 commit 38fe00d43dccb3bf4d49c60ab808bc0502753b29 Author: Toomas Soome AuthorDate: 2021-03-06 10:19:43 +0000 Commit: Toomas Soome CommitDate: 2021-03-09 07:32:17 +0000 loader: cursor off should restore display content When drawing cursor, we should store original display content because there may be image data we would like to restore when the cursor is removed. PR: 254054 Reported by: Jose Luis Duran (cherry picked from commit d708f23ebb06cfc9cf8f96f17a43eb63653b818a) --- stand/common/gfx_fb.c | 38 ++++++++++++++++++++++++++++++++++++++ stand/common/gfx_fb.h | 2 ++ 2 files changed, 40 insertions(+) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 77cf1d39854f..3eae0a3a859e 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -978,6 +978,7 @@ gfx_fb_fill(void *arg, const teken_rect_t *r, teken_char_t c, static void gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *p, bool on) { + unsigned x, y, width, height; const uint8_t *glyph; int idx; @@ -985,10 +986,47 @@ gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *p, bool on) if (idx >= state->tg_tp.tp_col * state->tg_tp.tp_row) return; + width = state->tg_font.vf_width; + height = state->tg_font.vf_height; + x = state->tg_origin.tp_col + p->tp_col * width; + y = state->tg_origin.tp_row + p->tp_row * height; + + /* + * Save original display content to preserve image data. + */ + if (on) { + if (state->tg_cursor_image == NULL || + state->tg_cursor_size != width * height * 4) { + free(state->tg_cursor_image); + state->tg_cursor_size = width * height * 4; + state->tg_cursor_image = malloc(state->tg_cursor_size); + } + if (state->tg_cursor_image != NULL) { + if (gfxfb_blt(state->tg_cursor_image, + GfxFbBltVideoToBltBuffer, x, y, 0, 0, + width, height, 0) != 0) { + free(state->tg_cursor_image); + state->tg_cursor_image = NULL; + } + } + } else { + /* + * Restore display from tg_cursor_image. + * If there is no image, restore char from screen_buffer. + */ + if (state->tg_cursor_image != NULL && + gfxfb_blt(state->tg_cursor_image, GfxFbBltBufferToVideo, + 0, 0, x, y, width, height, 0) == 0) { + state->tg_cursor = *p; + return; + } + } + glyph = font_lookup(&state->tg_font, screen_buffer[idx].c, &screen_buffer[idx].a); gfx_bitblt_bitmap(state, glyph, &screen_buffer[idx].a, 0xff, on); gfx_fb_printchar(state, p); + state->tg_cursor = *p; } diff --git a/stand/common/gfx_fb.h b/stand/common/gfx_fb.h index ac63d7939cef..89b060a02cf9 100644 --- a/stand/common/gfx_fb.h +++ b/stand/common/gfx_fb.h @@ -210,6 +210,8 @@ typedef struct teken_gfx { teken_t tg_teken; /* Teken core */ teken_pos_t tg_cursor; /* Where cursor was drawn */ bool tg_cursor_visible; + uint8_t *tg_cursor_image; /* Memory for cursor */ + size_t tg_cursor_size; teken_pos_t tg_tp; /* Terminal dimensions */ teken_pos_t tg_origin; /* Point of origin in pixels */ uint8_t *tg_glyph; /* Memory for glyph */ From owner-dev-commits-src-all@freebsd.org Tue Mar 9 08:52:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45AC456F8F6; Tue, 9 Mar 2021 08:52: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 4Dvpqg1YgWz3LV0; Tue, 9 Mar 2021 08:52: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 2857119068; Tue, 9 Mar 2021 08:52: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 1298qFLn056879; Tue, 9 Mar 2021 08:52:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1298qF13056878; Tue, 9 Mar 2021 08:52:15 GMT (envelope-from git) Date: Tue, 9 Mar 2021 08:52:15 GMT Message-Id: <202103090852.1298qF13056878@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: f5183ef429ef - stable/13 - ipfw: add IPv6 support for sockarg opcode. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f5183ef429efee3803e9b7c6a96a9b9cbe9d38fb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 08:52:15 -0000 The branch stable/13 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=f5183ef429efee3803e9b7c6a96a9b9cbe9d38fb commit f5183ef429efee3803e9b7c6a96a9b9cbe9d38fb Author: Andrey V. Elsukov AuthorDate: 2021-03-02 09:45:59 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-03-09 08:50:48 +0000 ipfw: add IPv6 support for sockarg opcode. Sponsored by: Yandex LLC (cherry picked from commit a9f7eba9597189c0e438f6986067d31dca1c53b0) --- sys/netpfil/ipfw/ip_fw2.c | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/sys/netpfil/ipfw/ip_fw2.c b/sys/netpfil/ipfw/ip_fw2.c index 7b6cca68fd11..f03180cd3bca 100644 --- a/sys/netpfil/ipfw/ip_fw2.c +++ b/sys/netpfil/ipfw/ip_fw2.c @@ -2620,9 +2620,7 @@ do { \ #ifndef USERSPACE /* not supported in userspace */ struct inpcb *inp = args->inp; struct inpcbinfo *pi; - - if (is_ipv6) /* XXX can we remove this ? */ - break; + bool inp_locked = false; if (proto == IPPROTO_TCP) pi = &V_tcbinfo; @@ -2638,27 +2636,37 @@ do { \ * certainly be inp_user_cookie? */ - /* For incoming packet, lookup up the - inpcb using the src/dest ip/port tuple */ - if (inp == NULL) { - inp = in_pcblookup(pi, - src_ip, htons(src_port), - dst_ip, htons(dst_port), - INPLOOKUP_RLOCKPCB, NULL); - if (inp != NULL) { - tablearg = - inp->inp_socket->so_user_cookie; - if (tablearg) - match = 1; - INP_RUNLOCK(inp); - } - } else { + /* + * For incoming packet lookup the inpcb + * using the src/dest ip/port tuple. + */ + if (is_ipv4 && inp == NULL) { + inp = in_pcblookup(pi, + src_ip, htons(src_port), + dst_ip, htons(dst_port), + INPLOOKUP_RLOCKPCB, NULL); + inp_locked = true; + } +#ifdef INET6 + if (is_ipv6 && inp == NULL) { + inp = in6_pcblookup(pi, + &args->f_id.src_ip6, + htons(src_port), + &args->f_id.dst_ip6, + htons(dst_port), + INPLOOKUP_RLOCKPCB, NULL); + inp_locked = true; + } +#endif /* INET6 */ + if (inp != NULL) { if (inp->inp_socket) { tablearg = inp->inp_socket->so_user_cookie; if (tablearg) match = 1; } + if (inp_locked) + INP_RUNLOCK(inp); } #endif /* !USERSPACE */ break; From owner-dev-commits-src-all@freebsd.org Tue Mar 9 08:54:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5012756FAF9; Tue, 9 Mar 2021 08:54: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 4Dvpsj1t3cz3Lh7; Tue, 9 Mar 2021 08:54: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 32FDF191B5; Tue, 9 Mar 2021 08:54: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 1298s1rf057234; Tue, 9 Mar 2021 08:54:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1298s10E057232; Tue, 9 Mar 2021 08:54:01 GMT (envelope-from git) Date: Tue, 9 Mar 2021 08:54:01 GMT Message-Id: <202103090854.1298s10E057232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: fb827e006cec - stable/12 - ipfw: add IPv6 support for sockarg opcode. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fb827e006cec095cbbec1811c9fb27722e76c6f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 08:54:01 -0000 The branch stable/12 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=fb827e006cec095cbbec1811c9fb27722e76c6f6 commit fb827e006cec095cbbec1811c9fb27722e76c6f6 Author: Andrey V. Elsukov AuthorDate: 2021-03-02 09:45:59 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-03-09 08:52:19 +0000 ipfw: add IPv6 support for sockarg opcode. Sponsored by: Yandex LLC (cherry picked from commit a9f7eba9597189c0e438f6986067d31dca1c53b0) --- sys/netpfil/ipfw/ip_fw2.c | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/sys/netpfil/ipfw/ip_fw2.c b/sys/netpfil/ipfw/ip_fw2.c index f639a3bfabbd..9d60b446dc73 100644 --- a/sys/netpfil/ipfw/ip_fw2.c +++ b/sys/netpfil/ipfw/ip_fw2.c @@ -2587,9 +2587,7 @@ do { \ #ifndef USERSPACE /* not supported in userspace */ struct inpcb *inp = args->inp; struct inpcbinfo *pi; - - if (is_ipv6) /* XXX can we remove this ? */ - break; + bool inp_locked = false; if (proto == IPPROTO_TCP) pi = &V_tcbinfo; @@ -2605,27 +2603,37 @@ do { \ * certainly be inp_user_cookie? */ - /* For incoming packet, lookup up the - inpcb using the src/dest ip/port tuple */ - if (inp == NULL) { - inp = in_pcblookup(pi, - src_ip, htons(src_port), - dst_ip, htons(dst_port), - INPLOOKUP_RLOCKPCB, NULL); - if (inp != NULL) { - tablearg = - inp->inp_socket->so_user_cookie; - if (tablearg) - match = 1; - INP_RUNLOCK(inp); - } - } else { + /* + * For incoming packet lookup the inpcb + * using the src/dest ip/port tuple. + */ + if (is_ipv4 && inp == NULL) { + inp = in_pcblookup(pi, + src_ip, htons(src_port), + dst_ip, htons(dst_port), + INPLOOKUP_RLOCKPCB, NULL); + inp_locked = true; + } +#ifdef INET6 + if (is_ipv6 && inp == NULL) { + inp = in6_pcblookup(pi, + &args->f_id.src_ip6, + htons(src_port), + &args->f_id.dst_ip6, + htons(dst_port), + INPLOOKUP_RLOCKPCB, NULL); + inp_locked = true; + } +#endif /* INET6 */ + if (inp != NULL) { if (inp->inp_socket) { tablearg = inp->inp_socket->so_user_cookie; if (tablearg) match = 1; } + if (inp_locked) + INP_RUNLOCK(inp); } #endif /* !USERSPACE */ break; From owner-dev-commits-src-all@freebsd.org Tue Mar 9 10:53:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E176757551F; Tue, 9 Mar 2021 10:53: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 4DvsWF62Rpz3mL7; Tue, 9 Mar 2021 10:53: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 C1F5F1AE2F; Tue, 9 Mar 2021 10:53: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 129ArDuP015073; Tue, 9 Mar 2021 10:53:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129ArDuX015072; Tue, 9 Mar 2021 10:53:13 GMT (envelope-from git) Date: Tue, 9 Mar 2021 10:53:13 GMT Message-Id: <202103091053.129ArDuX015072@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: bae59285f932 - main - if_wg: return to m_defrag() of incoming mbuf, sans leak 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: bae59285f932d59ee9fd9d6a7c41d34ef8e51186 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 10:53:13 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=bae59285f932d59ee9fd9d6a7c41d34ef8e51186 commit bae59285f932d59ee9fd9d6a7c41d34ef8e51186 Author: Kyle Evans AuthorDate: 2021-03-09 10:44:31 +0000 Commit: Kyle Evans CommitDate: 2021-03-09 10:52:22 +0000 if_wg: return to m_defrag() of incoming mbuf, sans leak This partially reverts df55485085 but still fixes the leak. It was overlooked (sigh) that some packets will exceed MHLEN and cannot be physically contiguous without clustering, but we don't actually need it to be. m_defrag() should pull up enough for any of the headers that we do need to be accessible. Fixes: df55485085 Pointy hat; kevans --- sys/dev/if_wg/module/if_wg_session.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index e63367785ed3..ae9e44cffef5 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -1904,13 +1904,12 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, m_adj(m0, hlen); /* - * Ensure mbuf is contiguous over full length of the packet. This is - * done so that we can directly read the handshake values in - * wg_handshake, and so we can decrypt a transport packet by passing a - * a single buffer to noise_remote_decrypt() in wg_decap. + * Ensure mbuf has at least enough contiguous data to peel off our + * headers at the beginning. */ - if ((m = m_pullup(m0, m0->m_pkthdr.len)) == NULL) { + if ((m = m_defrag(m0, M_NOWAIT)) == NULL) { DPRINTF(sc, "DEFRAG fail\n"); + m_freem(m0); return; } data = mtod(m, void *); From owner-dev-commits-src-all@freebsd.org Tue Mar 9 11:17:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E4DD575C69; Tue, 9 Mar 2021 11:17: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 4Dvt3g3LQFz3nhH; Tue, 9 Mar 2021 11:17: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 D734C1ADE4; Tue, 9 Mar 2021 11:17: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 129BHPp1042871; Tue, 9 Mar 2021 11:17:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129BHPSv042870; Tue, 9 Mar 2021 11:17:25 GMT (envelope-from git) Date: Tue, 9 Mar 2021 11:17:25 GMT Message-Id: <202103091117.129BHPSv042870@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: 172a8241c9c9 - main - ifconfig: wg: stop requiring peer endpoints 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: 172a8241c9c9a7273a78ad73a32501d3a01afd28 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 11:17:54 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=172a8241c9c9a7273a78ad73a32501d3a01afd28 commit 172a8241c9c9a7273a78ad73a32501d3a01afd28 Author: Kyle Evans AuthorDate: 2021-03-08 01:04:24 +0000 Commit: Kyle Evans CommitDate: 2021-03-09 11:16:42 +0000 ifconfig: wg: stop requiring peer endpoints The way that wireguard is designed does not actually require all peers to have endpoints. In an architecture that might mimic a traditional VPN server <-> client, the wg interface on a server would have a number of peers without set endpoints -- the expectation is that the "clients" will connect to the "server" peer, which will authenticate the connection as a known peer and learn the endpoint from there. MFC after: 3 days Discussed with: decke, grehan (independently) --- sbin/ifconfig/ifwg.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c index a2b22d2dfbef..105ee7ac31d1 100644 --- a/sbin/ifconfig/ifwg.c +++ b/sbin/ifconfig/ifwg.c @@ -400,8 +400,6 @@ peerfinish(int s, void *arg) errx(1, "failed to allocate nvl_array"); if (!nvlist_exists_binary(nvl_params, "public-key")) errx(1, "must specify a public-key for adding peer"); - if (!nvlist_exists_binary(nvl_params, "endpoint")) - errx(1, "must specify an endpoint for adding peer"); if (allowed_ips_count == 0) errx(1, "must specify at least one range of allowed-ips to add a peer"); From owner-dev-commits-src-all@freebsd.org Tue Mar 9 11:17:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A42C2575D5A; Tue, 9 Mar 2021 11:17: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 4Dvt3g6SJSz3nhJ; Tue, 9 Mar 2021 11:17: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 EE69C1B3FB; Tue, 9 Mar 2021 11:17: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 129BHQuM042889; Tue, 9 Mar 2021 11:17:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129BHQJi042888; Tue, 9 Mar 2021 11:17:26 GMT (envelope-from git) Date: Tue, 9 Mar 2021 11:17:26 GMT Message-Id: <202103091117.129BHQJi042888@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: b3dac3913dc9 - main - ifconfig: allow displaying/setting persistent-keepalive 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: b3dac3913dc90fbc6f909ee5c4a876097cd90791 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 11:17:54 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b3dac3913dc90fbc6f909ee5c4a876097cd90791 commit b3dac3913dc90fbc6f909ee5c4a876097cd90791 Author: Kyle Evans AuthorDate: 2021-03-08 01:00:58 +0000 Commit: Kyle Evans CommitDate: 2021-03-09 11:16:42 +0000 ifconfig: allow displaying/setting persistent-keepalive The kernel-side already accepted a persistent-keepalive-interval, so just add a verb to ifconfig(8) for it and start exporting it so that ifconfig(8) can view it. PR: 253790 MFC after: 3 days Discussed with: decke --- sbin/ifconfig/ifwg.c | 28 +++++++++++++++++++++++++++- sys/dev/if_wg/module/module.c | 8 ++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c index 105ee7ac31d1..86bacc59f50d 100644 --- a/sbin/ifconfig/ifwg.c +++ b/sbin/ifconfig/ifwg.c @@ -280,6 +280,7 @@ dump_peer(const nvlist_t *nvl_peer) char addr_buf[INET6_ADDRSTRLEN]; size_t size; int count, port; + uint16_t persistent_keepalive; printf("[Peer]\n"); if (nvlist_exists_binary(nvl_peer, "public-key")) { @@ -292,7 +293,11 @@ dump_peer(const nvlist_t *nvl_peer) sa_ntop(endpoint, addr_buf, &port); printf("Endpoint = %s:%d\n", addr_buf, ntohs(port)); } - + if (nvlist_exists_number(nvl_peer, "persistent-keepalive-interval")) { + persistent_keepalive = nvlist_get_number(nvl_peer, + "persistent-keepalive-interval"); + printf("PersistentKeepalive = %d\n", persistent_keepalive); + } if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) return; aips = nvlist_get_binary(nvl_peer, "allowed-ips", &size); @@ -475,6 +480,26 @@ DECL_CMD_FUNC(setwgpubkey, val, d) nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); } +static +DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) +{ + unsigned long persistent_keepalive; + char *endp; + + if (!do_peer) + errx(1, "setting persistent keepalive only valid when adding peer"); + + errno = 0; + persistent_keepalive = strtoul(val, &endp, 0); + if (errno != 0 || *endp != '\0') + errx(1, "persistent-keepalive must be numeric (seconds)"); + if (persistent_keepalive > USHRT_MAX) + errx(1, "persistent-keepalive '%lu' too large", + persistent_keepalive); + nvlist_add_number(nvl_params, "persistent-keepalive-interval", + persistent_keepalive); +} + static DECL_CMD_FUNC(setallowedips, val, d) { @@ -563,6 +588,7 @@ static struct cmd wireguard_cmds[] = { DEF_CMD("peer-list", 0, peerlist), DEF_CMD("peer", 0, peerstart), DEF_CMD_ARG("public-key", setwgpubkey), + DEF_CMD_ARG("persistent-keepalive", setwgpersistentkeepalive), DEF_CMD_ARG("allowed-ips", setallowedips), DEF_CMD_ARG("endpoint", setendpoint), }; diff --git a/sys/dev/if_wg/module/module.c b/sys/dev/if_wg/module/module.c index 6ae3bf9db022..ad2f17c1e803 100644 --- a/sys/dev/if_wg/module/module.c +++ b/sys/dev/if_wg/module/module.c @@ -75,6 +75,7 @@ struct wg_peer_export { size_t endpoint_sz; struct wg_allowedip *aip; int aip_count; + uint16_t persistent_keepalive; }; static int clone_count; @@ -416,6 +417,9 @@ wg_peer_to_export(struct wg_peer *peer, struct wg_peer_export *exp) memcpy(exp->public_key, peer->p_remote.r_public, sizeof(exp->public_key)); + exp->persistent_keepalive = + peer->p_timers.t_persistent_keepalive_interval; + exp->aip_count = 0; CK_LIST_FOREACH(rt, &peer->p_routes, r_entry) { exp->aip_count++; @@ -458,6 +462,10 @@ wg_peer_export_to_nvl(struct wg_peer_export *exp) nvlist_add_binary(nvl, "allowed-ips", exp->aip, exp->aip_count * sizeof(*exp->aip)); + if (exp->persistent_keepalive != 0) + nvlist_add_number(nvl, "persistent-keepalive-interval", + exp->persistent_keepalive); + return (nvl); } From owner-dev-commits-src-all@freebsd.org Tue Mar 9 11:17:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F12B575E3D; Tue, 9 Mar 2021 11:17: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 4Dvt3c5rs3z3nmK; Tue, 9 Mar 2021 11:17: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 AE6F11B3FA; Tue, 9 Mar 2021 11:17: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 129BHNLY042830; Tue, 9 Mar 2021 11:17:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129BHN0a042829; Tue, 9 Mar 2021 11:17:23 GMT (envelope-from git) Date: Tue, 9 Mar 2021 11:17:23 GMT Message-Id: <202103091117.129BHN0a042829@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: e80e371d79d8 - main - if_wg: avoid sleeping under the net epoch 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: e80e371d79d825712a9078e0d1a14b62567291c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 11:17:54 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e80e371d79d825712a9078e0d1a14b62567291c4 commit e80e371d79d825712a9078e0d1a14b62567291c4 Author: Kyle Evans AuthorDate: 2021-03-08 06:06:28 +0000 Commit: Kyle Evans CommitDate: 2021-03-09 11:16:30 +0000 if_wg: avoid sleeping under the net epoch No sleeping allowed here, so avoid it. Collect the subset of data we want inside of the epoch, as we'll need extra allocations when we add items to the nvlist. Reviewed by: grehan (earlier version), markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29124 --- sys/dev/if_wg/module/module.c | 136 ++++++++++++++++++++++++++++++------------ 1 file changed, 99 insertions(+), 37 deletions(-) diff --git a/sys/dev/if_wg/module/module.c b/sys/dev/if_wg/module/module.c index a40a304616c7..6ae3bf9db022 100644 --- a/sys/dev/if_wg/module/module.c +++ b/sys/dev/if_wg/module/module.c @@ -69,6 +69,14 @@ MALLOC_DEFINE(M_WG, "WG", "wireguard"); TASKQGROUP_DECLARE(if_io_tqg); +struct wg_peer_export { + struct sockaddr_storage endpoint; + uint8_t public_key[WG_KEY_SIZE]; + size_t endpoint_sz; + struct wg_allowedip *aip; + int aip_count; +}; + static int clone_count; uma_zone_t ratelimit_zone; @@ -386,37 +394,70 @@ wg_stop(if_ctx_t ctx) wg_socket_reinit(sc, NULL, NULL); } -static nvlist_t * -wg_peer_to_nvl(struct wg_peer *peer) +static int +wg_peer_to_export(struct wg_peer *peer, struct wg_peer_export *exp) { - struct wg_route *rt; - int i, count; - nvlist_t *nvl; - caddr_t key; - size_t sa_sz; - struct wg_allowedip *aip; struct wg_endpoint *ep; + struct wg_route *rt; + int i; - if ((nvl = nvlist_create(0)) == NULL) - return (NULL); - key = peer->p_remote.r_public; - nvlist_add_binary(nvl, "public-key", key, WG_KEY_SIZE); + /* Non-sleepable context. */ + NET_EPOCH_ASSERT(); + + bzero(&exp->endpoint, sizeof(exp->endpoint)); ep = &peer->p_endpoint; if (ep->e_remote.r_sa.sa_family != 0) { - sa_sz = (ep->e_remote.r_sa.sa_family == AF_INET) ? - sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); - nvlist_add_binary(nvl, "endpoint", &ep->e_remote, sa_sz); + exp->endpoint_sz = (ep->e_remote.r_sa.sa_family == AF_INET) ? + sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); + + memcpy(&exp->endpoint, &ep->e_remote, exp->endpoint_sz); } - i = count = 0; + + memcpy(exp->public_key, peer->p_remote.r_public, + sizeof(exp->public_key)); + + exp->aip_count = 0; CK_LIST_FOREACH(rt, &peer->p_routes, r_entry) { - count++; + exp->aip_count++; } - aip = malloc(count*sizeof(*aip), M_TEMP, M_WAITOK); + + /* Early success; no allowed-ips to copy out. */ + if (exp->aip_count == 0) + return (0); + + exp->aip = malloc(exp->aip_count * sizeof(*exp->aip), M_TEMP, M_NOWAIT); + if (exp->aip == NULL) + return (ENOMEM); + + i = 0; CK_LIST_FOREACH(rt, &peer->p_routes, r_entry) { - memcpy(&aip[i++], &rt->r_cidr, sizeof(*aip)); + memcpy(&exp->aip[i++], &rt->r_cidr, sizeof(*exp->aip)); + if (i == exp->aip_count) + break; } - nvlist_add_binary(nvl, "allowed-ips", aip, count*sizeof(*aip)); - free(aip, M_TEMP); + + /* Again, AllowedIPs might have shrank; update it. */ + exp->aip_count = i; + + return (0); +} + +static nvlist_t * +wg_peer_export_to_nvl(struct wg_peer_export *exp) +{ + nvlist_t *nvl; + + if ((nvl = nvlist_create(0)) == NULL) + return (NULL); + + nvlist_add_binary(nvl, "public-key", exp->public_key, WG_KEY_SIZE); + if (exp->endpoint_sz != 0) + nvlist_add_binary(nvl, "endpoint", &exp->endpoint, + exp->endpoint_sz); + + nvlist_add_binary(nvl, "allowed-ips", exp->aip, + exp->aip_count * sizeof(*exp->aip)); + return (nvl); } @@ -427,10 +468,8 @@ wg_marshal_peers(struct wg_softc *sc, nvlist_t **nvlp, nvlist_t ***nvl_arrayp, i int err, i, peer_count; nvlist_t *nvl, **nvl_array; struct epoch_tracker et; -#ifdef INVARIANTS - void *packed; - size_t size; -#endif + struct wg_peer_export *wpe; + nvl = NULL; nvl_array = NULL; if (nvl_arrayp) @@ -447,34 +486,44 @@ wg_marshal_peers(struct wg_softc *sc, nvlist_t **nvlp, nvlist_t ***nvl_arrayp, i if (nvlp && (nvl = nvlist_create(0)) == NULL) return (ENOMEM); + err = i = 0; nvl_array = malloc(peer_count*sizeof(void*), M_TEMP, M_WAITOK); + wpe = malloc(peer_count*sizeof(*wpe), M_TEMP, M_WAITOK | M_ZERO); + NET_EPOCH_ENTER(et); CK_LIST_FOREACH(peer, &sc->sc_hashtable.h_peers_list, p_entry) { - nvl_array[i] = wg_peer_to_nvl(peer); - if (nvl_array[i] == NULL) { - printf("wg_peer_to_nvl failed on %d peer\n", i); + if ((err = wg_peer_to_export(peer, &wpe[i])) != 0) { + printf("wg_peer_to_export failed on %d peer, error %d\n", + i, err); break; } -#ifdef INVARIANTS - packed = nvlist_pack(nvl_array[i], &size); - if (packed == NULL) { - printf("nvlist_pack(%p, %p) => %d", - nvl_array[i], &size, nvlist_error(nvl)); - } - free(packed, M_NVLIST); -#endif + i++; if (i == peer_count) break; } NET_EPOCH_EXIT(et); + + if (err != 0) + goto out; + + /* Update the peer count, in case we found fewer entries. */ *peer_countp = peer_count = i; if (peer_count == 0) { printf("no peers found in list\n"); err = ENOENT; goto out; } + + for (i = 0; i < peer_count; i++) { + nvl_array[i] = wg_peer_export_to_nvl(&wpe[i]); + if (nvl_array[i] == NULL) { + printf("wg_peer_export_to_nvl failed on %d peer\n", i); + break; + } + } + if (nvl) { nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * const *)nvl_array, peer_count); @@ -486,8 +535,21 @@ wg_marshal_peers(struct wg_softc *sc, nvlist_t **nvlp, nvlist_t ***nvl_arrayp, i *nvlp = nvl; } *nvl_arrayp = nvl_array; - return (0); + err = 0; out: + if (err != 0) { + for (i = 0; i < peer_count; i++) { + nvlist_destroy(nvl_array[i]); + } + + free(nvl_array, M_TEMP); + if (nvl != NULL) + nvlist_destroy(nvl); + } + + for (i = 0; i < peer_count; i++) + free(wpe[i].aip, M_TEMP); + free(wpe, M_TEMP); return (err); } From owner-dev-commits-src-all@freebsd.org Tue Mar 9 11:17:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E5F2575D54; Tue, 9 Mar 2021 11:17: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 4Dvt3g0Fdkz3nSW; Tue, 9 Mar 2021 11:17: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 C660D1B40B; Tue, 9 Mar 2021 11:17: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 129BHO76042852; Tue, 9 Mar 2021 11:17:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129BHOZa042851; Tue, 9 Mar 2021 11:17:24 GMT (envelope-from git) Date: Tue, 9 Mar 2021 11:17:24 GMT Message-Id: <202103091117.129BHOZa042851@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: 1ae20f7c70ea - main - kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() 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: 1ae20f7c70ea16fa8b702e409030e170df4f5c13 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 11:17:54 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1ae20f7c70ea16fa8b702e409030e170df4f5c13 commit 1ae20f7c70ea16fa8b702e409030e170df4f5c13 Author: Kyle Evans AuthorDate: 2021-03-08 06:16:27 +0000 Commit: Kyle Evans CommitDate: 2021-03-09 11:16:39 +0000 kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() Simple condition flip; we wanted to panic here after epoch_trace_list(). Reviewed by: glebius, markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29125 --- sys/kern/kern_malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 48383358e3ad..0d6f9dcfcab7 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -537,7 +537,7 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_type *mtp, #ifdef EPOCH_TRACE epoch_trace_list(curthread); #endif - KASSERT(1, + KASSERT(0, ("malloc(M_WAITOK) with sleeping prohibited")); } } From owner-dev-commits-src-all@freebsd.org Tue Mar 9 13:28:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A69455204A; Tue, 9 Mar 2021 13:28: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 4DvwyL3Yp4z4QqW; Tue, 9 Mar 2021 13:28: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 628F01CB2F; Tue, 9 Mar 2021 13:28: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 129DSQx5015072; Tue, 9 Mar 2021 13:28:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129DSQD5015071; Tue, 9 Mar 2021 13:28:26 GMT (envelope-from git) Date: Tue, 9 Mar 2021 13:28:26 GMT Message-Id: <202103091328.129DSQD5015071@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: f61831d2e8bd - main - Revert "rc: implement parallel boot" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f61831d2e8bd44b6568b00d538e738c25190bb96 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 13:28:26 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=f61831d2e8bd44b6568b00d538e738c25190bb96 commit f61831d2e8bd44b6568b00d538e738c25190bb96 Author: Baptiste Daroussin AuthorDate: 2021-03-09 13:25:32 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-09 13:26:07 +0000 Revert "rc: implement parallel boot" This is not ready yet for prime time This reverts commit 763db58932874bb47fc6f9322ab81cc947f80991. This reverts commit f1ab799927c8e93e8f58e5039f287a2ca45675ec. This reverts commit 6e822e99570fdf4c564be04840a054bccc070222. This reverts commit 77e1ccbee3ed6c837929e4e232fd07f95bfc8294. --- libexec/rc/rc | 51 +++++++++++++++------------------------------------ 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/libexec/rc/rc b/libexec/rc/rc index 2cb840e68919..35db4a850516 100644 --- a/libexec/rc/rc +++ b/libexec/rc/rc @@ -91,36 +91,22 @@ if ! [ -e ${firstboot_sentinel} ]; then skip_firstboot="-s firstboot" fi -# rc_parallel_start default is "NO" -rc_parallel_start=${rc_parallel_start:-NO} -_rc_parallel='' -# enable rcorder -p if /etc/rc.conf rc_parallel_start is "YES" -checkyesno rc_parallel_start && _rc_parallel='-p' - # Do a first pass to get everything up to $early_late_divider so that # we can do a second pass that includes $local_startup directories # -files=`rcorder ${skip} ${skip_firstboot} ${_rc_parallel} /etc/rc.d/* 2>/dev/null` +files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* 2>/dev/null` _rc_elem_done=' ' -oldifs="$IFS" -IFS=$'\n' -for _rc_group in ${files}; do - IFS="$oldifs" - for _rc_elem in ${_rc_group}; do - run_rc_script ${_rc_elem} ${_boot} & - _rc_elem_done="${_rc_elem_done}${_rc_elem} " - - case "$_rc_elem" in - */${early_late_divider}) break ;; - esac - done - wait - IFS=$'\n' +for _rc_elem in ${files}; do + run_rc_script ${_rc_elem} ${_boot} + _rc_elem_done="${_rc_elem_done}${_rc_elem} " + + case "$_rc_elem" in + */${early_late_divider}) break ;; + esac done unset files local_rc -IFS="$oldifs" # Now that disks are mounted, for each dir in $local_startup # search for init scripts that use the new rc.d semantics. @@ -136,21 +122,14 @@ if [ -e ${firstboot_sentinel} ]; then skip_firstboot="" fi -files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} ${_rc_parallel} 2>/dev/null` -IFS=$'\n' -for _rc_group in ${files}; do - IFS="$oldifs" - for _rc_elem in ${_rc_group}; do - case "$_rc_elem_done" in - *" $_rc_elem "*) continue ;; - esac - - run_rc_script ${_rc_elem} ${_boot} & - done - wait - IFS=$'\n' +files=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* ${local_rc} 2>/dev/null` +for _rc_elem in ${files}; do + case "$_rc_elem_done" in + *" $_rc_elem "*) continue ;; + esac + + run_rc_script ${_rc_elem} ${_boot} done -IFS="$oldifs" # Remove the firstboot sentinel, and reboot if it was requested. # Be a bit paranoid about removing it to handle the common failure From owner-dev-commits-src-all@freebsd.org Tue Mar 9 14:23:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85964553D45; Tue, 9 Mar 2021 14:23: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 4Dvy9j3KzWz4V76; Tue, 9 Mar 2021 14:23: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 655B61D9AB; Tue, 9 Mar 2021 14:23: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 129ENLco093054; Tue, 9 Mar 2021 14:23:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129ENLdk093053; Tue, 9 Mar 2021 14:23:21 GMT (envelope-from git) Date: Tue, 9 Mar 2021 14:23:21 GMT Message-Id: <202103091423.129ENLdk093053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Nathan Whitehorn Subject: git: 611d83116a6c - stable/13 - Mount the EFI system partition (ESP) on newly-installed systems and VM images. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nwhitehorn X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 611d83116a6ca9132dbe72b39538f4651daeeb7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 14:23:21 -0000 The branch stable/13 has been updated by nwhitehorn: URL: https://cgit.FreeBSD.org/src/commit/?id=611d83116a6ca9132dbe72b39538f4651daeeb7e commit 611d83116a6ca9132dbe72b39538f4651daeeb7e Author: Nathan Whitehorn AuthorDate: 2021-02-23 21:16:52 +0000 Commit: Nathan Whitehorn CommitDate: 2021-03-09 14:22:58 +0000 Mount the EFI system partition (ESP) on newly-installed systems and VM images. Per hier(7), the ESP will be mounted at /boot/efi. On UFS systems, any existing ESP will be reused and mounted there; otherwise, a new one will be made. On ZFS systems, space for an ESP is allocated on all disks in the root pool, but only the partition actually used to boot is set up and mounted. This makes future upgrades of the EFI loader easier (upgrade scripts can just change /boot/efi) and also greatly simplifies the parts of the installer involved in initialization of the ESP. It also makes the installer's behavior correspond to the documentation in hier(7). Reviewed by: imp, tsoome, bdragon Approved by: re (gjb) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D28897 (cherry picked from commit 0b7472b3d8d2f1e90fade5236b44fd98d8e396c2) (cherry picked from commit 2c26d77d989abe48c662eeb6f52f7e4c9b81680c) (cherry picked from commit e77cf2a4ab32a381df3c06d25b8b4f650047c3f2) (cherry picked from commit e70eb40271512dfbca7cecf823e4b445e3989c2e) --- release/tools/arm.subr | 1 + release/tools/vmimage.subr | 11 +- usr.sbin/bsdinstall/partedit/gpart_ops.c | 12 +-- usr.sbin/bsdinstall/partedit/partedit_efi.c | 1 + usr.sbin/bsdinstall/partedit/partedit_x86.c | 4 +- usr.sbin/bsdinstall/scripts/bootconfig | 150 +++++----------------------- usr.sbin/bsdinstall/scripts/zfsboot | 19 +++- 7 files changed, 59 insertions(+), 139 deletions(-) diff --git a/release/tools/arm.subr b/release/tools/arm.subr index 343d9f3a7034..2f91490c0859 100644 --- a/release/tools/arm.subr +++ b/release/tools/arm.subr @@ -184,6 +184,7 @@ arm_install_base() { TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \ DESTDIR=${DESTDIR} KERNCONF=${KERNEL} \ ${CONF_FILES} installworld installkernel distribution + chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/efi chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/msdos arm_create_user diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr index 7bad725c9870..7bd971013656 100644 --- a/release/tools/vmimage.subr +++ b/release/tools/vmimage.subr @@ -52,7 +52,16 @@ write_partition_layout() { # Create an ESP espfilename=$(mktemp /tmp/efiboot.XXXXXX) make_esp_file ${espfilename} ${fat32min} ${BOOTFILES}/efi/loader_lua/loader_lua.efi - BOOTPARTS="${BOOTPARTS} -p efi:=${espfilename}" + BOOTPARTS="${BOOTPARTS} -p efi/efiesp:=${espfilename}" + + # Add this to fstab, requires temporarily remounting the fs + mddev=$(mdconfig -f ${VMBASE}) + mount /dev/${mddev} ${DESTDIR} + mkdir -p ${DESTDIR}/boot/efi + echo "/dev/${ROOTLABEL}/efiesp /boot/efi msdosfs rw 2 2" \ + >> ${DESTDIR}/etc/fstab + umount ${DESTDIR} + mdconfig -d -u ${mddev} fi mkimg -s ${SCHEME} -f ${VMFORMAT} \ diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c index e68a02b4264c..b49ff1c9fd42 100644 --- a/usr.sbin/bsdinstall/partedit/gpart_ops.c +++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c @@ -707,18 +707,8 @@ set_default_part_metadata(const char *name, const char *scheme, if (strcmp(type, "freebsd-swap") == 0) mountpoint = "none"; if (strcmp(type, bootpart_type(scheme, &default_bootmount)) == 0) { - if (default_bootmount == NULL) { - - int fd = openat(tmpdfd, "bsdinstall-esps", - O_CREAT | O_WRONLY | O_APPEND, 0600); - if (fd > 0) { - write(fd, md->name, strlen(md->name)); - write(fd, "\n", 1); - close(fd); - } - + if (default_bootmount == NULL) md->bootcode = 1; - } else if (mountpoint == NULL || strlen(mountpoint) == 0) mountpoint = default_bootmount; } diff --git a/usr.sbin/bsdinstall/partedit/partedit_efi.c b/usr.sbin/bsdinstall/partedit/partedit_efi.c index 85b3b15d1853..074475e07152 100644 --- a/usr.sbin/bsdinstall/partedit/partedit_efi.c +++ b/usr.sbin/bsdinstall/partedit/partedit_efi.c @@ -85,6 +85,7 @@ bootpart_type(const char *scheme, const char **mountpoint) { /* Only EFI is supported as boot partition */ + *mountpoint = "/boot/efi"; return ("efi"); } diff --git a/usr.sbin/bsdinstall/partedit/partedit_x86.c b/usr.sbin/bsdinstall/partedit/partedit_x86.c index e81adcad5f6b..6983188ba34f 100644 --- a/usr.sbin/bsdinstall/partedit/partedit_x86.c +++ b/usr.sbin/bsdinstall/partedit/partedit_x86.c @@ -113,8 +113,10 @@ const char * bootpart_type(const char *scheme, const char **mountpoint) { - if (strcmp(x86_bootmethod(), "UEFI") == 0) + if (strcmp(x86_bootmethod(), "UEFI") == 0) { + *mountpoint = "/boot/efi"; return ("efi"); + } return ("freebsd-boot"); } diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig index f07fb3065c23..a592142d87a2 100755 --- a/usr.sbin/bsdinstall/scripts/bootconfig +++ b/usr.sbin/bsdinstall/scripts/bootconfig @@ -46,84 +46,8 @@ if [ `uname -m` == powerpc ]; then fi fi -# Update the ESP (EFI System Partition) with the new bootloader -if [ "$(uname -m)" = "amd64" ] || [ "$(uname -m)" = "i386" ]; then - X86_BOOTMETHOD=$(sysctl -n machdep.bootmethod) -fi - -if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "riscv" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then - UFSBOOT_ESPS=$(cat $TMPDIR/bsdinstall-esps 2>/dev/null) - ZFSBOOT_DISKS=$(cat $TMPDIR/bsdinstall-zfsboot 2>/dev/null) - num_esps=0 - - if [ -n "$ZFSBOOT_DISKS" ]; then - # We're in a ZFS install environment - for disk in $ZFSBOOT_DISKS; do - index=$(gpart show "$disk" | cut -w -f 4,5 | grep "efi" | cut -w -f 1) - # Check that $index is an integer - [ -n "$index" ] && [ "$index" -eq "$index" ] && [ "$index" -ge 0 ] 2> /dev/null - if [ $? -ne 0 ]; then - continue - fi - - if [ -e "/dev/${disk}p${index}" ]; then - ESPS="$ESPS ${disk}p${index}" - elif [ -e "/dev/${disk}s${index}" ]; then - ESPS="$ESPS ${disk}s${index}" - else - continue - fi - - num_esps=$((num_esps + 1)) - done - fi - - if [ -n "$UFSBOOT_ESPS" ]; then - # We're in a UFS install environment - for partition in $UFSBOOT_ESPS; do - ESPS="$ESPS $partition" - num_esps=$((num_esps + 1)) - done - fi - - if [ -z "$ESPS" ]; then - # The installer hasn't given us any ESPs to use. - # Try and figure out which to use by looking for an - # unformatted efi partition - - for geom in $(gpart status -sg | awk '{print $1}'); do - hasfreebsd=$(gpart show "${geom}" | cut -w -f 4,5 | grep "freebsd") - if [ -n "$hasfreebsd" ]; then - index=$(gpart show "${geom}" | cut -w -f 4,5 | grep "efi" | cut -w -f 1) - # Check that $index is a valid integer - [ -n "$index" ] && [ "$index" -eq "$index" ] && [ "$index" -ge 0 ] 2> /dev/null - if [ $? -ne 0 ]; then - continue - fi - - mntpt=$(mktemp -d $TMPDIR/stand-test.XXXXXX) - if [ -e "/dev/${geom}p${index}" ]; then - dev=${geom}p${index} - elif [ -e "/dev/${geom}s${index}" ]; then - dev=/${geom}s${index} - else - continue - fi - - # Try and mount it. If it fails, assume it's - # unformatted and should be used. - mount -t msdosfs -o ro "/dev/${dev}" "${mntpt}" - if [ $? -ne 0 ]; then - ESPS="$ESPS ${dev}" - num_esps=$((num_esps + 1)) - else - umount "${mntpt}" - fi - rmdir "${mntpt}" - fi - done - fi - +# Update the ESP (EFI System Partition) with the new bootloader if we have an ESP +if [ -n "$(awk '{if ($2=="/boot/efi") printf("%s\n",$1);}' $PATH_FSTAB)" ]; then case $(uname -m) in arm64) ARCHBOOTNAME=aa64 ;; amd64) ARCHBOOTNAME=x64 ;; @@ -136,55 +60,33 @@ if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "riscv" ] || [ "$X86_BOOTMET BOOTNAME="${BOOTDIR}/boot${ARCHBOOTNAME}.efi" FREEBSD_BOOTDIR="/efi/freebsd" FREEBSD_BOOTNAME="${FREEBSD_BOOTDIR}/loader.efi" + mntpt="$BSDINSTALL_CHROOT/boot/efi" + + f_dprintf "Installing loader.efi onto ESP" + mkdir -p "${mntpt}/${FREEBSD_BOOTDIR}" "${mntpt}/${BOOTDIR}" + cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${FREEBSD_BOOTNAME}" + + # + # The following shouldn't be necessary. UEFI defines a way to + # specifically select what to boot (which we do via + # efibootmgr). However, virtual environments often times lack + # support for the NV variables efibootmgr sets. In addition, + # some UEFI implementations have features that interfere with + # the setting of these variables. To combat that, we install the + # default removable media boot file as a fallback if it doesn't + # exist. We don't install it all the time since that can + # interfere with other installations on the drive (like rEFInd). + # + if [ ! -f "${mntpt}/${BOOTNAME}" ]; then + cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${BOOTNAME}" + fi - for esp in $ESPS; do - f_dprintf "Formatting /dev/${esp} as FAT32" - newfs_msdos -F 32 -c 1 -L EFISYS "/dev/$esp" > /dev/null 2>&1 - if [ $? -ne 0 ]; then - die "Failed to format ESP $esp as FAT32" - fi - - mntpt=$(mktemp -d $TMPDIR/stand-test.XXXXXX) - f_dprintf "Mounting ESP /dev/${esp}" - mount -t msdosfs "/dev/${esp}" "${mntpt}" - if [ $? -ne 0 ]; then - die "Failed to mount ESP ${dev} on ${mntpt}" - fi - - f_dprintf "Installing loader.efi onto ESP" - mkdir -p "${mntpt}/${FREEBSD_BOOTDIR}" "${mntpt}/${BOOTDIR}" - cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${FREEBSD_BOOTNAME}" - - # - # The following shouldn't be necessary. UEFI defines a way to - # specifically select what to boot (which we do via - # efibootmgr). However, virtual environments often times lack - # support for the NV variables efibootmgr sets. In addition, - # some UEFI implementations have features that interfere with - # the setting of these variables. To combat that, we install the - # default removable media boot file as a fallback if it doesn't - # exist. We don't install it all the time since that can - # interfere with other installations on the drive (like rEFInd). - # - if [ ! -f "${mntpt}/${BOOTNAME}" ]; then - cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${BOOTNAME}" - fi - - if [ "$num_esps" -gt 1 ]; then - bootlabel="FreeBSD (${esp})" - else - bootlabel="FreeBSD" - fi - - f_dprintf "Creating UEFI boot entry" - efibootmgr --create --activate --label "$bootlabel" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null + bootlabel="FreeBSD" - f_dprintf "Unmounting ESP" - umount "${mntpt}" - rmdir "${mntpt}" + f_dprintf "Creating UEFI boot entry" + efibootmgr --create --activate --label "$bootlabel" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null - f_dprintf "Finished configuring /dev/${esp} as ESP" - done + f_dprintf "Finished configuring ESP" fi # Add boot0cfg for MBR BIOS booting? diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index 33cec0ef9ae9..3b673addb10a 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -213,6 +213,7 @@ KLDLOAD='kldload %s' LN_SF='ln -sf "%s" "%s"' MKDIR_P='mkdir -p "%s"' MOUNT_TYPE='mount -t %s "%s" "%s"' +NEWFS_ESP='newfs_msdos "%s"' PRINTF_CONF="printf '%s=\"%%s\"\\\n' %s >> \"%s\"" PRINTF_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"' SHELL_TRUNCATE=':> "%s"' @@ -845,12 +846,25 @@ zfs_create_diskpart() if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" -o \ "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ] then - f_eval_catch $funcname gpart \ + f_eval_catch -k justaddedpart $funcname gpart \ "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ - "$align_small" efiboot$index efi 200M \ + "$align_small" efiboot$index efi 260M \ $disk || return $FAILURE # We'll configure the ESP in bootconfig + if [ -z "$efibootpart" ]; then + efibootpart="/dev/$(echo $justaddedpart | cut -f 1 -d ' ')" + f_dprintf "$funcname: configuring ESP at [%s]" \ + "${efibootpart}" + + f_eval_catch $funcname newfs_msdos "$NEWFS_ESP"\ + "$efibootpart" \ + || return $FAILURE + f_eval_catch $funcname printf "$PRINTF_FSTAB" \ + $efibootpart /boot/efi msdosfs \ + rw 2 2 "$BSDINSTALL_TMPETC/fstab" \ + || return $FAILURE + fi fi if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o \ @@ -1066,6 +1080,7 @@ zfs_create_boot() local isswapmirror local bootpart targetpart swappart # Set by zfs_create_diskpart() below local create_options + local efibootpart # # Pedantic checks; should never be seen From owner-dev-commits-src-all@freebsd.org Tue Mar 9 14:29:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6A815541A0; Tue, 9 Mar 2021 14:29: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 4DvyKG4KtBz4VF0; Tue, 9 Mar 2021 14:29: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 874F81DB92; Tue, 9 Mar 2021 14:29: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 129ETsnJ094151; Tue, 9 Mar 2021 14:29:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129ETsJu094150; Tue, 9 Mar 2021 14:29:54 GMT (envelope-from git) Date: Tue, 9 Mar 2021 14:29:54 GMT Message-Id: <202103091429.129ETsJu094150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: c4dbe899aa08 - stable/13 - clang: Fix -gz=zlib options for linker 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c4dbe899aa08f60b66426ecf63b1346bffe25ed8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 14:29:54 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c4dbe899aa08f60b66426ecf63b1346bffe25ed8 commit c4dbe899aa08f60b66426ecf63b1346bffe25ed8 Author: Ed Maste AuthorDate: 2021-03-03 01:35:57 +0000 Commit: Ed Maste CommitDate: 2021-03-09 14:28:54 +0000 clang: Fix -gz=zlib options for linker Clang commit ccb4124a4172bf2cb2e1cd7c253f0f1654fce294: Fix -gz=zlib options for linker gcc translates -gz=zlib to --compress-debug-options=zlib for both assembler and linker but clang only does this for assembler. The linker needs --compress-debug-options=zlib option to compress the debug sections in the generated executable or shared library. Due to this bug, -gz=zlib has no effect on the generated executable or shared library. This patch fixes that. Clang commit 462cf39a5c180621b56f7602270ce33eb7b68d23: [Driver] Fix -gz=zlib options for linker also on FreeBSD ccb4124a4172 fixed translating -gz=zlib to --compress-debug-sections for linker invocation for several ToolChains, but omitted FreeBSD. PR: 253942 Approved by: dim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29028 (cherry picked from commit 19587d742264c5caec33d218e9cea6eb78f6c6bb) --- .../clang/lib/Driver/ToolChains/AMDGPU.cpp | 1 + .../clang/lib/Driver/ToolChains/CommonArgs.cpp | 18 ++++++++++++++++++ .../clang/lib/Driver/ToolChains/CommonArgs.h | 4 ++++ .../clang/lib/Driver/ToolChains/FreeBSD.cpp | 1 + .../llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp | 1 + .../llvm-project/clang/lib/Driver/ToolChains/HIP.cpp | 2 ++ 6 files changed, 27 insertions(+) diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/AMDGPU.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/AMDGPU.cpp index bc6d1fcd4a00..10ae76cb4161 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/AMDGPU.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/AMDGPU.cpp @@ -350,6 +350,7 @@ void amdgpu::Linker::ConstructJob(Compilation &C, const JobAction &JA, std::string Linker = getToolChain().GetProgramPath(getShortName()); ArgStringList CmdArgs; + addLinkerCompressDebugSectionsOption(getToolChain(), Args, CmdArgs); AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA); CmdArgs.push_back("-shared"); CmdArgs.push_back("-o"); diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp index 6b6e276b8ce7..535154e492a7 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -214,6 +214,24 @@ void tools::AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, } } +void tools::addLinkerCompressDebugSectionsOption( + const ToolChain &TC, const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) { + // GNU ld supports --compress-debug-sections=none|zlib|zlib-gnu|zlib-gabi + // whereas zlib is an alias to zlib-gabi. Therefore -gz=none|zlib|zlib-gnu + // are translated to --compress-debug-sections=none|zlib|zlib-gnu. + // -gz is not translated since ld --compress-debug-sections option requires an + // argument. + if (const Arg *A = Args.getLastArg(options::OPT_gz_EQ)) { + StringRef V = A->getValue(); + if (V == "none" || V == "zlib" || V == "zlib-gnu") + CmdArgs.push_back(Args.MakeArgString("--compress-debug-sections=" + V)); + else + TC.getDriver().Diag(diag::err_drv_unsupported_option_argument) + << A->getOption().getName() << V; + } +} + void tools::AddTargetFeature(const ArgList &Args, std::vector &Features, OptSpecifier OnOpt, OptSpecifier OffOpt, diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.h b/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.h index 29dedec9b09c..0028ea0ca337 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.h +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.h @@ -27,6 +27,10 @@ void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA); +void addLinkerCompressDebugSectionsOption(const ToolChain &TC, + const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs); + void claimNoWarnArgs(const llvm::opt::ArgList &Args); bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args, diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp index 909ac5e99212..6d8e25470e28 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.cpp @@ -283,6 +283,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs); bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs); + addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) { diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp index c8a7fce07ef1..23e7a70f2fa7 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/Gnu.cpp @@ -568,6 +568,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs); bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs); + addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs); AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); // The profile runtime also needs access to system libraries. getToolChain().addProfileRTLibs(Args, CmdArgs); diff --git a/contrib/llvm-project/clang/lib/Driver/ToolChains/HIP.cpp b/contrib/llvm-project/clang/lib/Driver/ToolChains/HIP.cpp index 7d17f809690e..228d970c4043 100644 --- a/contrib/llvm-project/clang/lib/Driver/ToolChains/HIP.cpp +++ b/contrib/llvm-project/clang/lib/Driver/ToolChains/HIP.cpp @@ -88,6 +88,8 @@ void AMDGCN::Linker::constructLldCommand(Compilation &C, const JobAction &JA, if (C.getDriver().isSaveTempsEnabled()) LldArgs.push_back("-save-temps"); + addLinkerCompressDebugSectionsOption(TC, Args, LldArgs); + LldArgs.append({"-o", Output.getFilename()}); for (auto Input : Inputs) LldArgs.push_back(Input.getFilename()); From owner-dev-commits-src-all@freebsd.org Tue Mar 9 14:31:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 637625541D0; Tue, 9 Mar 2021 14:31: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 4DvyLg2QMfz4Vng; Tue, 9 Mar 2021 14:31: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 4634B1DA38; Tue, 9 Mar 2021 14:31: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 129EV798001888; Tue, 9 Mar 2021 14:31:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129EV7Gc001887; Tue, 9 Mar 2021 14:31:07 GMT (envelope-from git) Date: Tue, 9 Mar 2021 14:31:07 GMT Message-Id: <202103091431.129EV7Gc001887@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: 1ceb3c6c3bdb - releng/13.0 - loader: cursor off should restore display content 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 1ceb3c6c3bdbd0feabe1e071cac1a464bba125b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 14:31:07 -0000 The branch releng/13.0 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=1ceb3c6c3bdbd0feabe1e071cac1a464bba125b1 commit 1ceb3c6c3bdbd0feabe1e071cac1a464bba125b1 Author: Toomas Soome AuthorDate: 2021-03-06 10:19:43 +0000 Commit: Toomas Soome CommitDate: 2021-03-09 14:30:47 +0000 loader: cursor off should restore display content When drawing cursor, we should store original display content because there may be image data we would like to restore when the cursor is removed. PR: 254054 Reported by: Jose Luis Duran Approved by: re (gjb) (cherry picked from commit d708f23ebb06cfc9cf8f96f17a43eb63653b818a) --- stand/common/gfx_fb.c | 38 ++++++++++++++++++++++++++++++++++++++ stand/common/gfx_fb.h | 2 ++ 2 files changed, 40 insertions(+) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 77cf1d39854f..3eae0a3a859e 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -978,6 +978,7 @@ gfx_fb_fill(void *arg, const teken_rect_t *r, teken_char_t c, static void gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *p, bool on) { + unsigned x, y, width, height; const uint8_t *glyph; int idx; @@ -985,10 +986,47 @@ gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *p, bool on) if (idx >= state->tg_tp.tp_col * state->tg_tp.tp_row) return; + width = state->tg_font.vf_width; + height = state->tg_font.vf_height; + x = state->tg_origin.tp_col + p->tp_col * width; + y = state->tg_origin.tp_row + p->tp_row * height; + + /* + * Save original display content to preserve image data. + */ + if (on) { + if (state->tg_cursor_image == NULL || + state->tg_cursor_size != width * height * 4) { + free(state->tg_cursor_image); + state->tg_cursor_size = width * height * 4; + state->tg_cursor_image = malloc(state->tg_cursor_size); + } + if (state->tg_cursor_image != NULL) { + if (gfxfb_blt(state->tg_cursor_image, + GfxFbBltVideoToBltBuffer, x, y, 0, 0, + width, height, 0) != 0) { + free(state->tg_cursor_image); + state->tg_cursor_image = NULL; + } + } + } else { + /* + * Restore display from tg_cursor_image. + * If there is no image, restore char from screen_buffer. + */ + if (state->tg_cursor_image != NULL && + gfxfb_blt(state->tg_cursor_image, GfxFbBltBufferToVideo, + 0, 0, x, y, width, height, 0) == 0) { + state->tg_cursor = *p; + return; + } + } + glyph = font_lookup(&state->tg_font, screen_buffer[idx].c, &screen_buffer[idx].a); gfx_bitblt_bitmap(state, glyph, &screen_buffer[idx].a, 0xff, on); gfx_fb_printchar(state, p); + state->tg_cursor = *p; } diff --git a/stand/common/gfx_fb.h b/stand/common/gfx_fb.h index ac63d7939cef..89b060a02cf9 100644 --- a/stand/common/gfx_fb.h +++ b/stand/common/gfx_fb.h @@ -210,6 +210,8 @@ typedef struct teken_gfx { teken_t tg_teken; /* Teken core */ teken_pos_t tg_cursor; /* Where cursor was drawn */ bool tg_cursor_visible; + uint8_t *tg_cursor_image; /* Memory for cursor */ + size_t tg_cursor_size; teken_pos_t tg_tp; /* Terminal dimensions */ teken_pos_t tg_origin; /* Point of origin in pixels */ uint8_t *tg_glyph; /* Memory for glyph */ From owner-dev-commits-src-all@freebsd.org Tue Mar 9 15:38:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B38BE556D50; Tue, 9 Mar 2021 15:38:15 +0000 (UTC) (envelope-from lwhsu@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 4Dvzr74jnrz4bK9; Tue, 9 Mar 2021 15:38:15 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) (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: lwhsu/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 8F789267BA; Tue, 9 Mar 2021 15:38:15 +0000 (UTC) (envelope-from lwhsu@freebsd.org) Received: by mail-yb1-f179.google.com with SMTP id x19so14432697ybe.0; Tue, 09 Mar 2021 07:38:15 -0800 (PST) X-Gm-Message-State: AOAM530i2hq8qKlbeGoEmwr6XIxPFMYbkfyMivddZsj7xHKReEDldFwV rPt7Cy60HzQq/ridKrxJlzsOYtP+kY6od9Ys0W8= X-Google-Smtp-Source: ABdhPJyvf5kmkM07ai8Ev3IKgTVmkk9kcZHRmPbYFPLeY9QKzM1RL8d84Ix+VyjO3CgnJvv5WQY9El+jk4Xsu8sZh9E= X-Received: by 2002:a25:34d5:: with SMTP id b204mr40863558yba.497.1615304295053; Tue, 09 Mar 2021 07:38:15 -0800 (PST) MIME-Version: 1.0 References: <202103091117.129BHOZa042851@gitrepo.freebsd.org> In-Reply-To: <202103091117.129BHOZa042851@gitrepo.freebsd.org> From: Li-Wen Hsu Date: Tue, 9 Mar 2021 23:38:04 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 1ae20f7c70ea - main - kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() To: Kyle Evans 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 15:38:15 -0000 On Tue, Mar 9, 2021 at 7:18 PM Kyle Evans wrote: > > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=1ae20f7c70ea16fa8b702e409030e170df4f5c13 > > commit 1ae20f7c70ea16fa8b702e409030e170df4f5c13 > Author: Kyle Evans > AuthorDate: 2021-03-08 06:16:27 +0000 > Commit: Kyle Evans > CommitDate: 2021-03-09 11:16:39 +0000 > > kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() > > Simple condition flip; we wanted to panic here after epoch_trace_list(). > > Reviewed by: glebius, markj > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D29125 > --- > sys/kern/kern_malloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c > index 48383358e3ad..0d6f9dcfcab7 100644 > --- a/sys/kern/kern_malloc.c > +++ b/sys/kern/kern_malloc.c > @@ -537,7 +537,7 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_type *mtp, > #ifdef EPOCH_TRACE > epoch_trace_list(curthread); > #endif > - KASSERT(1, > + KASSERT(0, > ("malloc(M_WAITOK) with sleeping prohibited")); > } > } I guess this reveals a bug in gmirror? Now the test case sys/geom/class/mirror/8_test:main panics: https://ci.freebsd.org/job/FreeBSD-main-amd64-test/17779/console https://ci.freebsd.org/job/FreeBSD-main-i386-test/11831/console Li-Wen From owner-dev-commits-src-all@freebsd.org Tue Mar 9 16:43:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 744AC568CC1; Tue, 9 Mar 2021 16:43: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 4Dw1HP2rfwz4fxw; Tue, 9 Mar 2021 16:43: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 54BB11F7BA; Tue, 9 Mar 2021 16:43: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 129GhTkf077302; Tue, 9 Mar 2021 16:43:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129GhTSj077301; Tue, 9 Mar 2021 16:43:29 GMT (envelope-from git) Date: Tue, 9 Mar 2021 16:43:29 GMT Message-Id: <202103091643.129GhTSj077301@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: 043577b721ec - main - ofwfb: fix boot on LE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 043577b721ec4e5c2ab7571e6c05cfd54e49473c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 16:43:29 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=043577b721ec4e5c2ab7571e6c05cfd54e49473c commit 043577b721ec4e5c2ab7571e6c05cfd54e49473c Author: Leandro Lupori AuthorDate: 2021-03-09 15:11:58 +0000 Commit: Leandro Lupori CommitDate: 2021-03-09 16:29:24 +0000 ofwfb: fix boot on LE Some framebuffer properties obtained from the device tree were not being properly converted to host endian. Replace OF_getprop calls by OF_getencprop where needed to fix this. This fixes boot on PowerPC64 LE, when using ofwfb as the system console. Reviewed by: bdragon Sponsored by: Eldorado Research Institute (eldorado.org.br) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27475 --- sys/dev/vt/hw/ofwfb/ofwfb.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/dev/vt/hw/ofwfb/ofwfb.c b/sys/dev/vt/hw/ofwfb/ofwfb.c index 8a1b7b3688a7..9dc674c0ebf9 100644 --- a/sys/dev/vt/hw/ofwfb/ofwfb.c +++ b/sys/dev/vt/hw/ofwfb/ofwfb.c @@ -108,7 +108,7 @@ ofwfb_probe(struct vt_device *vd) return (CN_DEAD); node = -1; - if (OF_getprop(chosen, "stdout", &stdout, sizeof(stdout)) == + if (OF_getencprop(chosen, "stdout", &stdout, sizeof(stdout)) == sizeof(stdout)) node = OF_instance_to_package(stdout); if (node == -1) @@ -386,7 +386,7 @@ ofwfb_init(struct vt_device *vd) char buf[64]; phandle_t chosen; phandle_t node; - uint32_t depth, height, width, stride; + pcell_t depth, height, width, stride; uint32_t vendor_id = 0; cell_t adr[2]; uint64_t user_phys; @@ -399,7 +399,7 @@ ofwfb_init(struct vt_device *vd) node = -1; chosen = OF_finddevice("/chosen"); - if (OF_getprop(chosen, "stdout", &sc->sc_handle, + if (OF_getencprop(chosen, "stdout", &sc->sc_handle, sizeof(ihandle_t)) == sizeof(ihandle_t)) node = OF_instance_to_package(sc->sc_handle); if (node == -1) @@ -448,14 +448,14 @@ ofwfb_init(struct vt_device *vd) return (CN_DEAD); /* Only support 8 and 32-bit framebuffers */ - OF_getprop(node, "depth", &depth, sizeof(depth)); + OF_getencprop(node, "depth", &depth, sizeof(depth)); if (depth != 8 && depth != 32) return (CN_DEAD); sc->fb.fb_bpp = sc->fb.fb_depth = depth; - OF_getprop(node, "height", &height, sizeof(height)); - OF_getprop(node, "width", &width, sizeof(width)); - if (OF_getprop(node, "linebytes", &stride, sizeof(stride)) != + OF_getencprop(node, "height", &height, sizeof(height)); + OF_getencprop(node, "width", &width, sizeof(width)); + if (OF_getencprop(node, "linebytes", &stride, sizeof(stride)) != sizeof(stride)) stride = width*depth/8; @@ -537,11 +537,11 @@ ofwfb_init(struct vt_device *vd) * may be the child of the PCI device: in that case, try the * parent for the assigned-addresses property. */ - len = OF_getprop(node, "assigned-addresses", pciaddrs, - sizeof(pciaddrs)); + len = OF_getencprop(node, "assigned-addresses", + (pcell_t *)pciaddrs, sizeof(pciaddrs)); if (len == -1) { - len = OF_getprop(OF_parent(node), "assigned-addresses", - pciaddrs, sizeof(pciaddrs)); + len = OF_getencprop(OF_parent(node), "assigned-addresses", + (pcell_t *)pciaddrs, sizeof(pciaddrs)); } if (len == -1) len = 0; From owner-dev-commits-src-all@freebsd.org Tue Mar 9 17:33:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A47C956AF89; Tue, 9 Mar 2021 17:33: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 4Dw2P84G2Rz4kT5; Tue, 9 Mar 2021 17:33: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 848E11FED6; Tue, 9 Mar 2021 17:33: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 129HXWWk043251; Tue, 9 Mar 2021 17:33:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129HXWVF043250; Tue, 9 Mar 2021 17:33:32 GMT (envelope-from git) Date: Tue, 9 Mar 2021 17:33:32 GMT Message-Id: <202103091733.129HXWVF043250@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: e4b8deb22227 - main - amd64 pmap: convert to counter(9), add PV and pagetable page counts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e4b8deb222278b2a12c9c67021b406625f5be301 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 17:33:32 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=e4b8deb222278b2a12c9c67021b406625f5be301 commit e4b8deb222278b2a12c9c67021b406625f5be301 Author: Jason A. Harmening AuthorDate: 2021-02-25 05:08:42 +0000 Commit: Jason A. Harmening CommitDate: 2021-03-09 17:27:10 +0000 amd64 pmap: convert to counter(9), add PV and pagetable page counts This change converts most of the counters in the amd64 pmap from global atomics to scalable counter(9) counters. Per discussion with kib@, it also removes the handrolled per-CPU PCID save count as it isn't considered generally useful. The bulk of these counters remain guarded by PV_STATS, as it seems unlikely that they will be useful outside of very specific debugging scenarios. However, this change does add two new counters that are available without PV_STATS. pt_page_count and pv_page_count track the number of active physical-to-virtual list pages and page table pages, respectively. These will be useful in evaluating the memory footprint of pmap structures under various workloads, which will help to guide future changes in this area. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28923 --- sys/amd64/amd64/genassym.c | 1 - sys/amd64/amd64/pmap.c | 274 +++++++++++++++++++++++++-------------------- sys/amd64/include/pcpu.h | 3 +- 3 files changed, 155 insertions(+), 123 deletions(-) diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c index f89c53e75508..7c29368828d0 100644 --- a/sys/amd64/amd64/genassym.c +++ b/sys/amd64/amd64/genassym.c @@ -227,7 +227,6 @@ ASSYM(PC_GS32P, offsetof(struct pcpu, pc_gs32p)); ASSYM(PC_LDT, offsetof(struct pcpu, pc_ldt)); ASSYM(PC_COMMONTSS, offsetof(struct pcpu, pc_common_tss)); ASSYM(PC_TSS, offsetof(struct pcpu, pc_tss)); -ASSYM(PC_PM_SAVE_CNT, offsetof(struct pcpu, pc_pm_save_cnt)); ASSYM(PC_KCR3, offsetof(struct pcpu, pc_kcr3)); ASSYM(PC_UCR3, offsetof(struct pcpu, pc_ucr3)); ASSYM(PC_UCR3_LOAD_MASK, offsetof(struct pcpu, pc_ucr3_load_mask)); diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index f509c40e760a..d153f937b888 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -535,21 +535,9 @@ static int pmap_pkru_copy(pmap_t dst_pmap, pmap_t src_pmap); static int pmap_pkru_deassign(pmap_t pmap, vm_offset_t sva, vm_offset_t eva); static void pmap_pkru_deassign_all(pmap_t pmap); -static int -pmap_pcid_save_cnt_proc(SYSCTL_HANDLER_ARGS) -{ - int i; - uint64_t res; - - res = 0; - CPU_FOREACH(i) { - res += cpuid_to_pcpu[i]->pc_pm_save_cnt; - } - return (sysctl_handle_64(oidp, &res, 0, req)); -} -SYSCTL_PROC(_vm_pmap, OID_AUTO, pcid_save_cnt, CTLTYPE_U64 | CTLFLAG_RD | - CTLFLAG_MPSAFE, NULL, 0, pmap_pcid_save_cnt_proc, "QU", - "Count of saved TLB context on switch"); +static COUNTER_U64_DEFINE_EARLY(pcid_save_cnt); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pcid_save_cnt, CTLFLAG_RD, + &pcid_save_cnt, "Count of saved TLB context on switch"); static LIST_HEAD(, pmap_invl_gen) pmap_invl_gen_tracker = LIST_HEAD_INITIALIZER(&pmap_invl_gen_tracker); @@ -769,19 +757,30 @@ pmap_di_store_invl(struct pmap_invl_gen *ptr, struct pmap_invl_gen *old_val, return (res); } +static COUNTER_U64_DEFINE_EARLY(pv_page_count); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pv_page_count, CTLFLAG_RD, + &pv_page_count, "Current number of allocated pv pages"); + +static COUNTER_U64_DEFINE_EARLY(pt_page_count); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pt_page_count, CTLFLAG_RD, + &pt_page_count, "Current number of allocated page table pages"); + #ifdef PV_STATS -static long invl_start_restart; -SYSCTL_LONG(_vm_pmap, OID_AUTO, invl_start_restart, CTLFLAG_RD, - &invl_start_restart, 0, - ""); -static long invl_finish_restart; -SYSCTL_LONG(_vm_pmap, OID_AUTO, invl_finish_restart, CTLFLAG_RD, - &invl_finish_restart, 0, - ""); + +static COUNTER_U64_DEFINE_EARLY(invl_start_restart); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, invl_start_restart, + CTLFLAG_RD, &invl_start_restart, + "Number of delayed TLB invalidation request restarts"); + +static COUNTER_U64_DEFINE_EARLY(invl_finish_restart); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, invl_finish_restart, CTLFLAG_RD, + &invl_finish_restart, + "Number of delayed TLB invalidation completion restarts"); + static int invl_max_qlen; SYSCTL_INT(_vm_pmap, OID_AUTO, invl_max_qlen, CTLFLAG_RD, &invl_max_qlen, 0, - ""); + "Maximum delayed TLB invalidation request queue length"); #endif #define di_delay locks_delay @@ -819,7 +818,7 @@ again: PV_STAT(i++); prevl = (uintptr_t)atomic_load_ptr(&p->next); if ((prevl & PMAP_INVL_GEN_NEXT_INVALID) != 0) { - PV_STAT(atomic_add_long(&invl_start_restart, 1)); + PV_STAT(counter_u64_add(invl_start_restart, 1)); lock_delay(&lda); goto again; } @@ -833,7 +832,7 @@ again: #endif if (!pmap_di_load_invl(p, &prev) || prev.next != NULL) { - PV_STAT(atomic_add_long(&invl_start_restart, 1)); + PV_STAT(counter_u64_add(invl_start_restart, 1)); lock_delay(&lda); goto again; } @@ -862,7 +861,7 @@ again: */ if (!pmap_di_store_invl(p, &prev, &new_prev)) { critical_exit(); - PV_STAT(atomic_add_long(&invl_start_restart, 1)); + PV_STAT(counter_u64_add(invl_start_restart, 1)); lock_delay(&lda); goto again; } @@ -926,7 +925,7 @@ again: for (p = &pmap_invl_gen_head; p != NULL; p = (void *)prevl) { prevl = (uintptr_t)atomic_load_ptr(&p->next); if ((prevl & PMAP_INVL_GEN_NEXT_INVALID) != 0) { - PV_STAT(atomic_add_long(&invl_finish_restart, 1)); + PV_STAT(counter_u64_add(invl_finish_restart, 1)); lock_delay(&lda); goto again; } @@ -939,7 +938,7 @@ again: * thread before us finished its DI and started it again. */ if (__predict_false(p == NULL)) { - PV_STAT(atomic_add_long(&invl_finish_restart, 1)); + PV_STAT(counter_u64_add(invl_finish_restart, 1)); lock_delay(&lda); goto again; } @@ -951,7 +950,7 @@ again: atomic_clear_ptr((uintptr_t *)&invl_gen->next, PMAP_INVL_GEN_NEXT_INVALID); critical_exit(); - PV_STAT(atomic_add_long(&invl_finish_restart, 1)); + PV_STAT(counter_u64_add(invl_finish_restart, 1)); lock_delay(&lda); goto again; } @@ -987,12 +986,15 @@ DB_SHOW_COMMAND(di_queue, pmap_di_queue) #endif #ifdef PV_STATS -static long invl_wait; -SYSCTL_LONG(_vm_pmap, OID_AUTO, invl_wait, CTLFLAG_RD, &invl_wait, 0, +static COUNTER_U64_DEFINE_EARLY(invl_wait); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, invl_wait, + CTLFLAG_RD, &invl_wait, "Number of times DI invalidation blocked pmap_remove_all/write"); -static long invl_wait_slow; -SYSCTL_LONG(_vm_pmap, OID_AUTO, invl_wait_slow, CTLFLAG_RD, &invl_wait_slow, 0, - "Number of slow invalidation waits for lockless DI"); + +static COUNTER_U64_DEFINE_EARLY(invl_wait_slow); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, invl_wait_slow, CTLFLAG_RD, + &invl_wait_slow, "Number of slow invalidation waits for lockless DI"); + #endif #ifdef NUMA @@ -1066,7 +1068,7 @@ pmap_delayed_invl_wait_l(vm_page_t m) while (*m_gen > pmap_invl_gen) { #ifdef PV_STATS if (!accounted) { - atomic_add_long(&invl_wait, 1); + counter_u64_add(invl_wait, 1); accounted = true; } #endif @@ -1086,7 +1088,7 @@ pmap_delayed_invl_wait_u(vm_page_t m) lock_delay_arg_init(&lda, &di_delay); while (*m_gen > atomic_load_long(&pmap_invl_gen_head.gen)) { if (fast || !pmap_invl_callout_inited) { - PV_STAT(atomic_add_long(&invl_wait, 1)); + PV_STAT(counter_u64_add(invl_wait, 1)); lock_delay(&lda); fast = false; } else { @@ -1119,7 +1121,7 @@ pmap_delayed_invl_wait_u(vm_page_t m) atomic_load_long(&pmap_invl_gen_head.gen)) { callout_reset(&pmap_invl_callout, 1, pmap_delayed_invl_callout_func, NULL); - PV_STAT(atomic_add_long(&invl_wait_slow, 1)); + PV_STAT(counter_u64_add(invl_wait_slow, 1)); pmap_delayed_invl_wait_block(m_gen, &pmap_invl_gen_head.gen); } @@ -2459,28 +2461,28 @@ SYSCTL_UINT(_vm_pmap, OID_AUTO, large_map_pml4_entries, static SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "2MB page mapping counters"); -static u_long pmap_pde_demotions; -SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, demotions, CTLFLAG_RD, - &pmap_pde_demotions, 0, "2MB page demotions"); +static COUNTER_U64_DEFINE_EARLY(pmap_pde_demotions); +SYSCTL_COUNTER_U64(_vm_pmap_pde, OID_AUTO, demotions, + CTLFLAG_RD, &pmap_pde_demotions, "2MB page demotions"); -static u_long pmap_pde_mappings; -SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, mappings, CTLFLAG_RD, - &pmap_pde_mappings, 0, "2MB page mappings"); +static COUNTER_U64_DEFINE_EARLY(pmap_pde_mappings); +SYSCTL_COUNTER_U64(_vm_pmap_pde, OID_AUTO, mappings, CTLFLAG_RD, + &pmap_pde_mappings, "2MB page mappings"); -static u_long pmap_pde_p_failures; -SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, p_failures, CTLFLAG_RD, - &pmap_pde_p_failures, 0, "2MB page promotion failures"); +static COUNTER_U64_DEFINE_EARLY(pmap_pde_p_failures); +SYSCTL_COUNTER_U64(_vm_pmap_pde, OID_AUTO, p_failures, CTLFLAG_RD, + &pmap_pde_p_failures, "2MB page promotion failures"); -static u_long pmap_pde_promotions; -SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, promotions, CTLFLAG_RD, - &pmap_pde_promotions, 0, "2MB page promotions"); +static COUNTER_U64_DEFINE_EARLY(pmap_pde_promotions); +SYSCTL_COUNTER_U64(_vm_pmap_pde, OID_AUTO, promotions, CTLFLAG_RD, + &pmap_pde_promotions, "2MB page promotions"); static SYSCTL_NODE(_vm_pmap, OID_AUTO, pdpe, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "1GB page mapping counters"); -static u_long pmap_pdpe_demotions; -SYSCTL_ULONG(_vm_pmap_pdpe, OID_AUTO, demotions, CTLFLAG_RD, - &pmap_pdpe_demotions, 0, "1GB page demotions"); +static COUNTER_U64_DEFINE_EARLY(pmap_pdpe_demotions); +SYSCTL_COUNTER_U64(_vm_pmap_pdpe, OID_AUTO, demotions, CTLFLAG_RD, + &pmap_pdpe_demotions, "1GB page demotions"); /*************************************************** * Low level helper routines..... @@ -4016,6 +4018,8 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free) pmap_unwire_ptp(pmap, va, pml4pg, free); } + counter_u64_add(pt_page_count, -1); + /* * Put page on a list so that it is released after * *ALL* TLB shootdown is done @@ -4196,6 +4200,8 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) pmltop_pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); + counter_u64_add(pt_page_count, 1); + pmltop_phys = VM_PAGE_TO_PHYS(pmltop_pg); pmap->pm_pmltop = (pml5_entry_t *)PHYS_TO_DMAP(pmltop_phys); @@ -4227,6 +4233,7 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) { pmltop_pgu = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_WAITOK); + counter_u64_add(pt_page_count, 1); pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP( VM_PAGE_TO_PHYS(pmltop_pgu)); if (pmap_is_la57(pmap)) @@ -4414,6 +4421,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) return (NULL); + if ((m->flags & PG_ZERO) == 0) pmap_zero_page(m); @@ -4511,6 +4519,8 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, } pmap_resident_count_inc(pmap, 1); + counter_u64_add(pt_page_count, 1); + return (m); } @@ -4673,12 +4683,14 @@ pmap_release(pmap_t pmap) vm_page_unwire_noq(m); vm_page_free_zero(m); + counter_u64_add(pt_page_count, -1); if (pmap->pm_pmltopu != NULL) { m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap-> pm_pmltopu)); vm_page_unwire_noq(m); vm_page_free(m); + counter_u64_add(pt_page_count, -1); } if (pmap->pm_type == PT_X86 && (cpu_stdext_feature2 & CPUID_STDEXT2_PKU) != 0) @@ -4794,6 +4806,7 @@ pmap_growkernel(vm_offset_t addr) panic("pmap_growkernel: no memory to grow kernel"); if ((nkpg->flags & PG_ZERO) == 0) pmap_zero_page(nkpg); + counter_u64_add(pt_page_count, 1); paddr = VM_PAGE_TO_PHYS(nkpg); *pdpe = (pdp_entry_t)(paddr | X86_PG_V | X86_PG_RW | X86_PG_A | X86_PG_M); @@ -4816,6 +4829,7 @@ pmap_growkernel(vm_offset_t addr) panic("pmap_growkernel: no memory to grow kernel"); if ((nkpg->flags & PG_ZERO) == 0) pmap_zero_page(nkpg); + counter_u64_add(pt_page_count, 1); paddr = VM_PAGE_TO_PHYS(nkpg); newpdir = paddr | X86_PG_V | X86_PG_RW | X86_PG_A | X86_PG_M; pde_store(pde, newpdir); @@ -4852,28 +4866,39 @@ pv_to_chunk(pv_entry_t pv) static const uint64_t pc_freemask[_NPCM] = { PC_FREE0, PC_FREE1, PC_FREE2 }; #ifdef PV_STATS -static int pc_chunk_count, pc_chunk_allocs, pc_chunk_frees, pc_chunk_tryfail; - -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_count, CTLFLAG_RD, &pc_chunk_count, 0, - "Current number of pv entry chunks"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_allocs, CTLFLAG_RD, &pc_chunk_allocs, 0, - "Current number of pv entry chunks allocated"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_frees, CTLFLAG_RD, &pc_chunk_frees, 0, - "Current number of pv entry chunks frees"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pc_chunk_tryfail, CTLFLAG_RD, &pc_chunk_tryfail, 0, - "Number of times tried to get a chunk page but failed."); - -static long pv_entry_frees, pv_entry_allocs, pv_entry_count; -static int pv_entry_spare; - -SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_frees, CTLFLAG_RD, &pv_entry_frees, 0, - "Current number of pv entry frees"); -SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_allocs, CTLFLAG_RD, &pv_entry_allocs, 0, - "Current number of pv entry allocs"); -SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, &pv_entry_count, 0, - "Current number of pv entries"); -SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, &pv_entry_spare, 0, - "Current number of spare pv entries"); + +static COUNTER_U64_DEFINE_EARLY(pc_chunk_count); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pc_chunk_count, CTLFLAG_RD, + &pc_chunk_count, "Current number of pv entry cnunks"); + +static COUNTER_U64_DEFINE_EARLY(pc_chunk_allocs); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pc_chunk_allocs, CTLFLAG_RD, + &pc_chunk_allocs, "Total number of pv entry chunks allocated"); + +static COUNTER_U64_DEFINE_EARLY(pc_chunk_frees); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pc_chunk_frees, CTLFLAG_RD, + &pc_chunk_frees, "Total number of pv entry chunks freed"); + +static COUNTER_U64_DEFINE_EARLY(pc_chunk_tryfail); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pc_chunk_tryfail, CTLFLAG_RD, + &pc_chunk_tryfail, + "Number of failed attempts to get a pv entry chunk page"); + +static COUNTER_U64_DEFINE_EARLY(pv_entry_frees); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pv_entry_frees, CTLFLAG_RD, + &pv_entry_frees, "Total number of pv entries freed"); + +static COUNTER_U64_DEFINE_EARLY(pv_entry_allocs); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pv_entry_allocs, CTLFLAG_RD, + &pv_entry_allocs, "Total number of pv entries allocated"); + +static COUNTER_U64_DEFINE_EARLY(pv_entry_count); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pv_entry_count, CTLFLAG_RD, + &pv_entry_count, "Current number of pv entries"); + +static COUNTER_U64_DEFINE_EARLY(pv_entry_spare); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, + &pv_entry_spare, "Current number of spare pv entries"); #endif static void @@ -5046,15 +5071,15 @@ reclaim_pv_chunk_domain(pmap_t locked_pmap, struct rwlock **lockp, int domain) } /* Every freed mapping is for a 4 KB page. */ pmap_resident_count_dec(pmap, freed); - PV_STAT(atomic_add_long(&pv_entry_frees, freed)); - PV_STAT(atomic_add_int(&pv_entry_spare, freed)); - PV_STAT(atomic_subtract_long(&pv_entry_count, freed)); + PV_STAT(counter_u64_add(pv_entry_frees, freed)); + PV_STAT(counter_u64_add(pv_entry_spare, freed)); + PV_STAT(counter_u64_add(pv_entry_count, -freed)); TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); if (pc->pc_map[0] == PC_FREE0 && pc->pc_map[1] == PC_FREE1 && pc->pc_map[2] == PC_FREE2) { - PV_STAT(atomic_subtract_int(&pv_entry_spare, _NPCPV)); - PV_STAT(atomic_subtract_int(&pc_chunk_count, 1)); - PV_STAT(atomic_add_int(&pc_chunk_frees, 1)); + PV_STAT(counter_u64_add(pv_entry_spare, -_NPCPV)); + PV_STAT(counter_u64_add(pc_chunk_count, -1)); + PV_STAT(counter_u64_add(pc_chunk_frees, 1)); /* Entire chunk is free; return it. */ m_pc = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m_pc->phys_addr); @@ -5127,9 +5152,9 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv) int idx, field, bit; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - PV_STAT(atomic_add_long(&pv_entry_frees, 1)); - PV_STAT(atomic_add_int(&pv_entry_spare, 1)); - PV_STAT(atomic_subtract_long(&pv_entry_count, 1)); + PV_STAT(counter_u64_add(pv_entry_frees, 1)); + PV_STAT(counter_u64_add(pv_entry_spare, 1)); + PV_STAT(counter_u64_add(pv_entry_count, -1)); pc = pv_to_chunk(pv); idx = pv - &pc->pc_pventry[0]; field = idx / 64; @@ -5153,9 +5178,10 @@ free_pv_chunk_dequeued(struct pv_chunk *pc) { vm_page_t m; - PV_STAT(atomic_subtract_int(&pv_entry_spare, _NPCPV)); - PV_STAT(atomic_subtract_int(&pc_chunk_count, 1)); - PV_STAT(atomic_add_int(&pc_chunk_frees, 1)); + PV_STAT(counter_u64_add(pv_entry_spare, -_NPCPV)); + PV_STAT(counter_u64_add(pc_chunk_count, -1)); + PV_STAT(counter_u64_add(pc_chunk_frees, 1)); + counter_u64_add(pv_page_count, -1); /* entire chunk is free, return it */ m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m->phys_addr); @@ -5218,7 +5244,7 @@ get_pv_entry(pmap_t pmap, struct rwlock **lockp) vm_page_t m; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - PV_STAT(atomic_add_long(&pv_entry_allocs, 1)); + PV_STAT(counter_u64_add(pv_entry_allocs, 1)); retry: pc = TAILQ_FIRST(&pmap->pm_pvchunk); if (pc != NULL) { @@ -5238,8 +5264,8 @@ retry: TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } - PV_STAT(atomic_add_long(&pv_entry_count, 1)); - PV_STAT(atomic_subtract_int(&pv_entry_spare, 1)); + PV_STAT(counter_u64_add(pv_entry_count, 1)); + PV_STAT(counter_u64_add(pv_entry_spare, -1)); return (pv); } } @@ -5248,15 +5274,16 @@ retry: VM_ALLOC_WIRED); if (m == NULL) { if (lockp == NULL) { - PV_STAT(pc_chunk_tryfail++); + PV_STAT(counter_u64_add(pc_chunk_tryfail, 1)); return (NULL); } m = reclaim_pv_chunk(pmap, lockp); if (m == NULL) goto retry; - } - PV_STAT(atomic_add_int(&pc_chunk_count, 1)); - PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); + } else + counter_u64_add(pv_page_count, 1); + PV_STAT(counter_u64_add(pc_chunk_count, 1)); + PV_STAT(counter_u64_add(pc_chunk_allocs, 1)); dump_add_page(m->phys_addr); pc = (void *)PHYS_TO_DMAP(m->phys_addr); pc->pc_pmap = pmap; @@ -5269,8 +5296,8 @@ retry: mtx_unlock(&pvc->pvc_lock); pv = &pc->pc_pventry[0]; TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); - PV_STAT(atomic_add_long(&pv_entry_count, 1)); - PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV - 1)); + PV_STAT(counter_u64_add(pv_entry_count, 1)); + PV_STAT(counter_u64_add(pv_entry_spare, _NPCPV - 1)); return (pv); } @@ -5354,9 +5381,10 @@ retry: if (m == NULL) goto retry; reclaimed = true; - } - PV_STAT(atomic_add_int(&pc_chunk_count, 1)); - PV_STAT(atomic_add_int(&pc_chunk_allocs, 1)); + } else + counter_u64_add(pv_page_count, 1); + PV_STAT(counter_u64_add(pc_chunk_count, 1)); + PV_STAT(counter_u64_add(pc_chunk_allocs, 1)); dump_add_page(m->phys_addr); pc = (void *)PHYS_TO_DMAP(m->phys_addr); pc->pc_pmap = pmap; @@ -5365,7 +5393,7 @@ retry: pc->pc_map[2] = PC_FREE2; TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&new_tail[vm_page_domain(m)], pc, pc_lru); - PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); + PV_STAT(counter_u64_add(pv_entry_spare, _NPCPV)); /* * The reclaim might have freed a chunk from the current pmap. @@ -5440,7 +5468,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; /* Instantiate the remaining NPTEPG - 1 pv entries. */ - PV_STAT(atomic_add_long(&pv_entry_allocs, NPTEPG - 1)); + PV_STAT(counter_u64_add(pv_entry_allocs, NPTEPG - 1)); va_last = va + NBPDR - PAGE_SIZE; for (;;) { pc = TAILQ_FIRST(&pmap->pm_pvchunk); @@ -5470,8 +5498,8 @@ out: TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } - PV_STAT(atomic_add_long(&pv_entry_count, NPTEPG - 1)); - PV_STAT(atomic_subtract_int(&pv_entry_spare, NPTEPG - 1)); + PV_STAT(counter_u64_add(pv_entry_count, NPTEPG - 1)); + PV_STAT(counter_u64_add(pv_entry_spare, -(NPTEPG - 1))); } #if VM_NRESERVLEVEL > 0 @@ -5731,6 +5759,8 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, return (FALSE); } + counter_u64_add(pt_page_count, 1); + if (!in_kernel) { mpte->ref_count = NPTEPG; pmap_resident_count_inc(pmap, 1); @@ -5795,7 +5825,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, if ((oldpde & PG_MANAGED) != 0) pmap_pv_demote_pde(pmap, va, oldpde & PG_PS_FRAME, lockp); - atomic_add_long(&pmap_pde_demotions, 1); + counter_u64_add(pmap_pde_demotions, 1); CTR2(KTR_PMAP, "pmap_demote_pde: success for va %#lx in pmap %p", va, pmap); return (TRUE); @@ -6517,7 +6547,7 @@ setpde: if ((newpde & ((PG_FRAME & PDRMASK) | PG_A | PG_V)) != (PG_A | PG_V) || !pmap_allow_2m_x_page(pmap, pmap_pde_ept_executable(pmap, newpde))) { - atomic_add_long(&pmap_pde_p_failures, 1); + counter_u64_add(pmap_pde_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_pde: failure for va %#lx" " in pmap %p", va, pmap); return; @@ -6542,7 +6572,7 @@ setpde: setpte: oldpte = *pte; if ((oldpte & (PG_FRAME | PG_A | PG_V)) != pa) { - atomic_add_long(&pmap_pde_p_failures, 1); + counter_u64_add(pmap_pde_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_pde: failure for va %#lx" " in pmap %p", va, pmap); return; @@ -6560,7 +6590,7 @@ setpte: (va & ~PDRMASK), pmap); } if ((oldpte & PG_PTE_PROMOTE) != (newpde & PG_PTE_PROMOTE)) { - atomic_add_long(&pmap_pde_p_failures, 1); + counter_u64_add(pmap_pde_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_pde: failure for va %#lx" " in pmap %p", va, pmap); return; @@ -6580,7 +6610,7 @@ setpte: KASSERT(mpte->pindex == pmap_pde_pindex(va), ("pmap_promote_pde: page table page's pindex is wrong")); if (pmap_insert_pt_page(pmap, mpte, true)) { - atomic_add_long(&pmap_pde_p_failures, 1); + counter_u64_add(pmap_pde_p_failures, 1); CTR2(KTR_PMAP, "pmap_promote_pde: failure for va %#lx in pmap %p", va, pmap); @@ -6606,7 +6636,7 @@ setpte: else pde_store(pde, PG_PROMOTED | PG_PS | newpde); - atomic_add_long(&pmap_pde_promotions, 1); + counter_u64_add(pmap_pde_promotions, 1); CTR2(KTR_PMAP, "pmap_promote_pde: success for va %#lx" " in pmap %p", va, pmap); } @@ -7182,7 +7212,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, */ pde_store(pde, newpde); - atomic_add_long(&pmap_pde_mappings, 1); + counter_u64_add(pmap_pde_mappings, 1); CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx in pmap %p", va, pmap); return (KERN_SUCCESS); @@ -7444,7 +7474,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, pde_store(pde, pa | PG_PS | PG_M | PG_A | PG_U | PG_RW | PG_V); pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE); - atomic_add_long(&pmap_pde_mappings, 1); + counter_u64_add(pmap_pde_mappings, 1); } else { /* Continue on if the PDE is already valid. */ pdpg->ref_count--; @@ -7672,7 +7702,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, *pde = srcptepaddr & ~PG_W; pmap_resident_count_inc(dst_pmap, NBPDR / PAGE_SIZE); - atomic_add_long(&pmap_pde_mappings, 1); + counter_u64_add(pmap_pde_mappings, 1); } else pmap_abort_ptp(dst_pmap, addr, dst_pdpg); continue; @@ -8157,9 +8187,9 @@ pmap_remove_pages(pmap_t pmap) freed++; } } - PV_STAT(atomic_add_long(&pv_entry_frees, freed)); - PV_STAT(atomic_add_int(&pv_entry_spare, freed)); - PV_STAT(atomic_subtract_long(&pv_entry_count, freed)); + PV_STAT(counter_u64_add(pv_entry_frees, freed)); + PV_STAT(counter_u64_add(pv_entry_spare, freed)); + PV_STAT(counter_u64_add(pv_entry_count, -freed)); if (allfree) { TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&free_chunks[pc_to_domain(pc)], pc, pc_list); @@ -9073,6 +9103,7 @@ pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va) " in pmap %p", va, pmap); return (FALSE); } + counter_u64_add(pt_page_count, 1); pdpgpa = VM_PAGE_TO_PHYS(pdpg); firstpde = (pd_entry_t *)PHYS_TO_DMAP(pdpgpa); newpdpe = pdpgpa | PG_M | PG_A | (oldpdpe & PG_U) | PG_RW | PG_V; @@ -9100,7 +9131,7 @@ pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va) */ pmap_invalidate_page(pmap, (vm_offset_t)vtopde(va)); - pmap_pdpe_demotions++; + counter_u64_add(pmap_pdpe_demotions, 1); CTR2(KTR_PMAP, "pmap_demote_pdpe: success for va %#lx" " in pmap %p", va, pmap); return (TRUE); @@ -9622,7 +9653,7 @@ pmap_activate_sw_pcid_pti(struct thread *td, pmap_t pmap, u_int cpuid) PCPU_SET(kcr3, kcr3 | CR3_PCID_SAVE); PCPU_SET(ucr3, ucr3 | CR3_PCID_SAVE); if (cached) - PCPU_INC(pm_save_cnt); + counter_u64_add(pcid_save_cnt, 1); pmap_activate_sw_pti_post(td, pmap); } @@ -9643,7 +9674,7 @@ pmap_activate_sw_pcid_nopti(struct thread *td __unused, pmap_t pmap, cached); PCPU_SET(curpmap, pmap); if (cached) - PCPU_INC(pm_save_cnt); + counter_u64_add(pcid_save_cnt, 1); } static void @@ -10088,8 +10119,11 @@ pmap_large_map_getptp_unlocked(void) m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_ZERO); - if (m != NULL && (m->flags & PG_ZERO) == 0) - pmap_zero_page(m); + if (m != NULL) { + if ((m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + counter_u64_add(pt_page_count, 1); + } return (m); } diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h index 4b163636c775..6326fbdae0be 100644 --- a/sys/amd64/include/pcpu.h +++ b/sys/amd64/include/pcpu.h @@ -76,7 +76,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); struct system_segment_descriptor *pc_ldt; \ /* Pointer to the CPU TSS descriptor */ \ struct system_segment_descriptor *pc_tss; \ - uint64_t pc_pm_save_cnt; \ u_int pc_cmci_mask; /* MCx banks for CMCI */ \ uint64_t pc_dbreg[16]; /* ddb debugging regs */ \ uint64_t pc_pti_stack[PC_PTI_STACK_SZ]; \ @@ -89,7 +88,7 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); uint32_t pc_ibpb_set; \ void *pc_mds_buf; \ void *pc_mds_buf64; \ - uint32_t pc_pad[2]; \ + uint32_t pc_pad[4]; \ uint8_t pc_mds_tmp[64]; \ u_int pc_ipi_bitmap; \ struct amd64tss pc_common_tss; \ From owner-dev-commits-src-all@freebsd.org Tue Mar 9 17:34:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECA9356ACE5; Tue, 9 Mar 2021 17:34:03 +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 4Dw2Pl6VGSz4kbP; Tue, 9 Mar 2021 17:34:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 45E23278D6; Tue, 9 Mar 2021 17:34:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 1ae20f7c70ea - main - kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() To: Kyle Evans , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202103091117.129BHOZa042851@gitrepo.freebsd.org> From: John Baldwin Message-ID: <3d67f7e4-c1fc-ca2c-8fc5-417dcf8e4145@FreeBSD.org> Date: Tue, 9 Mar 2021 09:33:59 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <202103091117.129BHOZa042851@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 17:34:04 -0000 On 3/9/21 3:17 AM, Kyle Evans wrote: > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=1ae20f7c70ea16fa8b702e409030e170df4f5c13 > > commit 1ae20f7c70ea16fa8b702e409030e170df4f5c13 > Author: Kyle Evans > AuthorDate: 2021-03-08 06:16:27 +0000 > Commit: Kyle Evans > CommitDate: 2021-03-09 11:16:39 +0000 > > kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() > > Simple condition flip; we wanted to panic here after epoch_trace_list(). > > Reviewed by: glebius, markj > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D29125 > --- > sys/kern/kern_malloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c > index 48383358e3ad..0d6f9dcfcab7 100644 > --- a/sys/kern/kern_malloc.c > +++ b/sys/kern/kern_malloc.c > @@ -537,7 +537,7 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_type *mtp, > #ifdef EPOCH_TRACE > epoch_trace_list(curthread); > #endif > - KASSERT(1, > + KASSERT(0, > ("malloc(M_WAITOK) with sleeping prohibited")); I would perhaps just use panic() directly under INVARIANTS instead of KASSERT(false, ...) Either that or duplicate the condition and let the compiler deal with avoiding checking it twice, e.g.: #ifdef EPOCH_TRACE if (!THREAD_CAN_SLEEP()) epoc_trace_list(curthread); #endif KASSERT(THREAD_CAN_SLEEP(), ("malloc(M_WAITOK) with sleeping prohibited")); -- John Baldwin From owner-dev-commits-src-all@freebsd.org Tue Mar 9 19:28:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FDF956DA31; Tue, 9 Mar 2021 19:28: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 4Dw4xp2kp1z4r9s; Tue, 9 Mar 2021 19:28: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 5073321A96; Tue, 9 Mar 2021 19:28: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 129JSUE1089998; Tue, 9 Mar 2021 19:28:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129JSUiN089997; Tue, 9 Mar 2021 19:28:30 GMT (envelope-from git) Date: Tue, 9 Mar 2021 19:28:30 GMT Message-Id: <202103091928.129JSUiN089997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Oleksandr Tymoshenko Subject: git: fd7d1ec21aea - releng/13.0 - armv8crypto: fix AES-XTS regression introduced by ed9b7f44 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: fd7d1ec21aea1c25489a939c35ebeba873782fdf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 19:28:30 -0000 The branch releng/13.0 has been updated by gonzo: URL: https://cgit.FreeBSD.org/src/commit/?id=fd7d1ec21aea1c25489a939c35ebeba873782fdf commit fd7d1ec21aea1c25489a939c35ebeba873782fdf Author: Oleksandr Tymoshenko AuthorDate: 2021-03-07 20:03:47 +0000 Commit: Oleksandr Tymoshenko CommitDate: 2021-03-09 19:27:11 +0000 armv8crypto: fix AES-XTS regression introduced by ed9b7f44 Initialization of the XTS key schedule was accidentally dropped when adding AES-GCM support so all-zero schedule was used instead. This rendered previously created GELI partitions unusable. This change restores proper XTS key schedule initialization. Reported by: Peter Jeremy MFC after: immediately Approved by: re (gjb) (cherry picked from commit 748be78e60ccc4a26325a636347debb1f7e6749b) --- 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 24f6eff5608d..95bb96124323 100644 --- a/sys/crypto/armv8/armv8_crypto.c +++ b/sys/crypto/armv8/armv8_crypto.c @@ -305,6 +305,9 @@ armv8_crypto_cipher_setup(struct armv8_crypto_session *ses, aes_v8_set_decrypt_key(key, keylen * 8, &ses->dec_schedule); + if (csp->csp_cipher_alg == CRYPTO_AES_XTS) + aes_v8_set_encrypt_key(key + keylen, keylen * 8, &ses->xts_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); From owner-dev-commits-src-all@freebsd.org Tue Mar 9 19:49:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E15D56E05E; Tue, 9 Mar 2021 19:49: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 4Dw5Px37Ynz4rwL; Tue, 9 Mar 2021 19:49: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 5E5F121BE7; Tue, 9 Mar 2021 19:49: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 129JnPb9016659; Tue, 9 Mar 2021 19:49:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129JnP9N016658; Tue, 9 Mar 2021 19:49:25 GMT (envelope-from git) Date: Tue, 9 Mar 2021 19:49:25 GMT Message-Id: <202103091949.129JnP9N016658@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: 299f8977cef6 - main - if_wg: wg_input: remove a couple locals (NFC) 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: 299f8977cef66d19c05d52d19b892fd8c7a235ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 19:49:25 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=299f8977cef66d19c05d52d19b892fd8c7a235ea commit 299f8977cef66d19c05d52d19b892fd8c7a235ea Author: Kyle Evans AuthorDate: 2021-03-09 10:59:21 +0000 Commit: Kyle Evans CommitDate: 2021-03-09 19:49:13 +0000 if_wg: wg_input: remove a couple locals (NFC) We have no use for the udphdr or this hlen local, just spell out the addition inline. MFC after: 3 days Reviewed by: grehan, markj Differential Revision: https://reviews.freebsd.org/D29142 --- sys/dev/if_wg/module/if_wg_session.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index ae9e44cffef5..5360b047426b 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -1891,17 +1891,14 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, struct wg_pkt_data *pkt_data; struct wg_endpoint *e; struct wg_softc *sc = _sc; - struct udphdr *uh; struct mbuf *m; - int pktlen, pkttype, hlen; + int pktlen, pkttype; struct noise_remote *remote; struct wg_tag *t; void *data; - uh = (struct udphdr *)(m0->m_data + offset); - hlen = offset + sizeof(struct udphdr); - - m_adj(m0, hlen); + /* Caller provided us with srcsa, no need for this header. */ + m_adj(m0, offset + sizeof(struct udphdr)); /* * Ensure mbuf has at least enough contiguous data to peel off our From owner-dev-commits-src-all@freebsd.org Tue Mar 9 19:49:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A362156DF32; Tue, 9 Mar 2021 19:49: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 4Dw5Py49JZz4sHl; Tue, 9 Mar 2021 19:49: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 804F421EBC; Tue, 9 Mar 2021 19:49: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 129JnQf6016682; Tue, 9 Mar 2021 19:49:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129JnQIb016681; Tue, 9 Mar 2021 19:49:26 GMT (envelope-from git) Date: Tue, 9 Mar 2021 19:49:26 GMT Message-Id: <202103091949.129JnQIb016681@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: 0dd691b41276 - main - iflib: allow clone detach if not yet init 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: 0dd691b41276ce13d25ffb1443af27f85038aa3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 19:49:26 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=0dd691b41276ce13d25ffb1443af27f85038aa3f commit 0dd691b41276ce13d25ffb1443af27f85038aa3f Author: Kyle Evans AuthorDate: 2021-03-09 12:13:31 +0000 Commit: Kyle Evans CommitDate: 2021-03-09 19:49:13 +0000 iflib: allow clone detach if not yet init If we hit an error during init, then we'll unwind our state and attempt to detach the device -- don't block it. This was discovered by creating a wg0 with missing parameters; said failure ended up leaving this orphaned device in place and ended up panicking the system upon enumeration of the dev.* sysctl space. Reviewed by: gallatin, markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29145 --- sys/net/iflib_clone.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net/iflib_clone.c b/sys/net/iflib_clone.c index 975873c4a19c..fc4e71806926 100644 --- a/sys/net/iflib_clone.c +++ b/sys/net/iflib_clone.c @@ -83,7 +83,8 @@ iflib_pseudo_detach(device_t dev) if_ctx_t ctx; ctx = device_get_softc(dev); - if ((iflib_get_flags(ctx) & IFC_IN_DETACH) == 0) + if ((iflib_get_flags(ctx) & (IFC_INIT_DONE | IFC_IN_DETACH)) == + IFC_INIT_DONE) return (EBUSY); return (0); } From owner-dev-commits-src-all@freebsd.org Tue Mar 9 19:50:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60C7556E351; Tue, 9 Mar 2021 19:50: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 4Dw5Rj2KjWz4sbF; Tue, 9 Mar 2021 19:50: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 42F39217DA; Tue, 9 Mar 2021 19:50: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 129JovmO024365; Tue, 9 Mar 2021 19:50:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129Jov76024364; Tue, 9 Mar 2021 19:50:57 GMT (envelope-from git) Date: Tue, 9 Mar 2021 19:50:57 GMT Message-Id: <202103091950.129Jov76024364@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: 94dddbfd00b9 - main - if_wg: export tx_bytes, rx_bytes, and last_handshake 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: 94dddbfd00b9d53d1b6a45a58bc87b323cae6791 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 19:50:57 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=94dddbfd00b9d53d1b6a45a58bc87b323cae6791 commit 94dddbfd00b9d53d1b6a45a58bc87b323cae6791 Author: Kyle Evans AuthorDate: 2021-03-09 10:57:01 +0000 Commit: Kyle Evans CommitDate: 2021-03-09 19:50:41 +0000 if_wg: export tx_bytes, rx_bytes, and last_handshake The names are self-explanatory; these are currently only used by the wg(8) tool, but they are handy data points to have. Reviewed by: grehan MFC after: 3 days Discussed with: decke Differential Revision: https://reviews.freebsd.org/D29143 --- sys/dev/if_wg/module/module.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/dev/if_wg/module/module.c b/sys/dev/if_wg/module/module.c index ad2f17c1e803..4ca1c24b56b9 100644 --- a/sys/dev/if_wg/module/module.c +++ b/sys/dev/if_wg/module/module.c @@ -69,11 +69,19 @@ MALLOC_DEFINE(M_WG, "WG", "wireguard"); TASKQGROUP_DECLARE(if_io_tqg); +struct wg_timespec64 { + uint64_t tv_sec; + uint64_t tv_nsec; +}; + struct wg_peer_export { struct sockaddr_storage endpoint; + struct timespec last_handshake; uint8_t public_key[WG_KEY_SIZE]; size_t endpoint_sz; struct wg_allowedip *aip; + uint64_t rx_bytes; + uint64_t tx_bytes; int aip_count; uint16_t persistent_keepalive; }; @@ -419,6 +427,9 @@ wg_peer_to_export(struct wg_peer *peer, struct wg_peer_export *exp) exp->persistent_keepalive = peer->p_timers.t_persistent_keepalive_interval; + wg_timers_get_last_handshake(&peer->p_timers, &exp->last_handshake); + exp->rx_bytes = counter_u64_fetch(peer->p_rx_bytes); + exp->tx_bytes = counter_u64_fetch(peer->p_tx_bytes); exp->aip_count = 0; CK_LIST_FOREACH(rt, &peer->p_routes, r_entry) { @@ -449,6 +460,7 @@ wg_peer_to_export(struct wg_peer *peer, struct wg_peer_export *exp) static nvlist_t * wg_peer_export_to_nvl(struct wg_peer_export *exp) { + struct wg_timespec64 ts64; nvlist_t *nvl; if ((nvl = nvlist_create(0)) == NULL) @@ -462,10 +474,19 @@ wg_peer_export_to_nvl(struct wg_peer_export *exp) nvlist_add_binary(nvl, "allowed-ips", exp->aip, exp->aip_count * sizeof(*exp->aip)); + ts64.tv_sec = exp->last_handshake.tv_sec; + ts64.tv_nsec = exp->last_handshake.tv_nsec; + nvlist_add_binary(nvl, "last_handshake", &ts64, sizeof(ts64)); + if (exp->persistent_keepalive != 0) nvlist_add_number(nvl, "persistent-keepalive-interval", exp->persistent_keepalive); + if (exp->rx_bytes != 0) + nvlist_add_number(nvl, "rx_bytes", exp->rx_bytes); + if (exp->tx_bytes != 0) + nvlist_add_number(nvl, "tx_bytes", exp->tx_bytes); + return (nvl); } From owner-dev-commits-src-all@freebsd.org Tue Mar 9 20:08:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3450756EF98; Tue, 9 Mar 2021 20:08: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 4Dw5rN10v4z4tgM; Tue, 9 Mar 2021 20:08: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 157172211E; Tue, 9 Mar 2021 20:08: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 129K8pel043232; Tue, 9 Mar 2021 20:08:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129K8prR043231; Tue, 9 Mar 2021 20:08:51 GMT (envelope-from git) Date: Tue, 9 Mar 2021 20:08:51 GMT Message-Id: <202103092008.129K8prR043231@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: ebe5cf355dca - main - Implement basic support for allocating memory from a specific numa node in the LinuxKPI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ebe5cf355dca1d7827a70b99a9d9c4f97f78691d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 20:08:52 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=ebe5cf355dca1d7827a70b99a9d9c4f97f78691d commit ebe5cf355dca1d7827a70b99a9d9c4f97f78691d Author: Hans Petter Selasky AuthorDate: 2021-03-05 11:44:06 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-09 20:01:47 +0000 Implement basic support for allocating memory from a specific numa node in the LinuxKPI. Differential Revision: https://reviews.freebsd.org/D29077 Reviewed by: markj@ and kib@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/compat/linuxkpi/common/include/linux/compat.h | 2 + sys/compat/linuxkpi/common/include/linux/device.h | 8 ++- sys/compat/linuxkpi/common/include/linux/slab.h | 37 ++++++++++++-- sys/compat/linuxkpi/common/src/linux_domain.c | 59 +++++++++++++++++++++++ sys/conf/files | 2 + sys/modules/linuxkpi/Makefile | 1 + 6 files changed, 100 insertions(+), 9 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/compat.h b/sys/compat/linuxkpi/common/include/linux/compat.h index 03b7dc60b7a1..84b7b47a36dc 100644 --- a/sys/compat/linuxkpi/common/include/linux/compat.h +++ b/sys/compat/linuxkpi/common/include/linux/compat.h @@ -35,11 +35,13 @@ #include #include +struct domainset; struct thread; struct task_struct; extern int linux_alloc_current(struct thread *, int flags); extern void linux_free_current(struct task_struct *); +extern struct domainset *linux_get_vm_domain_set(int node); static inline void linux_set_current(struct thread *td) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 2ffe70f45c6e..5acaa4142d62 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -554,11 +554,9 @@ class_remove_file(struct class *class, const struct class_attribute *attr) sysfs_remove_file(&class->kobj, &attr->attr); } -static inline int -dev_to_node(struct device *dev) -{ - return -1; -} +#define dev_to_node(dev) linux_dev_to_node(dev) +#define of_node_to_nid(node) -1 +int linux_dev_to_node(struct device *); char *kvasprintf(gfp_t, const char *, va_list); char *kasprintf(gfp_t, const char *, ...); diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index 0cd748b7ecb9..9494d458e87c 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2021 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -48,16 +49,15 @@ MALLOC_DECLARE(M_KMALLOC); #define kvzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) #define kvcalloc(n, size, flags) kvmalloc_array(n, size, (flags) | __GFP_ZERO) #define kzalloc(size, flags) kmalloc(size, (flags) | __GFP_ZERO) -#define kzalloc_node(size, flags, node) kmalloc(size, (flags) | __GFP_ZERO) +#define kzalloc_node(size, flags, node) kmalloc_node(size, (flags) | __GFP_ZERO, node) #define kfree_const(ptr) kfree(ptr) #define vzalloc(size) __vmalloc(size, GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO, 0) #define vfree(arg) kfree(arg) #define kvfree(arg) kfree(arg) -#define vmalloc_node(size, node) __vmalloc(size, GFP_KERNEL, 0) +#define vmalloc_node(size, node) __vmalloc_node(size, GFP_KERNEL, node) #define vmalloc_user(size) __vmalloc(size, GFP_KERNEL | __GFP_ZERO, 0) #define vmalloc(size) __vmalloc(size, GFP_KERNEL, 0) #define __kmalloc(...) kmalloc(__VA_ARGS__) -#define kmalloc_node(chunk, flags, n) kmalloc(chunk, flags) /* * Prefix some functions with linux_ to avoid namespace conflict @@ -126,6 +126,13 @@ kmalloc(size_t size, gfp_t flags) return (malloc(size, M_KMALLOC, linux_check_m_flags(flags))); } +static inline void * +kmalloc_node(size_t size, gfp_t flags, int node) +{ + return (malloc_domainset(size, M_KMALLOC, + linux_get_vm_domain_set(node), linux_check_m_flags(flags))); +} + static inline void * kcalloc(size_t n, size_t size, gfp_t flags) { @@ -133,12 +140,27 @@ kcalloc(size_t n, size_t size, gfp_t flags) return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); } +static inline void * +kcalloc_node(size_t n, size_t size, gfp_t flags, int node) +{ + flags |= __GFP_ZERO; + return (mallocarray_domainset(n, size, M_KMALLOC, + linux_get_vm_domain_set(node), linux_check_m_flags(flags))); +} + static inline void * __vmalloc(size_t size, gfp_t flags, int other) { return (malloc(size, M_KMALLOC, linux_check_m_flags(flags))); } +static inline void * +__vmalloc_node(size_t size, gfp_t flags, int node) +{ + return (malloc_domainset(size, M_KMALLOC, + linux_get_vm_domain_set(node), linux_check_m_flags(flags))); +} + static inline void * vmalloc_32(size_t size) { @@ -151,6 +173,13 @@ kmalloc_array(size_t n, size_t size, gfp_t flags) return (mallocarray(n, size, M_KMALLOC, linux_check_m_flags(flags))); } +static inline void * +kmalloc_array_node(size_t n, size_t size, gfp_t flags, int node) +{ + return (mallocarray_domainset(n, size, M_KMALLOC, + linux_get_vm_domain_set(node), linux_check_m_flags(flags))); +} + static inline void * kvmalloc_array(size_t n, size_t size, gfp_t flags) { diff --git a/sys/compat/linuxkpi/common/src/linux_domain.c b/sys/compat/linuxkpi/common/src/linux_domain.c new file mode 100644 index 000000000000..acbf8821d42b --- /dev/null +++ b/sys/compat/linuxkpi/common/src/linux_domain.c @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2021 NVIDIA Networking + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include + +struct domainset * +linux_get_vm_domain_set(int node) +{ + KASSERT(node < MAXMEMDOM, ("Invalid VM domain %d", node)); + + if (node < 0) + return (DOMAINSET_RR()); + else + return (DOMAINSET_PREF(node)); +} + +int +linux_dev_to_node(struct device *dev) +{ + int numa_domain; + + if (dev == NULL || dev->bsddev == NULL || + bus_get_domain(dev->bsddev, &numa_domain) != 0) + return (-1); + else + return (numa_domain); +} diff --git a/sys/conf/files b/sys/conf/files index 60b334f75d3f..ea2bd6db4ab0 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4565,6 +4565,8 @@ compat/linuxkpi/common/src/linux_devres.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_dmi.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" +compat/linuxkpi/common/src/linux_domain.c optional compat_linuxkpi \ + compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_firmware.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_hrtimer.c optional compat_linuxkpi \ diff --git a/sys/modules/linuxkpi/Makefile b/sys/modules/linuxkpi/Makefile index 4274d211b10e..81aa607f1302 100644 --- a/sys/modules/linuxkpi/Makefile +++ b/sys/modules/linuxkpi/Makefile @@ -6,6 +6,7 @@ SRCS= linux_compat.c \ linux_current.c \ linux_devres.c \ linux_dmi.c \ + linux_domain.c \ linux_firmware.c \ linux_hrtimer.c \ linux_idr.c \ From owner-dev-commits-src-all@freebsd.org Tue Mar 9 20:21:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6444356ECEE; Tue, 9 Mar 2021 20:21: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 4Dw67P2SjHz4vYX; Tue, 9 Mar 2021 20:21: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 4784A222E8; Tue, 9 Mar 2021 20:21: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 129KLr4j067775; Tue, 9 Mar 2021 20:21:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129KLr9A067774; Tue, 9 Mar 2021 20:21:53 GMT (envelope-from git) Date: Tue, 9 Mar 2021 20:21:53 GMT Message-Id: <202103092021.129KLr9A067774@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: ce53f92e6c81 - main - wg(4): note the persistent-keepalive ifconfig(8) option 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: ce53f92e6c81aebacd265665ef1abc04b63fe124 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 20:21:53 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ce53f92e6c81aebacd265665ef1abc04b63fe124 commit ce53f92e6c81aebacd265665ef1abc04b63fe124 Author: Kyle Evans AuthorDate: 2021-03-09 14:50:38 +0000 Commit: Kyle Evans CommitDate: 2021-03-09 20:21:35 +0000 wg(4): note the persistent-keepalive ifconfig(8) option MFC after: 3 days Fixes: b3dac3913dc9 --- share/man/man4/wg.4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 index 760584e3a386..335d3e70b64a 100644 --- a/share/man/man4/wg.4 +++ b/share/man/man4/wg.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 7, 2021 +.Dd March 9, 2021 .Dt WG 4 .Os .Sh NAME @@ -78,6 +78,8 @@ A list of allowed IP addresses. The IP address of the WiredGuard to connect to. .It Cm peer-list A list of peering IP addresses to connect to. +.It Cm persistent-keepalive +Interval, in seconds, at which to send persistent keepalive packets. .El .Pp The From owner-dev-commits-src-all@freebsd.org Tue Mar 9 20:22:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1DE756F502; Tue, 9 Mar 2021 20:22: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 4Dw68F5XmWz4vRT; Tue, 9 Mar 2021 20:22: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 B12C6222F7; Tue, 9 Mar 2021 20:22: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 129KMbUr068820; Tue, 9 Mar 2021 20:22:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129KMbTZ068819; Tue, 9 Mar 2021 20:22:37 GMT (envelope-from git) Date: Tue, 9 Mar 2021 20:22:37 GMT Message-Id: <202103092022.129KMbTZ068819@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 27e68baf24f1 - stable/13 - Build lib/msun tests with compiler builtins disabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 27e68baf24f1eb10f1cfb48731d7447a78b278ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 20:22:37 -0000 The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=27e68baf24f1eb10f1cfb48731d7447a78b278ff commit 27e68baf24f1eb10f1cfb48731d7447a78b278ff Author: Dimitry Andric AuthorDate: 2021-02-23 20:03:32 +0000 Commit: Dimitry Andric CommitDate: 2021-03-09 20:17:10 +0000 Build lib/msun tests with compiler builtins disabled This forces the compiler to emit calls to libm functions, instead of possibly substituting pre-calculated results at compile time, which should help to actually test those functions. Reviewed by: emaste, arichardson, ngie Differential Revision: https://reviews.freebsd.org/D28577 (cherry picked from commit cf97d2a1dab8f2cddc4466fe64d37818339c73be) riscv: Add a soft-float implementation of fabs() We could just use a C implementation using __builtin_fabs(), but using this assembly version guarantees that there is no additional prolog/epilog code. Additionally, clang generates worse code for masking off the top bit than GCC: https://bugs.llvm.org/show_bug.cgi?id=49377. This fixes the RISCV64 softfloat world build after cf97d2a1dab8. That commit added -fno-builtin to the msun tests which resulted in the first references to fabs (previously the compiler inlined all calls). Reviewed By: dim Reported by: mjg Differential Revision: https://reviews.freebsd.org/D28994 (cherry picked from commit 524b018d200408bed5eb0d2b892db5b9fb46808b) riscv: Fix whitespace issues in fabs added in 524b018d2004 (cherry picked from commit 066dab17e7a4a78d43dbcef8119960ddc8090a73) --- lib/libc/riscv/gen/fabs.S | 11 +++++++++-- lib/msun/tests/Makefile | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/libc/riscv/gen/fabs.S b/lib/libc/riscv/gen/fabs.S index 44249252e9c1..036d50eddf90 100644 --- a/lib/libc/riscv/gen/fabs.S +++ b/lib/libc/riscv/gen/fabs.S @@ -1,5 +1,6 @@ /*- * Copyright (c) 2015-2017 Ruslan Bukin + * Copyright (c) 2021 Alex Richardson * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -10,6 +11,9 @@ * Computer Laboratory as part of the CTSRD Project, with support from the * UK Higher Education Innovation Fund (HEIF). * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -35,9 +39,12 @@ #include __FBSDID("$FreeBSD$"); -#ifdef __riscv_float_abi_double ENTRY(fabs) +#ifdef __riscv_float_abi_double fabs.d fa0, fa0 +#else + slli a0, a0, 1 + srli a0, a0, 1 +#endif ret END(fabs) -#endif diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile index 67a38855309e..902d1ca22f73 100644 --- a/lib/msun/tests/Makefile +++ b/lib/msun/tests/Makefile @@ -19,6 +19,10 @@ CFLAGS+= -I${TESTSRC:H}/libc/gen CFLAGS+= -D__HAVE_LONG_DOUBLE .endif +# Avoid builtins, to force the compiler to emit calls to the libm +# functions, and not calculate any results in advance. +CFLAGS+= -fno-builtin + NETBSD_ATF_TESTS_C= acos_test NETBSD_ATF_TESTS_C+= asin_test NETBSD_ATF_TESTS_C+= atan_test From owner-dev-commits-src-all@freebsd.org Tue Mar 9 20:23:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5A0156F267; Tue, 9 Mar 2021 20:23: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 4Dw68t4My5z4vpG; Tue, 9 Mar 2021 20:23: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 8902722711; Tue, 9 Mar 2021 20:23: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 129KNAwA069015; Tue, 9 Mar 2021 20:23:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129KNAKt069014; Tue, 9 Mar 2021 20:23:10 GMT (envelope-from git) Date: Tue, 9 Mar 2021 20:23:10 GMT Message-Id: <202103092023.129KNAKt069014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: e91ff79b2811 - stable/12 - Build lib/msun tests with compiler builtins disabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e91ff79b2811798a70826fe43a2fb7cb006f3fa1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 20:23:10 -0000 The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=e91ff79b2811798a70826fe43a2fb7cb006f3fa1 commit e91ff79b2811798a70826fe43a2fb7cb006f3fa1 Author: Dimitry Andric AuthorDate: 2021-02-23 20:03:32 +0000 Commit: Dimitry Andric CommitDate: 2021-03-09 20:18:43 +0000 Build lib/msun tests with compiler builtins disabled This forces the compiler to emit calls to libm functions, instead of possibly substituting pre-calculated results at compile time, which should help to actually test those functions. Reviewed by: emaste, arichardson, ngie Differential Revision: https://reviews.freebsd.org/D28577 (cherry picked from commit cf97d2a1dab8f2cddc4466fe64d37818339c73be) riscv: Add a soft-float implementation of fabs() We could just use a C implementation using __builtin_fabs(), but using this assembly version guarantees that there is no additional prolog/epilog code. Additionally, clang generates worse code for masking off the top bit than GCC: https://bugs.llvm.org/show_bug.cgi?id=49377. This fixes the RISCV64 softfloat world build after cf97d2a1dab8. That commit added -fno-builtin to the msun tests which resulted in the first references to fabs (previously the compiler inlined all calls). Reviewed By: dim Reported by: mjg Differential Revision: https://reviews.freebsd.org/D28994 (cherry picked from commit 524b018d200408bed5eb0d2b892db5b9fb46808b) riscv: Fix whitespace issues in fabs added in 524b018d2004 (cherry picked from commit 066dab17e7a4a78d43dbcef8119960ddc8090a73) --- lib/libc/riscv/gen/fabs.S | 11 +++++++++-- lib/msun/tests/Makefile | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/libc/riscv/gen/fabs.S b/lib/libc/riscv/gen/fabs.S index 44249252e9c1..036d50eddf90 100644 --- a/lib/libc/riscv/gen/fabs.S +++ b/lib/libc/riscv/gen/fabs.S @@ -1,5 +1,6 @@ /*- * Copyright (c) 2015-2017 Ruslan Bukin + * Copyright (c) 2021 Alex Richardson * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -10,6 +11,9 @@ * Computer Laboratory as part of the CTSRD Project, with support from the * UK Higher Education Innovation Fund (HEIF). * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -35,9 +39,12 @@ #include __FBSDID("$FreeBSD$"); -#ifdef __riscv_float_abi_double ENTRY(fabs) +#ifdef __riscv_float_abi_double fabs.d fa0, fa0 +#else + slli a0, a0, 1 + srli a0, a0, 1 +#endif ret END(fabs) -#endif diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile index cd60f7c71a15..91d32517143f 100644 --- a/lib/msun/tests/Makefile +++ b/lib/msun/tests/Makefile @@ -18,6 +18,10 @@ CFLAGS+= -I${TESTSRC:H}/libc/gen CFLAGS+= -D__HAVE_LONG_DOUBLE .endif +# Avoid builtins, to force the compiler to emit calls to the libm +# functions, and not calculate any results in advance. +CFLAGS+= -fno-builtin + NETBSD_ATF_TESTS_C= acos_test NETBSD_ATF_TESTS_C+= asin_test NETBSD_ATF_TESTS_C+= atan_test From owner-dev-commits-src-all@freebsd.org Tue Mar 9 20:23:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 265A056F716; Tue, 9 Mar 2021 20:23: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 4Dw69N0bSwz4vqG; Tue, 9 Mar 2021 20:23: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 071E5222FA; Tue, 9 Mar 2021 20:23: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 129KNZhG069194; Tue, 9 Mar 2021 20:23:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129KNZT1069193; Tue, 9 Mar 2021 20:23:35 GMT (envelope-from git) Date: Tue, 9 Mar 2021 20:23:35 GMT Message-Id: <202103092023.129KNZT1069193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 7ee9798bad0b - stable/11 - Build lib/msun tests with compiler builtins disabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 7ee9798bad0b42983259e3a9e131789f4a49c117 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 20:23:36 -0000 The branch stable/11 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=7ee9798bad0b42983259e3a9e131789f4a49c117 commit 7ee9798bad0b42983259e3a9e131789f4a49c117 Author: Dimitry Andric AuthorDate: 2021-02-23 20:03:32 +0000 Commit: Dimitry Andric CommitDate: 2021-03-09 20:21:48 +0000 Build lib/msun tests with compiler builtins disabled This forces the compiler to emit calls to libm functions, instead of possibly substituting pre-calculated results at compile time, which should help to actually test those functions. Reviewed by: emaste, arichardson, ngie Differential Revision: https://reviews.freebsd.org/D28577 (cherry picked from commit cf97d2a1dab8f2cddc4466fe64d37818339c73be) riscv: Add a soft-float implementation of fabs() We could just use a C implementation using __builtin_fabs(), but using this assembly version guarantees that there is no additional prolog/epilog code. Additionally, clang generates worse code for masking off the top bit than GCC: https://bugs.llvm.org/show_bug.cgi?id=49377. This fixes the RISCV64 softfloat world build after cf97d2a1dab8. That commit added -fno-builtin to the msun tests which resulted in the first references to fabs (previously the compiler inlined all calls). Reviewed By: dim Reported by: mjg Differential Revision: https://reviews.freebsd.org/D28994 (cherry picked from commit 524b018d200408bed5eb0d2b892db5b9fb46808b) riscv: Fix whitespace issues in fabs added in 524b018d2004 (cherry picked from commit 066dab17e7a4a78d43dbcef8119960ddc8090a73) --- lib/libc/riscv/gen/fabs.S | 9 +++++++++ lib/msun/tests/Makefile | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/lib/libc/riscv/gen/fabs.S b/lib/libc/riscv/gen/fabs.S index 3fc791a452f4..f3cb969aafd3 100644 --- a/lib/libc/riscv/gen/fabs.S +++ b/lib/libc/riscv/gen/fabs.S @@ -1,5 +1,6 @@ /*- * Copyright (c) 2015 Ruslan Bukin + * Copyright (c) 2021 Alex Richardson * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -10,6 +11,9 @@ * Computer Laboratory as part of the CTSRD Project, with support from the * UK Higher Education Innovation Fund (HEIF). * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -36,6 +40,11 @@ __FBSDID("$FreeBSD$"); ENTRY(fabs) +#ifdef __riscv_float_abi_double fabs.d fa0, fa0 +#else + slli a0, a0, 1 + srli a0, a0, 1 +#endif ret END(fabs) diff --git a/lib/msun/tests/Makefile b/lib/msun/tests/Makefile index cd60f7c71a15..91d32517143f 100644 --- a/lib/msun/tests/Makefile +++ b/lib/msun/tests/Makefile @@ -18,6 +18,10 @@ CFLAGS+= -I${TESTSRC:H}/libc/gen CFLAGS+= -D__HAVE_LONG_DOUBLE .endif +# Avoid builtins, to force the compiler to emit calls to the libm +# functions, and not calculate any results in advance. +CFLAGS+= -fno-builtin + NETBSD_ATF_TESTS_C= acos_test NETBSD_ATF_TESTS_C+= asin_test NETBSD_ATF_TESTS_C+= atan_test From owner-dev-commits-src-all@freebsd.org Tue Mar 9 20:26:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 717E956F89A; Tue, 9 Mar 2021 20:26: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 4Dw6DF2pPCz3BtR; Tue, 9 Mar 2021 20:26: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 5294A226B6; Tue, 9 Mar 2021 20:26: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 129KQ5eD069727; Tue, 9 Mar 2021 20:26:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129KQ5B0069726; Tue, 9 Mar 2021 20:26:05 GMT (envelope-from git) Date: Tue, 9 Mar 2021 20:26:05 GMT Message-Id: <202103092026.129KQ5B0069726@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 3f684107ef6e - stable/13 - Add a few missed files to libclang_rt.profile-.a MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f684107ef6e41b03a47d64d6e31cebc823d7448 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 20:26:05 -0000 The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=3f684107ef6e41b03a47d64d6e31cebc823d7448 commit 3f684107ef6e41b03a47d64d6e31cebc823d7448 Author: Dimitry Andric AuthorDate: 2021-03-05 20:06:05 +0000 Commit: Dimitry Andric CommitDate: 2021-03-09 20:25:16 +0000 Add a few missed files to libclang_rt.profile-.a Otherwise, programs compiled with -fprofile-instr-generate will encounter undefined symbol errors during linking, for example __llvm_profile_counter_bias, lprofSetRuntimeCounterRelocation and a few others were missing from the profile library. Reported by: ota@j.email.ne.jp PR: 254001 (cherry picked from commit 772c631af81abdb6d498d972bab79d04d3db16d0) --- lib/libclang_rt/profile/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libclang_rt/profile/Makefile b/lib/libclang_rt/profile/Makefile index c41da991a039..ab3eba28ac96 100644 --- a/lib/libclang_rt/profile/Makefile +++ b/lib/libclang_rt/profile/Makefile @@ -13,8 +13,10 @@ CXXFLAGS+= -fvisibility=default SRCS+= profile/GCDAProfiling.c SRCS+= profile/InstrProfiling.c +SRCS+= profile/InstrProfilingBiasVar.c SRCS+= profile/InstrProfilingBuffer.c SRCS+= profile/InstrProfilingFile.c +SRCS+= profile/InstrProfilingInternal.c SRCS+= profile/InstrProfilingMerge.c SRCS+= profile/InstrProfilingMergeFile.c SRCS+= profile/InstrProfilingNameVar.c From owner-dev-commits-src-all@freebsd.org Tue Mar 9 20:59:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE7DD570859; Tue, 9 Mar 2021 20:59: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 4Dw6yY5XQQz3FLh; Tue, 9 Mar 2021 20:59: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 B0D8E22A4D; Tue, 9 Mar 2021 20:59: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 129KxHBf009504; Tue, 9 Mar 2021 20:59:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129KxHU1009503; Tue, 9 Mar 2021 20:59:17 GMT (envelope-from git) Date: Tue, 9 Mar 2021 20:59:17 GMT Message-Id: <202103092059.129KxHU1009503@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 64b30c36712e - releng/13.0 - Add a few missed files to libclang_rt.profile-.a MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 64b30c36712edb44e9204e3a3436100024ffad18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 20:59:17 -0000 The branch releng/13.0 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=64b30c36712edb44e9204e3a3436100024ffad18 commit 64b30c36712edb44e9204e3a3436100024ffad18 Author: Dimitry Andric AuthorDate: 2021-03-05 20:06:05 +0000 Commit: Dimitry Andric CommitDate: 2021-03-09 20:57:51 +0000 Add a few missed files to libclang_rt.profile-.a Otherwise, programs compiled with -fprofile-instr-generate will encounter undefined symbol errors during linking, for example __llvm_profile_counter_bias, lprofSetRuntimeCounterRelocation and a few others were missing from the profile library. Approved by: re (gjb) Reported by: ota@j.email.ne.jp PR: 254001 (cherry picked from commit 772c631af81abdb6d498d972bab79d04d3db16d0) (cherry picked from commit 3f684107ef6e41b03a47d64d6e31cebc823d7448) --- lib/libclang_rt/profile/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libclang_rt/profile/Makefile b/lib/libclang_rt/profile/Makefile index c41da991a039..ab3eba28ac96 100644 --- a/lib/libclang_rt/profile/Makefile +++ b/lib/libclang_rt/profile/Makefile @@ -13,8 +13,10 @@ CXXFLAGS+= -fvisibility=default SRCS+= profile/GCDAProfiling.c SRCS+= profile/InstrProfiling.c +SRCS+= profile/InstrProfilingBiasVar.c SRCS+= profile/InstrProfilingBuffer.c SRCS+= profile/InstrProfilingFile.c +SRCS+= profile/InstrProfilingInternal.c SRCS+= profile/InstrProfilingMerge.c SRCS+= profile/InstrProfilingMergeFile.c SRCS+= profile/InstrProfilingNameVar.c From owner-dev-commits-src-all@freebsd.org Tue Mar 9 21:34:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 987B55725A0; Tue, 9 Mar 2021 21:34: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 4Dw7ks3twdz3K9k; Tue, 9 Mar 2021 21:34: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 777C7235F1; Tue, 9 Mar 2021 21:34: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 129LYD0A062401; Tue, 9 Mar 2021 21:34:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129LYDQ0062400; Tue, 9 Mar 2021 21:34:13 GMT (envelope-from git) Date: Tue, 9 Mar 2021 21:34:13 GMT Message-Id: <202103092134.129LYDQ0062400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: c80a1c1072d1 - stable/13 - mpr: big-endian support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c80a1c1072d13444029430213187fd7f3086618a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 21:34:13 -0000 The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=c80a1c1072d13444029430213187fd7f3086618a commit c80a1c1072d13444029430213187fd7f3086618a Author: Alfredo Dal'Ava Junior AuthorDate: 2021-03-02 14:05:15 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-03-10 00:09:24 +0000 mpr: big-endian support This fixes mpr driver on big-endian devices. Tested on powerpc64 and powerpc64le targets using a SAS9300-8i card (LSISAS3008 pci vendor=0x1000 device=0x0097) Submitted by: Andre Fernando da Silva Reviewed by: luporl, alfredo, Sreekanth Reddy (by email) Sponsored by: Eldorado Research Institute (eldorado.org.br) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25785 (cherry picked from commit 71900a794da046ad5322caae2774aed5b3d361b9) --- sys/dev/mpr/mpr.c | 75 ++++++++++++++++++++++++++++++++++------------- sys/dev/mpr/mpr_config.c | 16 +++++----- sys/dev/mpr/mpr_mapping.c | 4 +-- sys/dev/mpr/mpr_sas.c | 14 +++++---- sys/dev/mpr/mpr_sas_lsi.c | 21 +++++++------ sys/dev/mpr/mpr_table.c | 66 ++++++++++++++++++++--------------------- sys/dev/mpr/mprvar.h | 4 +++ 7 files changed, 119 insertions(+), 81 deletions(-) diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c index 678fe5052fca..5d57be27f9b2 100644 --- a/sys/dev/mpr/mpr.c +++ b/sys/dev/mpr/mpr.c @@ -111,6 +111,7 @@ static int mpr_wait_db_ack(struct mpr_softc *sc, int timeout, int sleep_flag); static int mpr_debug_sysctl(SYSCTL_HANDLER_ARGS); static int mpr_dump_reqs(SYSCTL_HANDLER_ARGS); static void mpr_parse_debug(struct mpr_softc *sc, char *list); +static void adjust_iocfacts_endianness(MPI2_IOC_FACTS_REPLY *facts); SYSCTL_NODE(_hw, OID_AUTO, mpr, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "MPR Driver Parameters"); @@ -413,7 +414,7 @@ mpr_resize_queues(struct mpr_softc *sc) * the size of an IEEE Simple SGE. */ if (sc->facts->MsgVersion >= MPI2_VERSION_02_05) { - chain_seg_size = htole16(sc->facts->IOCMaxChainSegmentSize); + chain_seg_size = sc->facts->IOCMaxChainSegmentSize; if (chain_seg_size == 0) chain_seg_size = MPR_DEFAULT_CHAIN_SEG_SIZE; sc->chain_frame_size = chain_seg_size * @@ -1054,15 +1055,21 @@ mpr_request_sync(struct mpr_softc *sc, void *req, MPI2_DEFAULT_REPLY *reply, mpr_dprint(sc, MPR_FAULT, "Timeout reading doorbell 0\n"); return (ENXIO); } + + /* + * If in a BE platform, swap bytes using le16toh to not + * disturb 8 bit field neighbors in destination structure + * pointed by data16. + */ data16[0] = - mpr_regread(sc, MPI2_DOORBELL_OFFSET) & MPI2_DOORBELL_DATA_MASK; + le16toh(mpr_regread(sc, MPI2_DOORBELL_OFFSET)) & MPI2_DOORBELL_DATA_MASK; mpr_regwrite(sc, MPI2_HOST_INTERRUPT_STATUS_OFFSET, 0x0); if (mpr_wait_db_int(sc) != 0) { mpr_dprint(sc, MPR_FAULT, "Timeout reading doorbell 1\n"); return (ENXIO); } data16[1] = - mpr_regread(sc, MPI2_DOORBELL_OFFSET) & MPI2_DOORBELL_DATA_MASK; + le16toh(mpr_regread(sc, MPI2_DOORBELL_OFFSET)) & MPI2_DOORBELL_DATA_MASK; mpr_regwrite(sc, MPI2_HOST_INTERRUPT_STATUS_OFFSET, 0x0); /* Number of 32bit words in the message */ @@ -1087,7 +1094,7 @@ mpr_request_sync(struct mpr_softc *sc, void *req, MPI2_DEFAULT_REPLY *reply, "Timeout reading doorbell %d\n", i); return (ENXIO); } - data16[i] = mpr_regread(sc, MPI2_DOORBELL_OFFSET) & + data16[i] = le16toh(mpr_regread(sc, MPI2_DOORBELL_OFFSET)) & MPI2_DOORBELL_DATA_MASK; mpr_regwrite(sc, MPI2_HOST_INTERRUPT_STATUS_OFFSET, 0x0); } @@ -1142,9 +1149,8 @@ mpr_enqueue_request(struct mpr_softc *sc, struct mpr_command *cm) mpr_regwrite(sc, MPI26_ATOMIC_REQUEST_DESCRIPTOR_POST_OFFSET, rd.u.low); } else { - rd.u.low = cm->cm_desc.Words.Low; - rd.u.high = cm->cm_desc.Words.High; - rd.word = htole64(rd.word); + rd.u.low = htole32(cm->cm_desc.Words.Low); + rd.u.high = htole32(cm->cm_desc.Words.High); mpr_regwrite(sc, MPI2_REQUEST_DESCRIPTOR_POST_LOW_OFFSET, rd.u.low); mpr_regwrite(sc, MPI2_REQUEST_DESCRIPTOR_POST_HIGH_OFFSET, @@ -1152,6 +1158,36 @@ mpr_enqueue_request(struct mpr_softc *sc, struct mpr_command *cm) } } +/* + * Ioc facts are read in 16 bit words and and stored with le16toh, + * this takes care of proper U8 fields endianness in + * MPI2_IOC_FACTS_REPLY, but we still need to swap back U16 fields. + */ +static void +adjust_iocfacts_endianness(MPI2_IOC_FACTS_REPLY *facts) +{ + facts->HeaderVersion = le16toh(facts->HeaderVersion); + facts->Reserved1 = le16toh(facts->Reserved1); + facts->IOCExceptions = le16toh(facts->IOCExceptions); + facts->IOCStatus = le16toh(facts->IOCStatus); + facts->IOCLogInfo = le32toh(facts->IOCLogInfo); + facts->RequestCredit = le16toh(facts->RequestCredit); + facts->ProductID = le16toh(facts->ProductID); + facts->IOCCapabilities = le32toh(facts->IOCCapabilities); + facts->IOCRequestFrameSize = le16toh(facts->IOCRequestFrameSize); + facts->IOCMaxChainSegmentSize = le16toh(facts->IOCMaxChainSegmentSize); + facts->MaxInitiators = le16toh(facts->MaxInitiators); + facts->MaxTargets = le16toh(facts->MaxTargets); + facts->MaxSasExpanders = le16toh(facts->MaxSasExpanders); + facts->MaxEnclosures = le16toh(facts->MaxEnclosures); + facts->ProtocolFlags = le16toh(facts->ProtocolFlags); + facts->HighPriorityCredit = le16toh(facts->HighPriorityCredit); + facts->MaxReplyDescriptorPostQueueDepth = le16toh(facts->MaxReplyDescriptorPostQueueDepth); + facts->MaxDevHandle = le16toh(facts->MaxDevHandle); + facts->MaxPersistentEntries = le16toh(facts->MaxPersistentEntries); + facts->MinDevHandle = le16toh(facts->MinDevHandle); +} + /* * Just the FACTS, ma'am. */ @@ -1173,6 +1209,9 @@ mpr_get_iocfacts(struct mpr_softc *sc, MPI2_IOC_FACTS_REPLY *facts) request.Function = MPI2_FUNCTION_IOC_FACTS; error = mpr_request_sync(sc, &request, reply, req_sz, reply_sz, 5); + adjust_iocfacts_endianness(facts); + mpr_dprint(sc, MPR_TRACE, "facts->IOCCapabilities 0x%x\n", facts->IOCCapabilities); + mpr_dprint(sc, MPR_INIT, "%s exit, error= %d\n", __func__, error); return (error); } @@ -1231,10 +1270,10 @@ mpr_send_iocinit(struct mpr_softc *sc) init.HostPageSize = HOST_PAGE_SIZE_4K; error = mpr_request_sync(sc, &init, &reply, req_sz, reply_sz, 5); - if ((reply.IOCStatus & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS) + if ((le16toh(reply.IOCStatus) & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS) error = ENXIO; - mpr_dprint(sc, MPR_INIT, "IOCInit status= 0x%x\n", reply.IOCStatus); + mpr_dprint(sc, MPR_INIT, "IOCInit status= 0x%x\n", le16toh(reply.IOCStatus)); mpr_dprint(sc, MPR_INIT, "%s exit\n", __func__); return (error); } @@ -1532,7 +1571,7 @@ mpr_alloc_requests(struct mpr_softc *sc) cm->cm_req_busaddr = sc->req_busaddr + i * sc->reqframesz; cm->cm_sense = &sc->sense_frames[i]; cm->cm_sense_busaddr = sc->sense_busaddr + i * MPR_SENSE_LEN; - cm->cm_desc.Default.SMID = i; + cm->cm_desc.Default.SMID = htole16(i); cm->cm_sc = sc; cm->cm_state = MPR_CM_STATE_BUSY; TAILQ_INIT(&cm->cm_chain_list); @@ -1650,7 +1689,7 @@ mpr_init_queues(struct mpr_softc *sc) * Initialize all of the free queue entries. */ for (i = 0; i < sc->fqdepth; i++) { - sc->free_queue[i] = sc->reply_busaddr + (i * sc->replyframesz); + sc->free_queue[i] = htole32(sc->reply_busaddr + (i * sc->replyframesz)); } sc->replyfreeindex = sc->num_replies; @@ -2719,7 +2758,8 @@ mpr_update_events(struct mpr_softc *sc, struct mpr_event_handle *handle, bcopy(fullmask, (uint8_t *)&evtreq->EventMasks, 16); } #else - bcopy(sc->event_mask, (uint8_t *)&evtreq->EventMasks, 16); + for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) + evtreq->EventMasks[i] = htole32(sc->event_mask[i]); #endif cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; @@ -2773,7 +2813,8 @@ mpr_reregister_events(struct mpr_softc *sc) bcopy(fullmask, (uint8_t *)&evtreq->EventMasks, 16); } #else - bcopy(sc->event_mask, (uint8_t *)&evtreq->EventMasks, 16); + for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) + evtreq->EventMasks[i] = htole32(sc->event_mask[i]); #endif cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_data = NULL; @@ -3446,8 +3487,6 @@ mpr_push_sge(struct mpr_command *cm, MPI2_SGE_SIMPLE64 *sge, size_t len, /* Endian Safe code */ sge_flags = sge->FlagsLength; sge->FlagsLength = htole32(sge_flags); - sge->Address.High = htole32(sge->Address.High); - sge->Address.Low = htole32(sge->Address.Low); bcopy(sge, cm->cm_sge, len); cm->cm_sge = (MPI2_SGE_IO_UNION *)((uintptr_t)cm->cm_sge + len); } @@ -3474,8 +3513,6 @@ mpr_push_sge(struct mpr_command *cm, MPI2_SGE_SIMPLE64 *sge, size_t len, /* Endian Safe code */ sge_flags = sge->FlagsLength; sge->FlagsLength = htole32(sge_flags); - sge->Address.High = htole32(sge->Address.High); - sge->Address.Low = htole32(sge->Address.Low); bcopy(sge, cm->cm_sge, len); cm->cm_sge = (MPI2_SGE_IO_UNION *)((uintptr_t)cm->cm_sge + len); return (0); @@ -3534,8 +3571,6 @@ mpr_push_ieee_sge(struct mpr_command *cm, void *sgep, int segsleft) /* Endian Safe code */ sge_length = sge->Length; sge->Length = htole32(sge_length); - sge->Address.High = htole32(sge->Address.High); - sge->Address.Low = htole32(sge->Address.Low); bcopy(sgep, cm->cm_sge, ieee_sge_size); cm->cm_sge = (MPI25_SGE_IO_UNION *)((uintptr_t)cm->cm_sge + @@ -3553,8 +3588,6 @@ mpr_push_ieee_sge(struct mpr_command *cm, void *sgep, int segsleft) /* Endian Safe code */ sge_length = sge->Length; sge->Length = htole32(sge_length); - sge->Address.High = htole32(sge->Address.High); - sge->Address.Low = htole32(sge->Address.Low); bcopy(sgep, cm->cm_sge, ieee_sge_size); cm->cm_sge = (MPI25_SGE_IO_UNION *)((uintptr_t)cm->cm_sge + ieee_sge_size); diff --git a/sys/dev/mpr/mpr_config.c b/sys/dev/mpr/mpr_config.c index 1916dc1cb3dc..2b5bc7e3964b 100644 --- a/sys/dev/mpr/mpr_config.c +++ b/sys/dev/mpr/mpr_config.c @@ -142,7 +142,7 @@ mpr_config_get_ioc_pg8(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, request->Header.PageNumber = 8; request->Header.PageVersion = mpi_reply->Header.PageVersion; request->Header.PageLength = mpi_reply->Header.PageLength; - cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; + cm->cm_length = mpi_reply->Header.PageLength * 4; cm->cm_sge = &request->PageBufferSGE; cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); cm->cm_flags = MPR_CM_FLAGS_SGE_SIMPLE | MPR_CM_FLAGS_DATAIN; @@ -274,7 +274,7 @@ mpr_config_get_iounit_pg8(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, request->Header.PageNumber = 8; request->Header.PageVersion = mpi_reply->Header.PageVersion; request->Header.PageLength = mpi_reply->Header.PageLength; - cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; + cm->cm_length = mpi_reply->Header.PageLength * 4; cm->cm_sge = &request->PageBufferSGE; cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); cm->cm_flags = MPR_CM_FLAGS_SGE_SIMPLE | MPR_CM_FLAGS_DATAIN; @@ -406,7 +406,7 @@ mpr_config_get_man_pg11(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, request->Header.PageNumber = 11; request->Header.PageVersion = mpi_reply->Header.PageVersion; request->Header.PageLength = mpi_reply->Header.PageLength; - cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; + cm->cm_length = mpi_reply->Header.PageLength * 4; cm->cm_sge = &request->PageBufferSGE; cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); cm->cm_flags = MPR_CM_FLAGS_SGE_SIMPLE | MPR_CM_FLAGS_DATAIN; @@ -602,7 +602,7 @@ mpr_config_get_dpm_pg0(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, request->PageAddress = sc->max_dpm_entries << MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; request->ExtPageLength = mpi_reply->ExtPageLength; - cm->cm_length = le16toh(request->ExtPageLength) * 4; + cm->cm_length = le16toh(request->ExtPageLength) * 4; cm->cm_sge = &request->PageBufferSGE; cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); cm->cm_flags = MPR_CM_FLAGS_SGE_SIMPLE | MPR_CM_FLAGS_DATAIN; @@ -1282,7 +1282,7 @@ mpr_config_get_bios_pg3(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, request->Header.PageNumber = 3; request->Header.PageVersion = mpi_reply->Header.PageVersion; request->Header.PageLength = mpi_reply->Header.PageLength; - cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; + cm->cm_length = mpi_reply->Header.PageLength * 4; cm->cm_sge = &request->PageBufferSGE; cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); cm->cm_flags = MPR_CM_FLAGS_SGE_SIMPLE | MPR_CM_FLAGS_DATAIN; @@ -1414,7 +1414,7 @@ mpr_config_get_raid_volume_pg0(struct mpr_softc *sc, Mpi2ConfigReply_t request->Header.PageLength = mpi_reply->Header.PageLength; request->Header.PageVersion = mpi_reply->Header.PageVersion; request->PageAddress = page_address; - cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; + cm->cm_length = mpi_reply->Header.PageLength * 4; cm->cm_sge = &request->PageBufferSGE; cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); cm->cm_flags = MPR_CM_FLAGS_SGE_SIMPLE | MPR_CM_FLAGS_DATAIN; @@ -1546,7 +1546,7 @@ mpr_config_get_raid_volume_pg1(struct mpr_softc *sc, Mpi2ConfigReply_t request->Header.PageLength = mpi_reply->Header.PageLength; request->Header.PageVersion = mpi_reply->Header.PageVersion; request->PageAddress = htole32(form | handle); - cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; + cm->cm_length = mpi_reply->Header.PageLength * 4; cm->cm_sge = &request->PageBufferSGE; cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); cm->cm_flags = MPR_CM_FLAGS_SGE_SIMPLE | MPR_CM_FLAGS_DATAIN; @@ -1704,7 +1704,7 @@ mpr_config_get_raid_pd_pg0(struct mpr_softc *sc, Mpi2ConfigReply_t *mpi_reply, request->Header.PageLength = mpi_reply->Header.PageLength; request->Header.PageVersion = mpi_reply->Header.PageVersion; request->PageAddress = page_address; - cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; + cm->cm_length = mpi_reply->Header.PageLength * 4; cm->cm_sge = &request->PageBufferSGE; cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); cm->cm_flags = MPR_CM_FLAGS_SGE_SIMPLE | MPR_CM_FLAGS_DATAIN; diff --git a/sys/dev/mpr/mpr_mapping.c b/sys/dev/mpr/mpr_mapping.c index 2b83ce49c158..ef97080fb175 100644 --- a/sys/dev/mpr/mpr_mapping.c +++ b/sys/dev/mpr/mpr_mapping.c @@ -2567,7 +2567,7 @@ mpr_mapping_initialize(struct mpr_softc *sc) sc->pending_map_events = 0; sc->num_enc_table_entries = 0; sc->num_rsvd_entries = 0; - sc->max_dpm_entries = sc->ioc_pg8.MaxPersistentEntries; + sc->max_dpm_entries = le16toh(sc->ioc_pg8.MaxPersistentEntries); sc->is_dpm_enable = (sc->max_dpm_entries) ? 1 : 0; sc->track_mapping_events = 0; @@ -2581,7 +2581,7 @@ mpr_mapping_initialize(struct mpr_softc *sc) if (ioc_pg8_flags & MPI2_IOCPAGE8_FLAGS_RESERVED_TARGETID_0) sc->num_rsvd_entries = 1; - volume_mapping_flags = sc->ioc_pg8.IRVolumeMappingFlags & + volume_mapping_flags = le16toh(sc->ioc_pg8.IRVolumeMappingFlags) & MPI2_IOCPAGE8_IRFLAGS_MASK_VOLUME_MAPPING_MODE; if (sc->ir_firmware && (volume_mapping_flags == MPI2_IOCPAGE8_IRFLAGS_LOW_VOLUME_MAPPING)) diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c index de61ac7b8dd8..a60881553f01 100644 --- a/sys/dev/mpr/mpr_sas.c +++ b/sys/dev/mpr/mpr_sas.c @@ -2034,7 +2034,7 @@ mprsas_action_scsiio(struct mprsas_softc *sassc, union ccb *ccb) } if ((lun != NULL) && (lun->eedp_formatted)) { - req->EEDPBlockSize = htole16(lun->eedp_block_size); + req->EEDPBlockSize = htole32(lun->eedp_block_size); eedp_flags |= (MPI2_SCSIIO_EEDPFLAGS_INC_PRI_REFTAG | MPI2_SCSIIO_EEDPFLAGS_CHECK_REFTAG | MPI2_SCSIIO_EEDPFLAGS_CHECK_GUARD); @@ -2400,10 +2400,6 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm) target_id_t target_id; MPR_FUNCTRACE(sc); - mpr_dprint(sc, MPR_TRACE, - "cm %p SMID %u ccb %p reply %p outstanding %u\n", cm, - cm->cm_desc.Default.SMID, cm->cm_ccb, cm->cm_reply, - cm->cm_targ->outstanding); callout_stop(&cm->cm_callout); mtx_assert(&sc->mpr_mtx, MA_OWNED); @@ -2413,6 +2409,12 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm) csio = &ccb->csio; target_id = csio->ccb_h.target_id; rep = (MPI2_SCSI_IO_REPLY *)cm->cm_reply; + mpr_dprint(sc, MPR_TRACE, + "cm %p SMID %u ccb %p reply %p outstanding %u csio->scsi_status 0x%x," + "csio->dxfer_len 0x%x, csio->msg_le 0x%xn\n", cm, + cm->cm_desc.Default.SMID, cm->cm_ccb, cm->cm_reply, + cm->cm_targ->outstanding, csio->scsi_status, + csio->dxfer_len, csio->msg_len); /* * XXX KDM if the chain allocation fails, does it matter if we do * the sync and unload here? It is simpler to do it in every case, @@ -3483,7 +3485,7 @@ mprsas_portenable_complete(struct mpr_softc *sc, struct mpr_command *cm) reply = (MPI2_PORT_ENABLE_REPLY *)cm->cm_reply; if (reply == NULL) mpr_dprint(sc, MPR_FAULT, "Portenable NULL reply\n"); - else if (le16toh(reply->IOCStatus & MPI2_IOCSTATUS_MASK) != + else if ((le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK) != MPI2_IOCSTATUS_SUCCESS) mpr_dprint(sc, MPR_FAULT, "Portenable failed\n"); diff --git a/sys/dev/mpr/mpr_sas_lsi.c b/sys/dev/mpr/mpr_sas_lsi.c index db4cbbb24440..3d698cc4d431 100644 --- a/sys/dev/mpr/mpr_sas_lsi.c +++ b/sys/dev/mpr/mpr_sas_lsi.c @@ -160,11 +160,11 @@ mprsas_evt_handler(struct mpr_softc *sc, uintptr_t data, } bcopy(event->EventData, fw_event->event_data, sz); - fw_event->event = event->Event; - if ((event->Event == MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST || - event->Event == MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST || - event->Event == MPI2_EVENT_SAS_ENCL_DEVICE_STATUS_CHANGE || - event->Event == MPI2_EVENT_IR_CONFIGURATION_CHANGE_LIST) && + fw_event->event = le16toh(event->Event); + if ((fw_event->event == MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST || + fw_event->event == MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST || + fw_event->event == MPI2_EVENT_SAS_ENCL_DEVICE_STATUS_CHANGE || + fw_event->event == MPI2_EVENT_IR_CONFIGURATION_CHANGE_LIST) && sc->track_mapping_events) sc->pending_map_events++; @@ -173,9 +173,9 @@ mprsas_evt_handler(struct mpr_softc *sc, uintptr_t data, * are processed. Increment the startup_refcount and decrement it after * events are processed. */ - if ((event->Event == MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST || - event->Event == MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST || - event->Event == MPI2_EVENT_IR_CONFIGURATION_CHANGE_LIST) && + if ((fw_event->event == MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST || + fw_event->event == MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST || + fw_event->event == MPI2_EVENT_IR_CONFIGURATION_CHANGE_LIST) && sc->wait_for_port_enable) mprsas_startup_increment(sc->sassc); @@ -867,9 +867,8 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 linkrate) parent_devinfo = le32toh(parent_config_page.DeviceInfo); } } - /* TODO Check proper endianness */ - sas_address = config_page.SASAddress.High; - sas_address = (sas_address << 32) | config_page.SASAddress.Low; + sas_address = htole32(config_page.SASAddress.High); + sas_address = (sas_address << 32) | htole32(config_page.SASAddress.Low); mpr_dprint(sc, MPR_MAPPING, "Handle 0x%04x SAS Address from SAS device " "page0 = %jx\n", handle, sas_address); diff --git a/sys/dev/mpr/mpr_table.c b/sys/dev/mpr/mpr_table.c index c2f31af14e91..719866b5fa74 100644 --- a/sys/dev/mpr/mpr_table.c +++ b/sys/dev/mpr/mpr_table.c @@ -316,7 +316,7 @@ mpr_print_portfacts(struct mpr_softc *sc, MPI2_PORT_FACTS_REPLY *facts) MPR_PRINTFIELD_START(sc, "PortFacts"); MPR_PRINTFIELD(sc, facts, PortNumber, %d); MPR_PRINTFIELD(sc, facts, PortType, 0x%x); - MPR_PRINTFIELD(sc, facts, MaxPostedCmdBuffers, %d); + MPR_PRINTFIELD_16(sc, facts, MaxPostedCmdBuffers, %d); } void @@ -324,33 +324,33 @@ mpr_print_evt_generic(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event { MPR_PRINTFIELD_START(sc, "EventReply"); - MPR_PRINTFIELD(sc, event, EventDataLength, %d); + MPR_PRINTFIELD_16(sc, event, EventDataLength, %d); MPR_PRINTFIELD(sc, event, AckRequired, %d); mpr_print_field(sc, "Event: %s (0x%x)\n", - mpr_describe_table(mpr_event_names, event->Event), event->Event); - MPR_PRINTFIELD(sc, event, EventContext, 0x%x); + mpr_describe_table(mpr_event_names, le16toh(event->Event)), le16toh(event->Event)); + MPR_PRINTFIELD_32(sc, event, EventContext, 0x%x); } void mpr_print_sasdev0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_DEV_0 *buf) { MPR_PRINTFIELD_START(sc, "SAS Device Page 0"); - MPR_PRINTFIELD(sc, buf, Slot, %d); - MPR_PRINTFIELD(sc, buf, EnclosureHandle, 0x%x); + MPR_PRINTFIELD_16(sc, buf, Slot, %d); + MPR_PRINTFIELD_16(sc, buf, EnclosureHandle, 0x%x); mpr_print_field(sc, "SASAddress: 0x%jx\n", mpr_to_u64(&buf->SASAddress)); - MPR_PRINTFIELD(sc, buf, ParentDevHandle, 0x%x); + MPR_PRINTFIELD_16(sc, buf, ParentDevHandle, 0x%x); MPR_PRINTFIELD(sc, buf, PhyNum, %d); MPR_PRINTFIELD(sc, buf, AccessStatus, 0x%x); - MPR_PRINTFIELD(sc, buf, DevHandle, 0x%x); + MPR_PRINTFIELD_16(sc, buf, DevHandle, 0x%x); MPR_PRINTFIELD(sc, buf, AttachedPhyIdentifier, 0x%x); MPR_PRINTFIELD(sc, buf, ZoneGroup, %d); - mpr_print_field(sc, "DeviceInfo: %b,%s\n", buf->DeviceInfo, + mpr_print_field(sc, "DeviceInfo: %b,%s\n", le32toh(buf->DeviceInfo), "\20" "\4SataHost" "\5SmpInit" "\6StpInit" "\7SspInit" "\10SataDev" "\11SmpTarg" "\12StpTarg" "\13SspTarg" "\14Direct" "\15LsiDev" "\16AtapiDev" "\17SepDev", mpr_describe_table(mpr_sasdev0_devtype, buf->DeviceInfo & 0x03)); - MPR_PRINTFIELD(sc, buf, Flags, 0x%x); + MPR_PRINTFIELD_16(sc, buf, Flags, 0x%x); MPR_PRINTFIELD(sc, buf, PhysicalPort, %d); MPR_PRINTFIELD(sc, buf, MaxPortConnections, %d); mpr_print_field(sc, "DeviceName: 0x%jx\n", @@ -366,7 +366,7 @@ mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) mpr_print_evt_generic(sc, event); - switch(event->Event) { + switch(le16toh(event->Event)) { case MPI2_EVENT_SAS_DISCOVERY: { MPI2_EVENT_DATA_SAS_DISCOVERY *data; @@ -378,7 +378,7 @@ mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) mpr_describe_table(mpr_sasdisc_reason, data->ReasonCode)); MPR_PRINTFIELD(sc, data, PhysicalPort, %d); mpr_print_field(sc, "DiscoveryStatus: %b\n", - data->DiscoveryStatus, "\20" + le32toh(data->DiscoveryStatus), "\20" "\1Loop" "\2UnaddressableDev" "\3DupSasAddr" "\5SmpTimeout" "\6ExpRouteFull" "\7RouteIndexError" "\10SmpFailed" "\11SmpCrcError" "\12SubSubLink" "\13TableTableLink" @@ -397,8 +397,8 @@ mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) data = (MPI2_EVENT_DATA_SAS_TOPOLOGY_CHANGE_LIST *) &event->EventData; - MPR_PRINTFIELD(sc, data, EnclosureHandle, 0x%x); - MPR_PRINTFIELD(sc, data, ExpanderDevHandle, 0x%x); + MPR_PRINTFIELD_16(sc, data, EnclosureHandle, 0x%x); + MPR_PRINTFIELD_16(sc, data, ExpanderDevHandle, 0x%x); MPR_PRINTFIELD(sc, data, NumPhys, %d); MPR_PRINTFIELD(sc, data, NumEntries, %d); MPR_PRINTFIELD(sc, data, StartPhyNum, %d); @@ -411,7 +411,7 @@ mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) phynum = data->StartPhyNum + i; mpr_print_field(sc, "PHY[%d].AttachedDevHandle: 0x%04x\n", phynum, - phy->AttachedDevHandle); + le16toh(phy->AttachedDevHandle)); mpr_print_field(sc, "PHY[%d].LinkRate: %s (0x%x)\n", phynum, mpr_describe_table(mpr_linkrate_names, @@ -428,13 +428,13 @@ mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) data = (MPI2_EVENT_DATA_SAS_ENCL_DEV_STATUS_CHANGE *) &event->EventData; - MPR_PRINTFIELD(sc, data, EnclosureHandle, 0x%x); + MPR_PRINTFIELD_16(sc, data, EnclosureHandle, 0x%x); mpr_print_field(sc, "ReasonCode: %s\n", mpr_describe_table(mpr_sastopo_exp, data->ReasonCode)); MPR_PRINTFIELD(sc, data, PhysicalPort, %d); - MPR_PRINTFIELD(sc, data, NumSlots, %d); - MPR_PRINTFIELD(sc, data, StartSlot, %d); - MPR_PRINTFIELD(sc, data, PhyBits, 0x%x); + MPR_PRINTFIELD_16(sc, data, NumSlots, %d); + MPR_PRINTFIELD_16(sc, data, StartSlot, %d); + MPR_PRINTFIELD_32(sc, data, PhyBits, 0x%x); break; } case MPI2_EVENT_SAS_DEVICE_STATUS_CHANGE: @@ -443,12 +443,12 @@ mpr_print_evt_sas(struct mpr_softc *sc, MPI2_EVENT_NOTIFICATION_REPLY *event) data = (MPI2_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *) &event->EventData; - MPR_PRINTFIELD(sc, data, TaskTag, 0x%x); + MPR_PRINTFIELD_16(sc, data, TaskTag, 0x%x); mpr_print_field(sc, "ReasonCode: %s\n", mpr_describe_table(mpr_sasdev_reason, data->ReasonCode)); MPR_PRINTFIELD(sc, data, ASC, 0x%x); MPR_PRINTFIELD(sc, data, ASCQ, 0x%x); - MPR_PRINTFIELD(sc, data, DevHandle, 0x%x); + MPR_PRINTFIELD_16(sc, data, DevHandle, 0x%x); mpr_print_field(sc, "SASAddress: 0x%jx\n", mpr_to_u64(&data->SASAddress)); break; @@ -476,24 +476,24 @@ mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf) MPR_PRINTFIELD(sc, buf, PhysicalPort, %d); MPR_PRINTFIELD(sc, buf, NumPhys, %d); MPR_PRINTFIELD(sc, buf, Phy, %d); - MPR_PRINTFIELD(sc, buf, NumTableEntriesProgrammed, %d); + MPR_PRINTFIELD_16(sc, buf, NumTableEntriesProgrammed, %d); mpr_print_field(sc, "ProgrammedLinkRate: %s (0x%x)\n", mpr_describe_table(mpr_linkrate_names, (buf->ProgrammedLinkRate >> 4) & 0xf), buf->ProgrammedLinkRate); mpr_print_field(sc, "HwLinkRate: %s (0x%x)\n", mpr_describe_table(mpr_linkrate_names, (buf->HwLinkRate >> 4) & 0xf), buf->HwLinkRate); - MPR_PRINTFIELD(sc, buf, AttachedDevHandle, 0x%04x); + MPR_PRINTFIELD_16(sc, buf, AttachedDevHandle, 0x%04x); mpr_print_field(sc, "PhyInfo Reason: %s (0x%x)\n", mpr_describe_table(mpr_phyinfo_reason_names, - (buf->PhyInfo >> 16) & 0xf), buf->PhyInfo); + (le32toh(buf->PhyInfo) >> 16) & 0xf), le32toh(buf->PhyInfo)); mpr_print_field(sc, "AttachedDeviceInfo: %b,%s\n", - buf->AttachedDeviceInfo, "\20" "\4SATAhost" "\5SMPinit" "\6STPinit" + le32toh(buf->AttachedDeviceInfo), "\20" "\4SATAhost" "\5SMPinit" "\6STPinit" "\7SSPinit" "\10SATAdev" "\11SMPtarg" "\12STPtarg" "\13SSPtarg" "\14Direct" "\15LSIdev" "\16ATAPIdev" "\17SEPdev", mpr_describe_table(mpr_sasdev0_devtype, - buf->AttachedDeviceInfo & 0x03)); - MPR_PRINTFIELD(sc, buf, ExpanderDevHandle, 0x%04x); + le32toh(buf->AttachedDeviceInfo) & 0x03)); + MPR_PRINTFIELD_16(sc, buf, ExpanderDevHandle, 0x%04x); MPR_PRINTFIELD(sc, buf, ChangeCount, %d); mpr_print_field(sc, "NegotiatedLinkRate: %s (0x%x)\n", mpr_describe_table(mpr_linkrate_names, @@ -501,10 +501,10 @@ mpr_print_expander1(struct mpr_softc *sc, MPI2_CONFIG_PAGE_EXPANDER_1 *buf) MPR_PRINTFIELD(sc, buf, PhyIdentifier, %d); MPR_PRINTFIELD(sc, buf, AttachedPhyIdentifier, %d); MPR_PRINTFIELD(sc, buf, DiscoveryInfo, 0x%x); - MPR_PRINTFIELD(sc, buf, AttachedPhyInfo, 0x%x); + MPR_PRINTFIELD_32(sc, buf, AttachedPhyInfo, 0x%x); mpr_print_field(sc, "AttachedPhyInfo Reason: %s (0x%x)\n", mpr_describe_table(mpr_phyinfo_reason_names, - buf->AttachedPhyInfo & 0xf), buf->AttachedPhyInfo); + le32toh(buf->AttachedPhyInfo) & 0xf), le32toh(buf->AttachedPhyInfo)); MPR_PRINTFIELD(sc, buf, ZoneGroup, %d); MPR_PRINTFIELD(sc, buf, SelfConfigStatus, 0x%x); } @@ -513,12 +513,12 @@ void mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf) { MPR_PRINTFIELD_START(sc, "SAS PHY Page 0"); - MPR_PRINTFIELD(sc, buf, OwnerDevHandle, 0x%04x); - MPR_PRINTFIELD(sc, buf, AttachedDevHandle, 0x%04x); + MPR_PRINTFIELD_16(sc, buf, OwnerDevHandle, 0x%04x); + MPR_PRINTFIELD_16(sc, buf, AttachedDevHandle, 0x%04x); MPR_PRINTFIELD(sc, buf, AttachedPhyIdentifier, %d); mpr_print_field(sc, "AttachedPhyInfo Reason: %s (0x%x)\n", mpr_describe_table(mpr_phyinfo_reason_names, - buf->AttachedPhyInfo & 0xf), buf->AttachedPhyInfo); + le32toh(buf->AttachedPhyInfo) & 0xf), le32toh(buf->AttachedPhyInfo)); mpr_print_field(sc, "ProgrammedLinkRate: %s (0x%x)\n", mpr_describe_table(mpr_linkrate_names, (buf->ProgrammedLinkRate >> 4) & 0xf), buf->ProgrammedLinkRate); @@ -529,7 +529,7 @@ mpr_print_sasphy0(struct mpr_softc *sc, MPI2_CONFIG_PAGE_SAS_PHY_0 *buf) MPR_PRINTFIELD(sc, buf, Flags, 0x%x); mpr_print_field(sc, "PhyInfo Reason: %s (0x%x)\n", mpr_describe_table(mpr_phyinfo_reason_names, - (buf->PhyInfo >> 16) & 0xf), buf->PhyInfo); + (le32toh(buf->PhyInfo) >> 16) & 0xf), le32toh(buf->PhyInfo)); mpr_print_field(sc, "NegotiatedLinkRate: %s (0x%x)\n", mpr_describe_table(mpr_linkrate_names, buf->NegotiatedLinkRate & 0xf), buf->NegotiatedLinkRate); diff --git a/sys/dev/mpr/mprvar.h b/sys/dev/mpr/mprvar.h index 3728a6b5a131..ce755188d706 100644 --- a/sys/dev/mpr/mprvar.h +++ b/sys/dev/mpr/mprvar.h @@ -764,6 +764,10 @@ do { \ mpr_printf((sc), tag "\n") #define MPR_PRINTFIELD(sc, facts, attr, fmt) \ mpr_print_field((sc), #attr ": " #fmt "\n", (facts)->attr) +#define MPR_PRINTFIELD_16(sc, facts, attr, fmt) \ + mpr_print_field((sc), #attr ": " #fmt "\n", le16toh((facts)->attr)) +#define MPR_PRINTFIELD_32(sc, facts, attr, fmt) \ + mpr_print_field((sc), #attr ": " #fmt "\n", le32toh((facts)->attr)) static __inline void mpr_from_u64(uint64_t data, U64 *mpr) From owner-dev-commits-src-all@freebsd.org Tue Mar 9 21:34:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A93A5572905; Tue, 9 Mar 2021 21:34: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 4Dw7kt4QK3z3KR5; Tue, 9 Mar 2021 21:34: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 8A66023537; Tue, 9 Mar 2021 21:34: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 129LYE1W062424; Tue, 9 Mar 2021 21:34:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129LYEDb062423; Tue, 9 Mar 2021 21:34:14 GMT (envelope-from git) Date: Tue, 9 Mar 2021 21:34:14 GMT Message-Id: <202103092134.129LYEDb062423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: 2954aedb8e5c - stable/13 - [PowerPC64] add mpr to GENERIC64 and GENERIC64LE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2954aedb8e5c2df942ca42bb4ce380055d76cf07 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 21:34:14 -0000 The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=2954aedb8e5c2df942ca42bb4ce380055d76cf07 commit 2954aedb8e5c2df942ca42bb4ce380055d76cf07 Author: Alfredo Dal'Ava Junior AuthorDate: 2021-03-02 14:05:37 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-03-10 00:09:49 +0000 [PowerPC64] add mpr to GENERIC64 and GENERIC64LE Submitted by: Andre Fernando da Silva Reviewed by: luporl, alfredo, Sreekanth Reddy (by email) Sponsored by: Eldorado Research Institute (eldorado.org.br) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25785 (cherry picked from commit 231633a2e9000d67b09f132ee26951a4621c778a) --- sys/powerpc/conf/GENERIC64 | 1 + sys/powerpc/conf/GENERIC64LE | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 249823d4efa9..5785bf293c8b 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -138,6 +138,7 @@ device ispfw # Firmware module for Qlogic host adapters device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 +device mpr # LSI SAS3008 MPT-Fusion SAS-3 device sym # NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D # ATA/SCSI peripherals diff --git a/sys/powerpc/conf/GENERIC64LE b/sys/powerpc/conf/GENERIC64LE index b94eac412b1e..5129c5e76388 100644 --- a/sys/powerpc/conf/GENERIC64LE +++ b/sys/powerpc/conf/GENERIC64LE @@ -130,6 +130,7 @@ device ispfw # Firmware module for Qlogic host adapters device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s device mpt # LSI-Logic MPT-Fusion device mps # LSI-Logic MPT-Fusion 2 +device mpr # LSI SAS3008 MPT-Fusion SAS-3 device sym # NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D # ATA/SCSI peripherals From owner-dev-commits-src-all@freebsd.org Tue Mar 9 22:39:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9CD75744A7; Tue, 9 Mar 2021 22:39: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 4Dw99z4tTwz3P1t; Tue, 9 Mar 2021 22:39: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 9A80E2407E; Tue, 9 Mar 2021 22:39: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 129MdJiS042633; Tue, 9 Mar 2021 22:39:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129MdJwn042632; Tue, 9 Mar 2021 22:39:19 GMT (envelope-from git) Date: Tue, 9 Mar 2021 22:39:19 GMT Message-Id: <202103092239.129MdJwn042632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 4058265d605d - stable/12 - The list of ports in configuration path shall be protected by locks, epoch shall be used only for fast path. Thus use LAGG_XLOCK() in lagg_[un]register_vlan. This fixes sleeping in epoch panic. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 4058265d605de7e6e66d9ad5153ac496f4f3c628 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 22:39:19 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4058265d605de7e6e66d9ad5153ac496f4f3c628 commit 4058265d605de7e6e66d9ad5153ac496f4f3c628 Author: Gleb Smirnoff AuthorDate: 2020-12-08 16:46:00 +0000 Commit: Alexander Motin CommitDate: 2021-03-09 22:39:06 +0000 The list of ports in configuration path shall be protected by locks, epoch shall be used only for fast path. Thus use LAGG_XLOCK() in lagg_[un]register_vlan. This fixes sleeping in epoch panic. PR: 240609 (cherry picked from commit e1074ed6a08033ee571b4bedb3ffe6049a4a7361) --- sys/net/if_lagg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 049978bcfd6c..6831b40d099f 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -462,10 +462,10 @@ lagg_register_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag) if (ifp->if_softc != arg) /* Not our event */ return; - LAGG_RLOCK(); + LAGG_XLOCK(sc); CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag); - LAGG_RUNLOCK(); + LAGG_XUNLOCK(sc); } /* @@ -481,10 +481,10 @@ lagg_unregister_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag) if (ifp->if_softc != arg) /* Not our event */ return; - LAGG_RLOCK(); + LAGG_XLOCK(sc); CK_SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag); - LAGG_RUNLOCK(); + LAGG_XUNLOCK(sc); } static int From owner-dev-commits-src-all@freebsd.org Tue Mar 9 22:42:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 474A85744E7; Tue, 9 Mar 2021 22:42: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 4Dw9GC1c3Bz3PWx; Tue, 9 Mar 2021 22:42: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 1F8A324632; Tue, 9 Mar 2021 22:42: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 129MgxnS054681; Tue, 9 Mar 2021 22:42:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129MgxjP054680; Tue, 9 Mar 2021 22:42:59 GMT (envelope-from git) Date: Tue, 9 Mar 2021 22:42:59 GMT Message-Id: <202103092242.129MgxjP054680@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: a02640c79e0a - stable/13 - ice_ddp: Update package file to 1.3.19.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a02640c79e0a97b925f49302763da9aa201c4a20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 22:42:59 -0000 The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=a02640c79e0a97b925f49302763da9aa201c4a20 commit a02640c79e0a97b925f49302763da9aa201c4a20 Author: Eric Joyner AuthorDate: 2021-02-23 01:43:54 +0000 Commit: Eric Joyner CommitDate: 2021-03-09 22:35:50 +0000 ice_ddp: Update package file to 1.3.19.0 This package is intended to be used with ice(4) version 0.28.1-k. That update will happen in a forthcoming commit. Signed-off-by: Eric Joyner Sponsored by: Intel Corporation (cherry picked from commit a7ac518bff64d48cf262c60c4dc57eef34e74a07) --- sys/conf/files.amd64 | 6 +++--- sys/conf/files.arm64 | 6 +++--- sys/contrib/dev/ice/LICENSE | 2 +- .../dev/ice/{ice-1.3.16.0.pkg => ice-1.3.19.0.pkg} | Bin 659716 -> 614660 bytes sys/modules/ice_ddp/Makefile | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index ddd4e07b365c..cd7029daf06d 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -190,7 +190,7 @@ dev/ice/ice_sriov.c optional ice pci \ dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031000 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ @@ -199,8 +199,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.16.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.16.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.19.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.19.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" dev/ioat/ioat.c optional ioat pci diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index c1e5b40db3f9..3ca830f64f05 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -202,7 +202,7 @@ dev/ice/ice_sriov.c optional ice pci \ dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031000 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ @@ -211,8 +211,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.16.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.16.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.19.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.19.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" diff --git a/sys/contrib/dev/ice/LICENSE b/sys/contrib/dev/ice/LICENSE index 7daf627fc7a0..7faadfc55aac 100644 --- a/sys/contrib/dev/ice/LICENSE +++ b/sys/contrib/dev/ice/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2006-2018, Intel Corporation. +Copyright (c) 2006-2021, Intel Corporation. All rights reserved. Redistribution. Redistribution and use in binary form, without diff --git a/sys/contrib/dev/ice/ice-1.3.16.0.pkg b/sys/contrib/dev/ice/ice-1.3.19.0.pkg similarity index 79% rename from sys/contrib/dev/ice/ice-1.3.16.0.pkg rename to sys/contrib/dev/ice/ice-1.3.19.0.pkg index ec5caecb3a72..32e2603bc131 100644 Binary files a/sys/contrib/dev/ice/ice-1.3.16.0.pkg and b/sys/contrib/dev/ice/ice-1.3.19.0.pkg differ diff --git a/sys/modules/ice_ddp/Makefile b/sys/modules/ice_ddp/Makefile index e6f45ae3820b..38337a106368 100644 --- a/sys/modules/ice_ddp/Makefile +++ b/sys/modules/ice_ddp/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ KMOD= ice_ddp -FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.16.0.pkg:ice_ddp:0x01031000 +FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.19.0.pkg:ice_ddp:0x01031300 .include From owner-dev-commits-src-all@freebsd.org Tue Mar 9 22:43:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A147957456E; Tue, 9 Mar 2021 22:43: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 4Dw9GD3q3mz3Pnm; Tue, 9 Mar 2021 22:43: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 6CCE024633; Tue, 9 Mar 2021 22:43: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 129Mh0IF054700; Tue, 9 Mar 2021 22:43:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 129Mh0TB054699; Tue, 9 Mar 2021 22:43:00 GMT (envelope-from git) Date: Tue, 9 Mar 2021 22:43:00 GMT Message-Id: <202103092243.129Mh0TB054699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 1da549169de0 - stable/13 - ice(4): Update to version 0.28.1-k MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1da549169de0b30f0ba92fdb4e74897c837d618d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2021 22:43:00 -0000 The branch stable/13 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=1da549169de0b30f0ba92fdb4e74897c837d618d commit 1da549169de0b30f0ba92fdb4e74897c837d618d Author: Eric Joyner AuthorDate: 2021-02-23 01:45:09 +0000 Commit: Eric Joyner CommitDate: 2021-03-09 22:35:54 +0000 ice(4): Update to version 0.28.1-k This updates the driver to align with the version included in the "Intel Ethernet Adapter Complete Driver Pack", version 25.6. There are no major functional changes; this mostly contains bug fixes and changes to prepare for new features. This version of the driver uses the previously committed ice_ddp package 1.3.19.0. Signed-off-by: Eric Joyner Tested by: jeffrey.e.pieper@intel.com Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D28640 (cherry picked from commit d08b8680e12ad692736c84238dcf45c70c228914) --- sys/conf/files.amd64 | 2 + sys/conf/files.arm64 | 2 + sys/dev/ice/ice_adminq_cmd.h | 107 ++-- sys/dev/ice/ice_alloc.h | 2 +- sys/dev/ice/ice_bitops.h | 4 +- sys/dev/ice/ice_common.c | 135 ++--- sys/dev/ice/ice_common.h | 17 +- sys/dev/ice/ice_common_sysctls.h | 2 +- sys/dev/ice/ice_common_txrx.h | 2 +- sys/dev/ice/ice_controlq.c | 2 +- sys/dev/ice/ice_controlq.h | 6 +- sys/dev/ice/ice_dcb.c | 40 +- sys/dev/ice/ice_dcb.h | 2 +- sys/dev/ice/ice_devids.h | 2 +- sys/dev/ice/ice_drv_info.h | 27 +- sys/dev/ice/ice_features.h | 2 +- sys/dev/ice/ice_flex_pipe.c | 57 +- sys/dev/ice/ice_flex_pipe.h | 2 +- sys/dev/ice/ice_flex_type.h | 11 +- sys/dev/ice/ice_flow.c | 243 +++++---- sys/dev/ice/ice_flow.h | 36 +- sys/dev/ice/ice_hw_autogen.h | 2 +- sys/dev/ice/ice_iflib.h | 2 +- sys/dev/ice/ice_iflib_recovery_txrx.c | 2 +- sys/dev/ice/ice_iflib_sysctls.h | 2 +- sys/dev/ice/ice_iflib_txrx.c | 2 +- sys/dev/ice/ice_lan_tx_rx.h | 2 +- sys/dev/ice/ice_lib.c | 56 +- sys/dev/ice/ice_lib.h | 2 +- sys/dev/ice/ice_nvm.c | 954 +++++++++++++++++++++++++++++----- sys/dev/ice/ice_nvm.h | 24 +- sys/dev/ice/ice_opts.h | 2 +- sys/dev/ice/ice_osdep.c | 2 +- sys/dev/ice/ice_osdep.h | 2 +- sys/dev/ice/ice_protocol_type.h | 27 +- sys/dev/ice/ice_resmgr.c | 2 +- sys/dev/ice/ice_resmgr.h | 2 +- sys/dev/ice/ice_rss.h | 2 +- sys/dev/ice/ice_sbq_cmd.h | 2 +- sys/dev/ice/ice_sched.c | 562 ++++++++++++-------- sys/dev/ice/ice_sched.h | 31 +- sys/dev/ice/ice_sriov.c | 407 ++++++++++++++- sys/dev/ice/ice_sriov.h | 23 +- sys/dev/ice/ice_status.h | 2 +- sys/dev/ice/ice_strings.c | 2 +- sys/dev/ice/ice_switch.c | 70 ++- sys/dev/ice/ice_switch.h | 4 +- sys/dev/ice/ice_type.h | 266 ++++++++-- sys/dev/ice/ice_vlan_mode.c | 72 +++ sys/dev/ice/ice_vlan_mode.h | 60 +++ sys/dev/ice/if_ice_iflib.c | 2 +- sys/dev/ice/virtchnl.h | 287 +++++++++- sys/dev/ice/virtchnl_inline_ipsec.h | 16 +- sys/modules/ice/Makefile | 2 +- 54 files changed, 2881 insertions(+), 717 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index cd7029daf06d..1b56254dc892 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -189,6 +189,8 @@ dev/ice/ice_sriov.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" +dev/ice/ice_vlan_mode.c optional ice pci \ + compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 3ca830f64f05..8ecba5177125 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -201,6 +201,8 @@ dev/ice/ice_sriov.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" +dev/ice/ice_vlan_mode.c optional ice pci \ + compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ diff --git a/sys/dev/ice/ice_adminq_cmd.h b/sys/dev/ice/ice_adminq_cmd.h index 8d8c025fdd37..9179b0ce1226 100644 --- a/sys/dev/ice/ice_adminq_cmd.h +++ b/sys/dev/ice/ice_adminq_cmd.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -166,6 +166,7 @@ struct ice_aqc_list_caps_elem { #define ICE_AQC_CAPS_LOGI_TO_PHYSI_PORT_MAP 0x0073 #define ICE_AQC_CAPS_SKU 0x0074 #define ICE_AQC_CAPS_PORT_MAP 0x0075 +#define ICE_AQC_CAPS_PCIE_RESET_AVOIDANCE 0x0076 #define ICE_AQC_CAPS_NVM_MGMT 0x0080 u8 major_ver; @@ -1449,6 +1450,7 @@ struct ice_aqc_get_link_status_data { #define ICE_AQ_LINK_ACT_PORT_OPT_INVAL BIT(2) #define ICE_AQ_LINK_FEAT_ID_OR_CONFIG_ID_INVAL BIT(3) #define ICE_AQ_LINK_TOPO_CRITICAL_SDP_ERR BIT(4) +#define ICE_AQ_LINK_MODULE_POWER_UNSUPPORTED BIT(5) u8 link_info; #define ICE_AQ_LINK_UP BIT(0) /* Link Status */ #define ICE_AQ_LINK_FAULT BIT(1) @@ -1496,7 +1498,7 @@ struct ice_aqc_get_link_status_data { #define ICE_AQ_CFG_PACING_TYPE_FIXED ICE_AQ_CFG_PACING_TYPE_M /* External Device Power Ability */ u8 power_desc; -#define ICE_AQ_PWR_CLASS_M 0x3 +#define ICE_AQ_PWR_CLASS_M 0x3F #define ICE_AQ_LINK_PWR_BASET_LOW_HIGH 0 #define ICE_AQ_LINK_PWR_BASET_HIGH 1 #define ICE_AQ_LINK_PWR_QSFP_CLASS_1 0 @@ -1860,7 +1862,9 @@ struct ice_aqc_mdio { #define ICE_AQC_MDIO_DEV_M (0x1F << ICE_AQC_MDIO_DEV_S) #define ICE_AQC_MDIO_CLAUSE_22 BIT(5) #define ICE_AQC_MDIO_CLAUSE_45 BIT(6) - u8 rsvd; + u8 mdio_bus_address; +#define ICE_AQC_MDIO_BUS_ADDR_S 0 +#define ICE_AQC_MDIO_BUS_ADDR_M (0x1F << ICE_AQC_MDIO_BUS_ADDR_S) __le16 offset; __le16 data; /* Input in write cmd, output in read cmd. */ u8 rsvd1[4]; @@ -2001,6 +2005,22 @@ struct ice_aqc_sff_eeprom { __le32 addr_low; }; +/* SW Set GPIO command (indirect 0x6EF) + * SW Get GPIO command (indirect 0x6F0) + */ +struct ice_aqc_sw_gpio { + __le16 gpio_ctrl_handle; +#define ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_S 0 +#define ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_M (0x3FF << ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_S) + u8 gpio_num; +#define ICE_AQC_SW_GPIO_NUMBER_S 0 +#define ICE_AQC_SW_GPIO_NUMBER_M (0x1F << ICE_AQC_SW_GPIO_NUMBER_S) + u8 gpio_params; +#define ICE_AQC_SW_GPIO_PARAMS_DIRECTION BIT(1) +#define ICE_AQC_SW_GPIO_PARAMS_VALUE BIT(0) + u8 rsvd[12]; +}; + /* NVM Read command (indirect 0x0701) * NVM Erase commands (direct 0x0702) * NVM Write commands (indirect 0x0703) @@ -2027,6 +2047,9 @@ struct ice_aqc_nvm { #define ICE_AQC_NVM_REVERT_LAST_ACTIV BIT(6) /* Write Activate only */ #define ICE_AQC_NVM_ACTIV_SEL_MASK MAKEMASK(0x7, 3) #define ICE_AQC_NVM_FLASH_ONLY BIT(7) +#define ICE_AQC_NVM_POR_FLAG 0 /* Used by NVM Write completion on ARQ */ +#define ICE_AQC_NVM_PERST_FLAG 1 +#define ICE_AQC_NVM_EMPR_FLAG 2 __le16 module_typeid; __le16 length; #define ICE_AQC_NVM_ERASE_LEN 0xFFFF @@ -2056,32 +2079,22 @@ struct ice_aqc_nvm { #define ICE_AQC_NVM_LLDP_STATUS_M_LEN 4 /* In Bits */ #define ICE_AQC_NVM_LLDP_STATUS_RD_LEN 4 /* In Bytes */ -/* The result of netlist NVM read comes in a TLV format. The actual data - * (netlist header) starts from word offset 1 (byte 2). The FW strips - * out the type field from the TLV header so all the netlist fields - * should adjust their offset value by 1 word (2 bytes) in order to map - * their correct location. +#define ICE_AQC_NVM_MINSREV_MOD_ID 0x130 + +/* Used for reading and writing MinSRev using 0x0701 and 0x0703. Note that the + * type field is excluded from the section when reading and writing from + * a module using the module_typeid field with these AQ commands. */ -#define ICE_AQC_NVM_LINK_TOPO_NETLIST_MOD_ID 0x11B -#define ICE_AQC_NVM_LINK_TOPO_NETLIST_LEN_OFFSET 1 -#define ICE_AQC_NVM_LINK_TOPO_NETLIST_LEN 2 /* In bytes */ -#define ICE_AQC_NVM_NETLIST_NODE_COUNT_OFFSET 2 -#define ICE_AQC_NVM_NETLIST_NODE_COUNT_LEN 2 /* In bytes */ -#define ICE_AQC_NVM_NETLIST_NODE_COUNT_M MAKEMASK(0x3FF, 0) -#define ICE_AQC_NVM_NETLIST_ID_BLK_START_OFFSET 5 -#define ICE_AQC_NVM_NETLIST_ID_BLK_LEN 0x30 /* In words */ - -/* netlist ID block field offsets (word offsets) */ -#define ICE_AQC_NVM_NETLIST_ID_BLK_MAJOR_VER_LOW 2 -#define ICE_AQC_NVM_NETLIST_ID_BLK_MAJOR_VER_HIGH 3 -#define ICE_AQC_NVM_NETLIST_ID_BLK_MINOR_VER_LOW 4 -#define ICE_AQC_NVM_NETLIST_ID_BLK_MINOR_VER_HIGH 5 -#define ICE_AQC_NVM_NETLIST_ID_BLK_TYPE_LOW 6 -#define ICE_AQC_NVM_NETLIST_ID_BLK_TYPE_HIGH 7 -#define ICE_AQC_NVM_NETLIST_ID_BLK_REV_LOW 8 -#define ICE_AQC_NVM_NETLIST_ID_BLK_REV_HIGH 9 -#define ICE_AQC_NVM_NETLIST_ID_BLK_SHA_HASH 0xA -#define ICE_AQC_NVM_NETLIST_ID_BLK_CUST_VER 0x2F +struct ice_aqc_nvm_minsrev { + __le16 length; + __le16 validity; +#define ICE_AQC_NVM_MINSREV_NVM_VALID BIT(0) +#define ICE_AQC_NVM_MINSREV_OROM_VALID BIT(1) + __le16 nvm_minsrev_l; + __le16 nvm_minsrev_h; + __le16 orom_minsrev_l; + __le16 orom_minsrev_h; +}; /* Used for 0x0704 as well as for 0x0705 commands */ struct ice_aqc_nvm_cfg { @@ -2114,7 +2127,7 @@ struct ice_aqc_nvm_checksum { u8 rsvd2[12]; }; -/** +/* * Send to PF command (indirect 0x0801) ID is only used by PF * * Send to VF command (indirect 0x0802) ID is only used by PF @@ -2541,6 +2554,7 @@ struct ice_pkg_ver { }; #define ICE_PKG_NAME_SIZE 32 +#define ICE_SEG_ID_SIZE 28 #define ICE_SEG_NAME_SIZE 28 struct ice_aqc_get_pkg_info { @@ -2589,6 +2603,35 @@ struct ice_aqc_set_health_status_config { u8 reserved[15]; }; +#define ICE_AQC_HEALTH_STATUS_ERR_UNKNOWN_MOD_STRICT 0x101 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_TYPE 0x102 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_QUAL 0x103 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_COMM 0x104 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_CONFLICT 0x105 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_NOT_PRESENT 0x106 +#define ICE_AQC_HEALTH_STATUS_INFO_MOD_UNDERUTILIZED 0x107 +#define ICE_AQC_HEALTH_STATUS_ERR_UNKNOWN_MOD_LENIENT 0x108 +#define ICE_AQC_HEALTH_STATUS_ERR_INVALID_LINK_CFG 0x10B +#define ICE_AQC_HEALTH_STATUS_ERR_PORT_ACCESS 0x10C +#define ICE_AQC_HEALTH_STATUS_ERR_PORT_UNREACHABLE 0x10D +#define ICE_AQC_HEALTH_STATUS_INFO_PORT_SPEED_MOD_LIMITED 0x10F +#define ICE_AQC_HEALTH_STATUS_ERR_PARALLEL_FAULT 0x110 +#define ICE_AQC_HEALTH_STATUS_INFO_PORT_SPEED_PHY_LIMITED 0x111 +#define ICE_AQC_HEALTH_STATUS_ERR_NETLIST_TOPO 0x112 +#define ICE_AQC_HEALTH_STATUS_ERR_NETLIST 0x113 +#define ICE_AQC_HEALTH_STATUS_ERR_TOPO_CONFLICT 0x114 +#define ICE_AQC_HEALTH_STATUS_ERR_LINK_HW_ACCESS 0x115 +#define ICE_AQC_HEALTH_STATUS_ERR_LINK_RUNTIME 0x116 +#define ICE_AQC_HEALTH_STATUS_ERR_DNL_INIT 0x117 +#define ICE_AQC_HEALTH_STATUS_INFO_RECOVERY 0x500 +#define ICE_AQC_HEALTH_STATUS_ERR_FLASH_ACCESS 0x501 +#define ICE_AQC_HEALTH_STATUS_ERR_NVM_AUTH 0x502 +#define ICE_AQC_HEALTH_STATUS_ERR_OROM_AUTH 0x503 +#define ICE_AQC_HEALTH_STATUS_ERR_DDP_AUTH 0x504 +#define ICE_AQC_HEALTH_STATUS_ERR_NVM_COMPAT 0x505 +#define ICE_AQC_HEALTH_STATUS_ERR_OROM_COMPAT 0x506 +#define ICE_AQC_HEALTH_STATUS_ERR_DCB_MIB 0x509 + /* Get Health Status codes (indirect 0xFF21) */ struct ice_aqc_get_supported_health_status_codes { __le16 health_code_count; @@ -2630,8 +2673,8 @@ struct ice_aqc_clear_health_status { * @opcode: AQ command opcode * @datalen: length in bytes of indirect/external data buffer * @retval: return value from firmware - * @cookie_h: opaque data high-half - * @cookie_l: opaque data low-half + * @cookie_high: opaque data high-half + * @cookie_low: opaque data low-half * @params: command-specific parameters * * Descriptor format for commands the driver posts on the Admin Transmit Queue @@ -2920,6 +2963,8 @@ enum ice_adminq_opc { ice_aqc_opc_set_gpio = 0x06EC, ice_aqc_opc_get_gpio = 0x06ED, ice_aqc_opc_sff_eeprom = 0x06EE, + ice_aqc_opc_sw_set_gpio = 0x06EF, + ice_aqc_opc_sw_get_gpio = 0x06F0, /* NVM commands */ ice_aqc_opc_nvm_read = 0x0701, diff --git a/sys/dev/ice/ice_alloc.h b/sys/dev/ice/ice_alloc.h index 1d9b9169eb02..b281958be793 100644 --- a/sys/dev/ice/ice_alloc.h +++ b/sys/dev/ice/ice_alloc.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_bitops.h b/sys/dev/ice/ice_bitops.h index 7c8cf6cb90f5..a7f729060b78 100644 --- a/sys/dev/ice/ice_bitops.h +++ b/sys/dev/ice/ice_bitops.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -423,7 +423,7 @@ ice_bitmap_set(ice_bitmap_t *dst, u16 pos, u16 num_bits) { u16 i; - for (i = pos; i < num_bits; i++) + for (i = pos; i < pos + num_bits; i++) ice_set_bit(i, dst); } diff --git a/sys/dev/ice/ice_common.c b/sys/dev/ice/ice_common.c index 20689f4893d4..5e2e4340c75c 100644 --- a/sys/dev/ice/ice_common.c +++ b/sys/dev/ice/ice_common.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -265,7 +265,7 @@ ice_aq_get_link_topo_handle(struct ice_port_info *pi, u8 node_type, return ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd); } -/* +/** * ice_is_media_cage_present * @pi: port information structure * @@ -704,13 +704,14 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw) void ice_print_rollback_msg(struct ice_hw *hw) { char nvm_str[ICE_NVM_VER_LEN] = { 0 }; - struct ice_nvm_info *nvm = &hw->nvm; struct ice_orom_info *orom; + struct ice_nvm_info *nvm; - orom = &nvm->orom; + orom = &hw->flash.orom; + nvm = &hw->flash.nvm; SNPRINTF(nvm_str, sizeof(nvm_str), "%x.%02x 0x%x %d.%d.%d", - nvm->major_ver, nvm->minor_ver, nvm->eetrack, orom->major, + nvm->major, nvm->minor, nvm->eetrack, orom->major, orom->build, orom->patch); ice_warn(hw, "Firmware rollback mode detected. Current version is NVM: %s, FW: %d.%d. Device may exhibit limited functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware rollback mode\n", @@ -805,8 +806,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw) ICE_AQC_REPORT_TOPO_CAP, pcaps, NULL); ice_free(hw, pcaps); if (status) - ice_debug(hw, ICE_DBG_PHY, "%s: Get PHY capabilities failed, continuing anyway\n", - __func__); + ice_debug(hw, ICE_DBG_PHY, "Get PHY capabilities failed, continuing anyway\n"); /* Initialize port_info struct with link information */ status = ice_aq_get_link_info(hw->port_info, false, NULL, NULL); @@ -850,6 +850,9 @@ enum ice_status ice_init_hw(struct ice_hw *hw) if (status) goto err_unroll_fltr_mgmt_struct; ice_init_lock(&hw->tnl_lock); + + ice_init_vlan_mode_ops(hw); + return ICE_SUCCESS; err_unroll_fltr_mgmt_struct: @@ -1701,7 +1704,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries, if (!buf) return ICE_ERR_PARAM; - if (buf_size < (num_entries * sizeof(buf->elem[0]))) + if (buf_size < FLEX_ARRAY_SIZE(buf, elem, num_entries)) return ICE_ERR_PARAM; ice_fill_dflt_direct_cmd_desc(&desc, opc); @@ -1982,6 +1985,16 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps, case ICE_AQC_CAPS_NVM_VER: break; case ICE_AQC_CAPS_NVM_MGMT: + caps->sec_rev_disabled = + (number & ICE_NVM_MGMT_SEC_REV_DISABLED) ? + true : false; + ice_debug(hw, ICE_DBG_INIT, "%s: sec_rev_disabled = %d\n", prefix, + caps->sec_rev_disabled); + caps->update_disabled = + (number & ICE_NVM_MGMT_UPDATE_DISABLED) ? + true : false; + ice_debug(hw, ICE_DBG_INIT, "%s: update_disabled = %d\n", prefix, + caps->update_disabled); caps->nvm_unified_update = (number & ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT) ? true : false; @@ -2389,26 +2402,25 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) { struct ice_hw_func_caps *func_caps = &hw->func_caps; struct ice_hw_dev_caps *dev_caps = &hw->dev_caps; - u32 valid_func, rxq_first_id, txq_first_id; - u32 msix_vector_first_id, max_mtu; + struct ice_hw_common_caps cached_caps; u32 num_funcs; /* cache some func_caps values that should be restored after memset */ - valid_func = func_caps->common_cap.valid_functions; - txq_first_id = func_caps->common_cap.txq_first_id; - rxq_first_id = func_caps->common_cap.rxq_first_id; - msix_vector_first_id = func_caps->common_cap.msix_vector_first_id; - max_mtu = func_caps->common_cap.max_mtu; + cached_caps = func_caps->common_cap; /* unset func capabilities */ memset(func_caps, 0, sizeof(*func_caps)); +#define ICE_RESTORE_FUNC_CAP(name) \ + func_caps->common_cap.name = cached_caps.name + /* restore cached values */ - func_caps->common_cap.valid_functions = valid_func; - func_caps->common_cap.txq_first_id = txq_first_id; - func_caps->common_cap.rxq_first_id = rxq_first_id; - func_caps->common_cap.msix_vector_first_id = msix_vector_first_id; - func_caps->common_cap.max_mtu = max_mtu; + ICE_RESTORE_FUNC_CAP(valid_functions); + ICE_RESTORE_FUNC_CAP(txq_first_id); + ICE_RESTORE_FUNC_CAP(rxq_first_id); + ICE_RESTORE_FUNC_CAP(msix_vector_first_id); + ICE_RESTORE_FUNC_CAP(max_mtu); + ICE_RESTORE_FUNC_CAP(nvm_unified_update); /* one Tx and one Rx queue in safe mode */ func_caps->common_cap.num_rxq = 1; @@ -2419,22 +2431,22 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) func_caps->guar_num_vsi = 1; /* cache some dev_caps values that should be restored after memset */ - valid_func = dev_caps->common_cap.valid_functions; - txq_first_id = dev_caps->common_cap.txq_first_id; - rxq_first_id = dev_caps->common_cap.rxq_first_id; - msix_vector_first_id = dev_caps->common_cap.msix_vector_first_id; - max_mtu = dev_caps->common_cap.max_mtu; + cached_caps = dev_caps->common_cap; num_funcs = dev_caps->num_funcs; /* unset dev capabilities */ memset(dev_caps, 0, sizeof(*dev_caps)); +#define ICE_RESTORE_DEV_CAP(name) \ + dev_caps->common_cap.name = cached_caps.name + /* restore cached values */ - dev_caps->common_cap.valid_functions = valid_func; - dev_caps->common_cap.txq_first_id = txq_first_id; - dev_caps->common_cap.rxq_first_id = rxq_first_id; - dev_caps->common_cap.msix_vector_first_id = msix_vector_first_id; - dev_caps->common_cap.max_mtu = max_mtu; + ICE_RESTORE_DEV_CAP(valid_functions); + ICE_RESTORE_DEV_CAP(txq_first_id); + ICE_RESTORE_DEV_CAP(rxq_first_id); + ICE_RESTORE_DEV_CAP(msix_vector_first_id); + ICE_RESTORE_DEV_CAP(max_mtu); + ICE_RESTORE_DEV_CAP(nvm_unified_update); dev_caps->num_funcs = num_funcs; /* one Tx and one Rx queue per function in safe mode */ @@ -2480,7 +2492,7 @@ ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags, ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_manage_mac_write); cmd->flags = flags; - ice_memcpy(cmd->mac_addr, mac_addr, ETH_ALEN, ICE_NONDMA_TO_DMA); + ice_memcpy(cmd->mac_addr, mac_addr, ETH_ALEN, ICE_NONDMA_TO_NONDMA); return ice_aq_send_cmd(hw, &desc, NULL, 0, cd); } @@ -2816,6 +2828,11 @@ enum ice_status ice_update_link_info(struct ice_port_info *pi) status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP, pcaps, NULL); + if (status == ICE_SUCCESS) + ice_memcpy(li->module_type, &pcaps->module_type, + sizeof(li->module_type), + ICE_NONDMA_TO_NONDMA); + ice_free(hw, pcaps); } @@ -3379,7 +3396,7 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr, ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_sff_eeprom); cmd = &desc.params.read_write_sff_param; - desc.flags = CPU_TO_LE16(ICE_AQ_FLAG_RD | ICE_AQ_FLAG_BUF); + desc.flags = CPU_TO_LE16(ICE_AQ_FLAG_RD); cmd->lport_num = (u8)(lport & 0xff); cmd->lport_num_valid = (u8)((lport >> 8) & 0x01); cmd->i2c_bus_addr = CPU_TO_LE16(((bus_addr >> 1) & @@ -3399,23 +3416,33 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr, /** * __ice_aq_get_set_rss_lut * @hw: pointer to the hardware structure - * @vsi_id: VSI FW index - * @lut_type: LUT table type - * @lut: pointer to the LUT buffer provided by the caller - * @lut_size: size of the LUT buffer - * @glob_lut_idx: global LUT index + * @params: RSS LUT parameters * @set: set true to set the table, false to get the table * * Internal function to get (0x0B05) or set (0x0B03) RSS look up table */ static enum ice_status -__ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, - u16 lut_size, u8 glob_lut_idx, bool set) +__ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *params, bool set) { + u16 flags = 0, vsi_id, lut_type, lut_size, glob_lut_idx, vsi_handle; struct ice_aqc_get_set_rss_lut *cmd_resp; struct ice_aq_desc desc; enum ice_status status; - u16 flags = 0; + u8 *lut; + + if (!params) + return ICE_ERR_PARAM; + + vsi_handle = params->vsi_handle; + lut = params->lut; + + if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) + return ICE_ERR_PARAM; + + lut_size = params->lut_size; + lut_type = params->lut_type; + glob_lut_idx = params->global_lut_id; + vsi_id = ice_get_hw_vsi_num(hw, vsi_handle); cmd_resp = &desc.params.get_set_rss_lut; @@ -3492,43 +3519,27 @@ ice_aq_get_set_rss_lut_exit: /** * ice_aq_get_rss_lut * @hw: pointer to the hardware structure - * @vsi_handle: software VSI handle - * @lut_type: LUT table type - * @lut: pointer to the LUT buffer provided by the caller - * @lut_size: size of the LUT buffer + * @get_params: RSS LUT parameters used to specify which RSS LUT to get * * get the RSS lookup table, PF or VSI type */ enum ice_status -ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, - u8 *lut, u16 lut_size) +ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params) { - if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) - return ICE_ERR_PARAM; - - return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle), - lut_type, lut, lut_size, 0, false); + return __ice_aq_get_set_rss_lut(hw, get_params, false); } /** * ice_aq_set_rss_lut * @hw: pointer to the hardware structure - * @vsi_handle: software VSI handle - * @lut_type: LUT table type - * @lut: pointer to the LUT buffer provided by the caller - * @lut_size: size of the LUT buffer + * @set_params: RSS LUT parameters used to specify how to set the RSS LUT * * set the RSS lookup table, PF or VSI type */ enum ice_status -ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, - u8 *lut, u16 lut_size) +ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_params) { - if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) - return ICE_ERR_PARAM; - - return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle), - lut_type, lut, lut_size, 0, true); + return __ice_aq_get_set_rss_lut(hw, set_params, true); } /** diff --git a/sys/dev/ice/ice_common.h b/sys/dev/ice/ice_common.h index 84a39b7e9b8a..3a28816fb131 100644 --- a/sys/dev/ice/ice_common.h +++ b/sys/dev/ice/ice_common.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -117,11 +117,9 @@ ice_write_tx_drbell_q_ctx(struct ice_hw *hw, u32 tx_drbell_q_index); enum ice_status -ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, u8 *lut, - u16 lut_size); +ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params); enum ice_status -ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, u8 *lut, - u16 lut_size); +ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_params); enum ice_status ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_handle, struct ice_aqc_get_set_rss_keys *keys); @@ -240,13 +238,6 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle, struct ice_sq_cd *cd); enum ice_status ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle); void ice_replay_post(struct ice_hw *hw); -void ice_sched_replay_agg_vsi_preinit(struct ice_hw *hw); -void ice_sched_replay_agg(struct ice_hw *hw); -enum ice_status ice_sched_replay_tc_node_bw(struct ice_port_info *pi); -enum ice_status ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle); -enum ice_status ice_sched_replay_root_node_bw(struct ice_port_info *pi); -enum ice_status -ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx); struct ice_q_ctx * ice_get_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 q_handle); void @@ -277,7 +268,7 @@ enum ice_status ice_get_cur_lldp_persist_status(struct ice_hw *hw, u32 *lldp_status); enum ice_status ice_get_dflt_lldp_persist_status(struct ice_hw *hw, u32 *lldp_status); -enum ice_status ice_get_netlist_ver_info(struct ice_hw *hw); +enum ice_status ice_get_netlist_ver_info(struct ice_hw *hw, struct ice_netlist_info *netlist); enum ice_status ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size, struct ice_sq_cd *cd); diff --git a/sys/dev/ice/ice_common_sysctls.h b/sys/dev/ice/ice_common_sysctls.h index 82ead3fcfecc..17c2fce72ee7 100644 --- a/sys/dev/ice/ice_common_sysctls.h +++ b/sys/dev/ice/ice_common_sysctls.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_common_txrx.h b/sys/dev/ice/ice_common_txrx.h index 8fb3d49288d8..d5e6182c2212 100644 --- a/sys/dev/ice/ice_common_txrx.h +++ b/sys/dev/ice/ice_common_txrx.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_controlq.c b/sys/dev/ice/ice_controlq.c index 3caab15e0e41..ee8d7f5c3e8f 100644 --- a/sys/dev/ice/ice_controlq.c +++ b/sys/dev/ice/ice_controlq.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_controlq.h b/sys/dev/ice/ice_controlq.h index 0da6b025fc8c..947f1d6d1767 100644 --- a/sys/dev/ice/ice_controlq.h +++ b/sys/dev/ice/ice_controlq.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,8 +60,8 @@ enum ice_ctl_q { ICE_CTL_Q_MAILBOX, }; -/* Control Queue timeout settings - max delay 250ms */ -#define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500 /* Count 2500 times */ +/* Control Queue timeout settings - max delay 1s */ +#define ICE_CTL_Q_SQ_CMD_TIMEOUT 10000 /* Count 10000 times */ #define ICE_CTL_Q_SQ_CMD_USEC 100 /* Check every 100usec */ #define ICE_CTL_Q_ADMIN_INIT_TIMEOUT 10 /* Count 10 times */ #define ICE_CTL_Q_ADMIN_INIT_MSEC 100 /* Check every 100msec */ diff --git a/sys/dev/ice/ice_dcb.c b/sys/dev/ice/ice_dcb.c index b6275c5d07e8..abe0237eb88f 100644 --- a/sys/dev/ice/ice_dcb.c +++ b/sys/dev/ice/ice_dcb.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -994,22 +994,27 @@ ice_aq_set_dcb_parameters(struct ice_hw *hw, bool dcb_enable, /** * ice_cee_to_dcb_cfg * @cee_cfg: pointer to CEE configuration struct - * @dcbcfg: DCB configuration struct + * @pi: port information structure * * Convert CEE configuration from firmware to DCB configuration */ static void ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, - struct ice_dcbx_cfg *dcbcfg) + struct ice_port_info *pi) { u32 status, tlv_status = LE32_TO_CPU(cee_cfg->tlv_status); u32 ice_aqc_cee_status_mask, ice_aqc_cee_status_shift; + u8 i, j, err, sync, oper, app_index, ice_app_sel_type; u16 app_prio = LE16_TO_CPU(cee_cfg->oper_app_prio); - u8 i, err, sync, oper, app_index, ice_app_sel_type; u16 ice_aqc_cee_app_mask, ice_aqc_cee_app_shift; + struct ice_dcbx_cfg *cmp_dcbcfg, *dcbcfg; u16 ice_app_prot_id_type; - /* CEE PG data to ETS config */ + dcbcfg = &pi->qos_cfg.local_dcbx_cfg; + dcbcfg->dcbx_mode = ICE_DCBX_MODE_CEE; + dcbcfg->tlv_status = tlv_status; + + /* CEE PG data */ dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; /* Note that the FW creates the oper_prio_tc nibbles reversed @@ -1036,10 +1041,16 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, } } - /* CEE PFC data to ETS config */ + /* CEE PFC data */ dcbcfg->pfc.pfcena = cee_cfg->oper_pfc_en; dcbcfg->pfc.pfccap = ICE_MAX_TRAFFIC_CLASS; + /* CEE APP TLV data */ + if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) + cmp_dcbcfg = &pi->qos_cfg.desired_dcbx_cfg; + else + cmp_dcbcfg = &pi->qos_cfg.remote_dcbx_cfg; + app_index = 0; for (i = 0; i < 3; i++) { if (i == 0) { @@ -1058,6 +1069,18 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_ISCSI_S; ice_app_sel_type = ICE_APP_SEL_TCPIP; ice_app_prot_id_type = ICE_APP_PROT_ID_ISCSI; + + for (j = 0; j < cmp_dcbcfg->numapps; j++) { + u16 prot_id = cmp_dcbcfg->app[j].prot_id; + u8 sel = cmp_dcbcfg->app[j].selector; + + if (sel == ICE_APP_SEL_TCPIP && + (prot_id == ICE_APP_PROT_ID_ISCSI || + prot_id == ICE_APP_PROT_ID_ISCSI_860)) { + ice_app_prot_id_type = prot_id; + break; + } + } } else { /* FIP APP */ ice_aqc_cee_status_mask = ICE_AQC_CEE_FIP_STATUS_M; @@ -1148,11 +1171,8 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL); if (ret == ICE_SUCCESS) { /* CEE mode */ - dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; - dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_CEE; - dcbx_cfg->tlv_status = LE32_TO_CPU(cee_cfg.tlv_status); - ice_cee_to_dcb_cfg(&cee_cfg, dcbx_cfg); ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_CEE); + ice_cee_to_dcb_cfg(&cee_cfg, pi); } else if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) { /* CEE mode not enabled try querying IEEE data */ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; diff --git a/sys/dev/ice/ice_dcb.h b/sys/dev/ice/ice_dcb.h index 88c49c89fbd2..85d6b399cf11 100644 --- a/sys/dev/ice/ice_dcb.h +++ b/sys/dev/ice/ice_dcb.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_devids.h b/sys/dev/ice/ice_devids.h index a110133823df..8611fc170816 100644 --- a/sys/dev/ice/ice_devids.h +++ b/sys/dev/ice/ice_devids.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_drv_info.h b/sys/dev/ice/ice_drv_info.h index 9ed3e3e2fb0e..340d53e4a671 100644 --- a/sys/dev/ice/ice_drv_info.h +++ b/sys/dev/ice/ice_drv_info.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,16 +63,16 @@ * @var ice_rc_version * @brief driver release candidate version number */ -const char ice_driver_version[] = "0.26.16-k"; +const char ice_driver_version[] = "0.28.1-k"; const uint8_t ice_major_version = 0; -const uint8_t ice_minor_version = 26; -const uint8_t ice_patch_version = 16; +const uint8_t ice_minor_version = 28; +const uint8_t ice_patch_version = 1; const uint8_t ice_rc_version = 0; #define PVIDV(vendor, devid, name) \ - PVID(vendor, devid, name " - 0.26.16-k") + PVID(vendor, devid, name " - 0.28.1-k") #define PVIDV_OEM(vendor, devid, svid, sdevid, revid, name) \ - PVID_OEM(vendor, devid, svid, sdevid, revid, name " - 0.26.16-k") + PVID_OEM(vendor, devid, svid, sdevid, revid, name " - 0.28.1-k") /** * @var ice_vendor_info_array @@ -113,20 +113,11 @@ static pci_vendor_info_t ice_vendor_info_array[] = { PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP, ICE_INTEL_VENDOR_ID, 0x0008, 0, "Intel(R) Ethernet Network Adapter E810-C-Q2 for OCP3.0"), + PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP, + ICE_INTEL_VENDOR_ID, 0x000D, 0, + "Intel(R) Ethernet Network Adapter E810-L-Q2 for OCP3.0"), PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP, "Intel(R) Ethernet Controller E810-C for QSFP"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0001, 0, - "Intel(R) Ethernet Network Adapter E810-L-1"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0002, 0, - "Intel(R) Ethernet Network Adapter E810-L-2"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0003, 0, - "Intel(R) Ethernet Network Adapter E810-L-1"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0004, 0, - "Intel(R) Ethernet Network Adapter E810-L-2"), PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, ICE_INTEL_VENDOR_ID, 0x0005, 0, "Intel(R) Ethernet Network Adapter E810-XXV-4"), diff --git a/sys/dev/ice/ice_features.h b/sys/dev/ice/ice_features.h index f5ea542d8626..dcb096509f73 100644 --- a/sys/dev/ice/ice_features.h +++ b/sys/dev/ice/ice_features.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_flex_pipe.c b/sys/dev/ice/ice_flex_pipe.c index 6a02239eca5c..e8e4403a23fe 100644 --- a/sys/dev/ice/ice_flex_pipe.c +++ b/sys/dev/ice/ice_flex_pipe.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1057,6 +1057,13 @@ ice_dwnld_cfg_bufs(struct ice_hw *hw, struct ice_buf *bufs, u32 count) break; } + if (!status) { + status = ice_set_vlan_mode(hw); + if (status) + ice_debug(hw, ICE_DBG_PKG, "Failed to set VLAN mode: err %d\n", + status); + } + ice_release_global_cfg_lock(hw); return status; @@ -1126,34 +1133,40 @@ ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg) static enum ice_status ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr) { - struct ice_global_metadata_seg *meta_seg; struct ice_generic_seg_hdr *seg_hdr; ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); if (!pkg_hdr) return ICE_ERR_PARAM; - meta_seg = (struct ice_global_metadata_seg *) - ice_find_seg_in_pkg(hw, SEGMENT_TYPE_METADATA, pkg_hdr); - if (meta_seg) { - hw->pkg_ver = meta_seg->pkg_ver; - ice_memcpy(hw->pkg_name, meta_seg->pkg_name, - sizeof(hw->pkg_name), ICE_NONDMA_TO_NONDMA); + seg_hdr = (struct ice_generic_seg_hdr *) + ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr); + if (seg_hdr) { + struct ice_meta_sect *meta; + struct ice_pkg_enum state; + + ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM); + + /* Get package information from the Metadata Section */ + meta = (struct ice_meta_sect *) + ice_pkg_enum_section((struct ice_seg *)seg_hdr, &state, + ICE_SID_METADATA); + if (!meta) { + ice_debug(hw, ICE_DBG_INIT, "Did not find ice metadata section in package\n"); + return ICE_ERR_CFG; + } + + hw->pkg_ver = meta->ver; + ice_memcpy(hw->pkg_name, meta->name, sizeof(meta->name), + ICE_NONDMA_TO_NONDMA); ice_debug(hw, ICE_DBG_PKG, "Pkg: %d.%d.%d.%d, %s\n", - meta_seg->pkg_ver.major, meta_seg->pkg_ver.minor, - meta_seg->pkg_ver.update, meta_seg->pkg_ver.draft, - meta_seg->pkg_name); - } else { - ice_debug(hw, ICE_DBG_INIT, "Did not find metadata segment in driver package\n"); - return ICE_ERR_CFG; - } + meta->ver.major, meta->ver.minor, meta->ver.update, + meta->ver.draft, meta->name); - seg_hdr = ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr); - if (seg_hdr) { - hw->ice_pkg_ver = seg_hdr->seg_format_ver; - ice_memcpy(hw->ice_pkg_name, seg_hdr->seg_id, - sizeof(hw->ice_pkg_name), ICE_NONDMA_TO_NONDMA); + hw->ice_seg_fmt_ver = seg_hdr->seg_format_ver; + ice_memcpy(hw->ice_seg_id, seg_hdr->seg_id, + sizeof(hw->ice_seg_id), ICE_NONDMA_TO_NONDMA); *** 4744 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:36:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 305235AA994; Wed, 10 Mar 2021 09:36: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 4DwRly0s4Mz4l4Z; Wed, 10 Mar 2021 09:36: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 108134E49; Wed, 10 Mar 2021 09: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 12A9aE9X013652; Wed, 10 Mar 2021 09: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 12A9aDPl013647; Wed, 10 Mar 2021 09:36:13 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:36:13 GMT Message-Id: <202103100936.12A9aDPl013647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 21b12f3e451b - stable/13 - zfs: merge OpenZFS master-436ab35a5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 21b12f3e451b0d21ff4a3776cb5d11750c7cc822 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:36:14 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=21b12f3e451b0d21ff4a3776cb5d11750c7cc822 commit 21b12f3e451b0d21ff4a3776cb5d11750c7cc822 Author: Martin Matuska AuthorDate: 2021-02-16 00:39:34 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:24:58 +0000 zfs: merge OpenZFS master-436ab35a5 - speed up writing to ZFS pools without ZIL devices (aa755b3) - speed up importing ZFS pools (2d8f72d, a0e0199, cf0977a) ... Reviewed by: mjg (partial) Tested by: pho Differential Revision: https://reviews.freebsd.org/D28677 (cherry picked from commit 184c1b943937986c81e1996d999d21626ec7a4ff) --- cddl/lib/libzfs/Makefile | 1 - cddl/lib/libzpool/Makefile | 1 - .../openzfs/.github/PULL_REQUEST_TEMPLATE.md | 42 +++ .../.github/workflows/zfs-tests-functional.yml | 64 ++++ .../openzfs/.github/workflows/zfs-tests-sanity.yml | 60 ++++ sys/contrib/openzfs/META | 2 +- sys/contrib/openzfs/Makefile.am | 13 +- sys/contrib/openzfs/cmd/Makefile.am | 10 + sys/contrib/openzfs/cmd/mount_zfs/Makefile.am | 2 + sys/contrib/openzfs/cmd/mount_zfs/mount_zfs.c | 15 + sys/contrib/openzfs/cmd/raidz_test/Makefile.am | 2 + sys/contrib/openzfs/cmd/raidz_test/raidz_test.c | 5 +- sys/contrib/openzfs/cmd/vdev_id/vdev_id | 399 +++++++++++++++------ sys/contrib/openzfs/cmd/zdb/Makefile.am | 2 + sys/contrib/openzfs/cmd/zdb/zdb.c | 138 ++++++- sys/contrib/openzfs/cmd/zed/Makefile.am | 2 + sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c | 19 +- sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c | 2 +- sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh | 0 sys/contrib/openzfs/cmd/zfs/Makefile.am | 2 + .../openzfs/cmd/zfs_ids_to_path/Makefile.am | 2 + sys/contrib/openzfs/cmd/zgenhostid/Makefile.am | 4 +- sys/contrib/openzfs/cmd/zhack/Makefile.am | 2 + sys/contrib/openzfs/cmd/zinject/Makefile.am | 2 + sys/contrib/openzfs/cmd/zpool/Makefile.am | 2 + sys/contrib/openzfs/cmd/zpool/zpool_main.c | 15 +- sys/contrib/openzfs/cmd/zpool_influxdb/Makefile.am | 2 + sys/contrib/openzfs/cmd/zstream/Makefile.am | 2 + sys/contrib/openzfs/cmd/ztest/Makefile.am | 2 + sys/contrib/openzfs/cmd/ztest/ztest.c | 388 ++++++++++---------- sys/contrib/openzfs/cmd/zvol_id/Makefile.am | 2 + sys/contrib/openzfs/config/CppCheck.am | 11 + sys/contrib/openzfs/config/Rules.am | 1 + sys/contrib/openzfs/config/always-cppcheck.m4 | 6 + sys/contrib/openzfs/config/ax_count_cpus.m4 | 101 ++++++ .../openzfs/config/kernel-get-disk-and-module.m4 | 0 sys/contrib/openzfs/config/kernel-vfs-iov_iter.m4 | 44 --- sys/contrib/openzfs/config/zfs-build.m4 | 10 +- .../contrib/dracut/90zfs/module-setup.sh.in | 4 +- .../contrib/dracut/90zfs/zfs-env-bootfs.service.in | 2 +- .../contrib/dracut/90zfs/zfs-generator.sh.in | 8 + .../contrib/dracut/90zfs/zfs-load-key.sh.in | 2 +- .../pyzfs/libzfs_core/test/test_libzfs_core.py | 4 +- sys/contrib/openzfs/cppcheck-suppressions.txt | 8 - .../etc/systemd/system/zfs-import-cache.service.in | 2 +- .../etc/systemd/system/zfs-import-scan.service.in | 2 +- .../openzfs/include/os/freebsd/spl/sys/Makefile.am | 1 + .../openzfs/include/os/freebsd/spl/sys/ccompile.h | 3 - .../openzfs/include/os/freebsd/spl/sys/fcntl.h | 38 ++ .../openzfs/include/os/freebsd/spl/sys/uio.h | 79 ++-- .../include/os/freebsd/zfs/sys/freebsd_crypto.h | 2 +- .../include/os/freebsd/zfs/sys/zfs_znode_impl.h | 5 +- sys/contrib/openzfs/include/os/linux/spl/sys/uio.h | 73 ++-- .../include/os/linux/zfs/sys/zfs_vnops_os.h | 2 +- .../include/os/linux/zfs/sys/zfs_znode_impl.h | 5 +- sys/contrib/openzfs/include/sys/abd.h | 75 +++- sys/contrib/openzfs/include/sys/abd_impl.h | 48 +-- sys/contrib/openzfs/include/sys/crypto/common.h | 2 +- sys/contrib/openzfs/include/sys/dmu.h | 15 +- sys/contrib/openzfs/include/sys/fs/zfs.h | 1 + sys/contrib/openzfs/include/sys/sa.h | 2 +- sys/contrib/openzfs/include/sys/spa.h | 1 + sys/contrib/openzfs/include/sys/spa_impl.h | 1 + sys/contrib/openzfs/include/sys/uio_impl.h | 8 +- sys/contrib/openzfs/include/sys/vdev.h | 4 + sys/contrib/openzfs/include/sys/vdev_impl.h | 5 + sys/contrib/openzfs/include/sys/vdev_raidz_impl.h | 1 + sys/contrib/openzfs/include/sys/zfs_debug.h | 1 + sys/contrib/openzfs/include/sys/zfs_sa.h | 2 +- sys/contrib/openzfs/include/sys/zfs_vnops.h | 8 +- sys/contrib/openzfs/include/sys/zfs_znode.h | 2 + sys/contrib/openzfs/lib/Makefile.am | 10 +- sys/contrib/openzfs/lib/libavl/Makefile.am | 2 + sys/contrib/openzfs/lib/libefi/Makefile.am | 2 + sys/contrib/openzfs/lib/libefi/rdwr_efi.c | 1 + sys/contrib/openzfs/lib/libicp/Makefile.am | 2 + sys/contrib/openzfs/lib/libnvpair/Makefile.am | 3 +- sys/contrib/openzfs/lib/libshare/Makefile.am | 2 + sys/contrib/openzfs/lib/libspl/Makefile.am | 9 + .../lib/libspl/include/os/freebsd/Makefile.am | 4 + .../openzfs/lib/libspl/include/os/freebsd/fcntl.h | 33 ++ .../lib/libspl/include/os/freebsd/sys/Makefile.am | 1 + .../lib/libspl/include/os/freebsd/sys/fcntl.h | 38 ++ sys/contrib/openzfs/lib/libspl/include/sys/uio.h | 44 +-- sys/contrib/openzfs/lib/libtpool/Makefile.am | 2 + sys/contrib/openzfs/lib/libunicode/Makefile.am | 2 + sys/contrib/openzfs/lib/libuutil/Makefile.am | 3 +- sys/contrib/openzfs/lib/libuutil/uu_avl.c | 1 + sys/contrib/openzfs/lib/libzfs/Makefile.am | 3 +- sys/contrib/openzfs/lib/libzfs/libzfs_import.c | 2 +- sys/contrib/openzfs/lib/libzfs/libzfs_pool.c | 51 ++- sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c | 205 +++++------ sys/contrib/openzfs/lib/libzfs_core/Makefile.am | 3 +- sys/contrib/openzfs/lib/libzfsbootenv/Makefile.am | 3 +- sys/contrib/openzfs/lib/libzpool/Makefile.am | 2 + sys/contrib/openzfs/lib/libzstd/Makefile.am | 2 + sys/contrib/openzfs/lib/libzutil/Makefile.am | 5 +- .../lib/libzutil/os/freebsd/zutil_import_os.c | 20 +- sys/contrib/openzfs/lib/libzutil/zutil_import.c | 52 ++- .../openzfs/man/man5/zfs-module-parameters.5 | 16 + sys/contrib/openzfs/man/man8/zdb.8 | 18 +- sys/contrib/openzfs/man/man8/zfs-list.8 | 11 +- sys/contrib/openzfs/man/man8/zfs-program.8 | 4 +- sys/contrib/openzfs/man/man8/zfsprops.8 | 2 +- sys/contrib/openzfs/module/Makefile.in | 22 +- sys/contrib/openzfs/module/avl/avl.c | 3 - sys/contrib/openzfs/module/icp/algs/modes/modes.c | 12 +- sys/contrib/openzfs/module/icp/core/kcf_prov_lib.c | 32 +- sys/contrib/openzfs/module/icp/io/sha1_mod.c | 48 +-- sys/contrib/openzfs/module/icp/io/sha2_mod.c | 48 +-- sys/contrib/openzfs/module/icp/io/skein_mod.c | 40 +-- sys/contrib/openzfs/module/lua/ldebug.c | 1 - sys/contrib/openzfs/module/lua/ldo.c | 1 - .../openzfs/module/os/freebsd/spl/spl_uio.c | 38 +- .../openzfs/module/os/freebsd/spl/spl_vfs.c | 2 + sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c | 31 +- .../openzfs/module/os/freebsd/zfs/crypto_os.c | 26 +- .../openzfs/module/os/freebsd/zfs/zfs_ctldir.c | 40 ++- .../openzfs/module/os/freebsd/zfs/zfs_file_os.c | 2 +- .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 89 ++--- .../openzfs/module/os/freebsd/zfs/zfs_znode.c | 6 +- .../openzfs/module/os/freebsd/zfs/zio_crypt.c | 77 ++-- .../openzfs/module/os/freebsd/zfs/zvol_os.c | 44 ++- .../openzfs/module/os/linux/spl/spl-generic.c | 2 - .../openzfs/module/os/linux/spl/spl-kstat.c | 2 +- .../openzfs/module/os/linux/spl/spl-taskq.c | 3 +- sys/contrib/openzfs/module/os/linux/zfs/abd_os.c | 49 ++- .../openzfs/module/os/linux/zfs/vdev_disk.c | 49 ++- .../module/{zcommon => os/linux/zfs}/zfs_uio.c | 95 +++-- .../openzfs/module/os/linux/zfs/zfs_vfsops.c | 2 +- .../openzfs/module/os/linux/zfs/zfs_vnops_os.c | 90 ++--- .../openzfs/module/os/linux/zfs/zfs_znode.c | 18 +- .../openzfs/module/os/linux/zfs/zio_crypt.c | 30 +- sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c | 18 +- .../openzfs/module/os/linux/zfs/zpl_inode.c | 4 +- .../openzfs/module/os/linux/zfs/zpl_xattr.c | 6 +- sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c | 8 +- sys/contrib/openzfs/module/zfs/abd.c | 293 ++++++++------- sys/contrib/openzfs/module/zfs/arc.c | 42 ++- sys/contrib/openzfs/module/zfs/dbuf.c | 2 +- sys/contrib/openzfs/module/zfs/dmu.c | 54 ++- sys/contrib/openzfs/module/zfs/dmu_objset.c | 2 +- sys/contrib/openzfs/module/zfs/dmu_tx.c | 16 + sys/contrib/openzfs/module/zfs/dsl_dataset.c | 13 +- sys/contrib/openzfs/module/zfs/dsl_destroy.c | 15 +- sys/contrib/openzfs/module/zfs/metaslab.c | 100 ++++-- sys/contrib/openzfs/module/zfs/sa.c | 6 +- sys/contrib/openzfs/module/zfs/spa.c | 51 ++- sys/contrib/openzfs/module/zfs/spa_history.c | 8 +- sys/contrib/openzfs/module/zfs/spa_misc.c | 67 ++-- sys/contrib/openzfs/module/zfs/txg.c | 24 +- sys/contrib/openzfs/module/zfs/vdev.c | 225 ++++++++++-- sys/contrib/openzfs/module/zfs/vdev_draid.c | 34 +- sys/contrib/openzfs/module/zfs/vdev_indirect.c | 2 +- sys/contrib/openzfs/module/zfs/vdev_label.c | 38 +- sys/contrib/openzfs/module/zfs/vdev_queue.c | 2 +- sys/contrib/openzfs/module/zfs/vdev_raidz.c | 49 +-- sys/contrib/openzfs/module/zfs/vdev_removal.c | 13 + sys/contrib/openzfs/module/zfs/zfs_ioctl.c | 3 + sys/contrib/openzfs/module/zfs/zfs_sa.c | 11 +- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 69 ++-- sys/contrib/openzfs/module/zfs/zil.c | 2 +- sys/contrib/openzfs/module/zfs/zio.c | 75 ++-- sys/contrib/openzfs/rpm/generic/zfs.spec.in | 2 +- sys/contrib/openzfs/tests/runfiles/common.run | 2 +- sys/contrib/openzfs/tests/runfiles/linux.run | 2 +- .../openzfs/tests/test-runner/bin/zts-report.py.in | 35 ++ .../openzfs/tests/test-runner/include/logapi.shlib | 6 +- .../tests/zfs-tests/cmd/mmapwrite/mmapwrite.c | 4 +- .../tests/functional/acl/posix-sa/cleanup.ksh | 0 .../functional/acl/posix-sa/posix_001_pos.ksh | 0 .../functional/acl/posix-sa/posix_002_pos.ksh | 0 .../functional/acl/posix-sa/posix_003_pos.ksh | 0 .../functional/acl/posix-sa/posix_004_pos.ksh | 0 .../tests/functional/acl/posix-sa/setup.ksh | 0 .../tests/functional/acl/posix/posix_004_pos.ksh | 0 .../tests/functional/cli_root/zdb/Makefile.am | 4 +- .../tests/functional/cli_root/zdb/zdb_args_neg.ksh | 2 +- .../tests/functional/cli_root/zdb/zdb_recover.ksh | 55 +++ .../functional/cli_root/zdb/zdb_recover_2.ksh | 57 +++ .../cli_root/zfs_mount/zfs_mount_013_pos.ksh | 20 +- .../cli_root/zfs_receive/zfs_receive_005_neg.ksh | 4 +- .../cli_root/zfs_receive/zfs_receive_014_pos.ksh | 25 -- .../cli_root/zfs_receive/zfs_receive_new_props.ksh | 0 .../cli_root/zfs_rename/zfs_rename_nounmount.ksh | 0 .../cli_root/zfs_rollback/zfs_rollback_001_pos.ksh | 1 + .../functional/cli_root/zfs_send/zfs_send-b.ksh | 10 +- .../cli_root/zfs_send/zfs_send_003_pos.ksh | 2 +- .../cli_root/zfs_send/zfs_send_004_neg.ksh | 2 +- .../cli_root/zfs_send/zfs_send_005_pos.ksh | 2 +- .../cli_root/zfs_send/zfs_send_encrypted.ksh | 10 +- .../zfs_send/zfs_send_encrypted_unloaded.ksh | 2 +- .../functional/cli_root/zfs_send/zfs_send_raw.ksh | 14 +- .../cli_root/zfs_set/zfs_set_common.kshlib | 14 +- .../functional/cli_root/zpool_create/draidcfg.gz | Bin 0 -> 21672412 bytes .../zpool_events/zpool_events_duplicates.ksh | 0 .../functional/cli_root/zpool_export/Makefile.am | 3 +- .../functional/cli_root/zpool_export/setup.ksh | 4 - .../cli_root/zpool_export/zpool_export.cfg | 37 +- .../cli_root/zpool_export/zpool_export.kshlib | 32 ++ .../cli_root/zpool_export/zpool_export_001_pos.ksh | 17 +- .../cli_root/zpool_export/zpool_export_002_pos.ksh | 13 +- .../cli_root/zpool_export/zpool_export_003_neg.ksh | 15 +- .../cli_root/zpool_export/zpool_export_004_pos.ksh | 21 +- .../zfs-tests/tests/functional/io/Makefile.am | 1 + .../zfs-tests/tests/functional/io/io_uring.ksh | 72 ++++ .../{persist_l2arc => l2arc}/Makefile.am | 0 .../{persist_l2arc => l2arc}/cleanup.ksh | 0 .../persist_l2arc.cfg => l2arc/l2arc.cfg} | 0 .../persist_l2arc_001_pos.ksh | 0 .../persist_l2arc_002_pos.ksh | 0 .../persist_l2arc_003_neg.ksh | 0 .../persist_l2arc_004_pos.ksh | 0 .../persist_l2arc_005_pos.ksh | 0 .../persist_l2arc_006_pos.ksh | 0 .../persist_l2arc_007_pos.ksh | 0 .../persist_l2arc_008_pos.ksh | 0 .../functional/{persist_l2arc => l2arc}/setup.ksh | 0 .../tests/functional/procfs/pool_state.ksh | 18 +- .../functional/redacted_send/redacted_negative.ksh | 8 +- .../functional/redacted_send/redacted_resume.ksh | 2 +- ...edundancy_003_pos.ksh => redundancy_mirror.ksh} | 0 ...edundancy_001_pos.ksh => redundancy_raidz1.ksh} | 0 ...edundancy_002_pos.ksh => redundancy_raidz2.ksh} | 0 ...edundancy_004_neg.ksh => redundancy_stripe.ksh} | 0 .../tests/functional/removal/removal_with_send.ksh | 2 +- .../tests/functional/rsend/send_invalid.ksh | 2 +- .../functional/rsend/send_partial_dataset.ksh | 2 +- .../tests/functional/userquota/Makefile.am | 3 +- .../tests/functional/zvol/zvol_swap/zvol_swap.cfg | 2 + sys/modules/zfs/zfs_config.h | 6 +- 231 files changed, 3260 insertions(+), 1780 deletions(-) diff --git a/cddl/lib/libzfs/Makefile b/cddl/lib/libzfs/Makefile index 611eb91d76e7..d0b3458eda64 100644 --- a/cddl/lib/libzfs/Makefile +++ b/cddl/lib/libzfs/Makefile @@ -67,7 +67,6 @@ KERNEL_C = \ zfs_fletcher_superscalar4.c \ zfs_namecheck.c \ zfs_prop.c \ - zfs_uio.c \ zpool_prop.c \ zprop_common.c diff --git a/cddl/lib/libzpool/Makefile b/cddl/lib/libzpool/Makefile index 2cb1b0446ade..819f67ceec5a 100644 --- a/cddl/lib/libzpool/Makefile +++ b/cddl/lib/libzpool/Makefile @@ -46,7 +46,6 @@ KERNEL_C = \ zfs_fletcher_superscalar4.c \ zfs_namecheck.c \ zfs_prop.c \ - zfs_uio.c \ zfs_zstd.c \ zpool_prop.c \ zprop_common.c \ diff --git a/sys/contrib/openzfs/.github/PULL_REQUEST_TEMPLATE.md b/sys/contrib/openzfs/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000000..465ee182c497 --- /dev/null +++ b/sys/contrib/openzfs/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,42 @@ + + + + + + +### Motivation and Context + + + +### Description + + +### How Has This Been Tested? + + + + + + +### Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Performance enhancement (non-breaking change which improves efficiency) +- [ ] Code cleanup (non-breaking change which makes code smaller or more readable) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) +- [ ] Library ABI change (libzfs, libzfs\_core, libnvpair, libuutil and libzfsbootenv) +- [ ] Documentation (a change to man pages or other documentation) + +### Checklist: + + +- [ ] My code follows the OpenZFS [code style requirements](https://github.com/openzfs/zfs/blob/master/.github/CONTRIBUTING.md#coding-conventions). +- [ ] I have updated the documentation accordingly. +- [ ] I have read the [**contributing** document](https://github.com/openzfs/zfs/blob/master/.github/CONTRIBUTING.md). +- [ ] I have added [tests](https://github.com/openzfs/zfs/tree/master/tests) to cover my changes. +- [ ] I have run the ZFS Test Suite with this change applied. +- [ ] All commit messages are properly formatted and contain [`Signed-off-by`](https://github.com/openzfs/zfs/blob/master/.github/CONTRIBUTING.md#signed-off-by). diff --git a/sys/contrib/openzfs/.github/workflows/zfs-tests-functional.yml b/sys/contrib/openzfs/.github/workflows/zfs-tests-functional.yml new file mode 100644 index 000000000000..631f174b74fd --- /dev/null +++ b/sys/contrib/openzfs/.github/workflows/zfs-tests-functional.yml @@ -0,0 +1,64 @@ +name: zfs-tests-functional + +on: + push: + pull_request: + +jobs: + tests-functional-ubuntu: + strategy: + fail-fast: false + matrix: + os: [18.04, 20.04] + runs-on: ubuntu-${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install --yes -qq build-essential autoconf libtool gdb lcov \ + git alien fakeroot wget curl bc fio acl \ + sysstat mdadm lsscsi parted gdebi attr dbench watchdog ksh \ + nfs-kernel-server samba rng-tools xz-utils \ + zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ + xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ + libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ + libpam0g-dev pamtester python-dev python-setuptools python-cffi \ + python3 python3-dev python3-setuptools python3-cffi + - name: Autogen.sh + run: | + sh autogen.sh + - name: Configure + run: | + ./configure --enable-debug --enable-debuginfo + - name: Make + run: | + make --no-print-directory -s pkg-utils pkg-kmod + - name: Install + run: | + sudo dpkg -i *.deb + # Update order of directories to search for modules, otherwise + # Ubuntu will load kernel-shipped ones. + sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf + sudo depmod + sudo modprobe zfs + - name: Tests + run: | + /usr/share/zfs/zfs-tests.sh -v -s 3G + - name: Prepare artifacts + if: failure() + run: | + RESULTS_PATH=$(readlink -f /var/tmp/test_results/current) + sudo dmesg > $RESULTS_PATH/dmesg + sudo cp /var/log/syslog $RESULTS_PATH/ + sudo chmod +r $RESULTS_PATH/* + # Replace ':' in dir names, actions/upload-artifact doesn't support it + for f in $(find $RESULTS_PATH -name '*:*'); do mv "$f" "${f//:/__}"; done + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: Test logs Ubuntu-${{ matrix.os }} + path: /var/tmp/test_results/20*/ + if-no-files-found: ignore diff --git a/sys/contrib/openzfs/.github/workflows/zfs-tests-sanity.yml b/sys/contrib/openzfs/.github/workflows/zfs-tests-sanity.yml new file mode 100644 index 000000000000..e03399757575 --- /dev/null +++ b/sys/contrib/openzfs/.github/workflows/zfs-tests-sanity.yml @@ -0,0 +1,60 @@ +name: zfs-tests-sanity + +on: + push: + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install --yes -qq build-essential autoconf libtool gdb lcov \ + git alien fakeroot wget curl bc fio acl \ + sysstat mdadm lsscsi parted gdebi attr dbench watchdog ksh \ + nfs-kernel-server samba rng-tools xz-utils \ + zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ + xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ + libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ + libpam0g-dev pamtester python-dev python-setuptools python-cffi \ + python3 python3-dev python3-setuptools python3-cffi + - name: Autogen.sh + run: | + sh autogen.sh + - name: Configure + run: | + ./configure --enable-debug --enable-debuginfo + - name: Make + run: | + make --no-print-directory -s pkg-utils pkg-kmod + - name: Install + run: | + sudo dpkg -i *.deb + # Update order of directories to search for modules, otherwise + # Ubuntu will load kernel-shipped ones. + sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf + sudo depmod + sudo modprobe zfs + - name: Tests + run: | + /usr/share/zfs/zfs-tests.sh -v -s 3G -r sanity + - name: Prepare artifacts + if: failure() + run: | + RESULTS_PATH=$(readlink -f /var/tmp/test_results/current) + sudo dmesg > $RESULTS_PATH/dmesg + sudo cp /var/log/syslog $RESULTS_PATH/ + sudo chmod +r $RESULTS_PATH/* + # Replace ':' in dir names, actions/upload-artifact doesn't support it + for f in $(find $RESULTS_PATH -name '*:*'); do mv "$f" "${f//:/__}"; done + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: Test logs + path: /var/tmp/test_results/20*/ + if-no-files-found: ignore diff --git a/sys/contrib/openzfs/META b/sys/contrib/openzfs/META index 886da443357d..abced52178a7 100644 --- a/sys/contrib/openzfs/META +++ b/sys/contrib/openzfs/META @@ -6,5 +6,5 @@ Release: rc1 Release-Tags: relext License: CDDL Author: OpenZFS -Linux-Maximum: 5.10 +Linux-Maximum: 5.11 Linux-Minimum: 3.10 diff --git a/sys/contrib/openzfs/Makefile.am b/sys/contrib/openzfs/Makefile.am index 436b78d76282..b7cc4ce85655 100644 --- a/sys/contrib/openzfs/Makefile.am +++ b/sys/contrib/openzfs/Makefile.am @@ -25,7 +25,6 @@ endif AUTOMAKE_OPTIONS = foreign EXTRA_DIST = autogen.sh copy-builtin -EXTRA_DIST += cppcheck-suppressions.txt EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am EXTRA_DIST += META AUTHORS COPYRIGHT LICENSE NEWS NOTICE README.md EXTRA_DIST += CODE_OF_CONDUCT.md @@ -204,13 +203,13 @@ vcscheck: PHONY += lint lint: cppcheck paxcheck +CPPCHECKDIRS = cmd lib module PHONY += cppcheck -cppcheck: - @if type cppcheck > /dev/null 2>&1; then \ - cppcheck --quiet --force --error-exitcode=2 --inline-suppr \ - --suppressions-list=${top_srcdir}/cppcheck-suppressions.txt \ - -UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \ - ${top_srcdir}; \ +cppcheck: $(CPPCHECKDIRS) + @if test -n "$(CPPCHECK)"; then \ + set -e ; for dir in $(CPPCHECKDIRS) ; do \ + $(MAKE) -C $$dir cppcheck ; \ + done \ else \ echo "skipping cppcheck because cppcheck is not installed"; \ fi diff --git a/sys/contrib/openzfs/cmd/Makefile.am b/sys/contrib/openzfs/cmd/Makefile.am index d99d1dc382cc..473fcb0e07a1 100644 --- a/sys/contrib/openzfs/cmd/Makefile.am +++ b/sys/contrib/openzfs/cmd/Makefile.am @@ -2,10 +2,20 @@ SUBDIRS = zfs zpool zdb zhack zinject zstream zstreamdump ztest SUBDIRS += fsck_zfs vdev_id raidz_test zfs_ids_to_path SUBDIRS += zpool_influxdb +CPPCHECKDIRS = zfs zpool zdb zhack zinject zstream ztest +CPPCHECKDIRS += raidz_test zfs_ids_to_path zpool_influxdb + if USING_PYTHON SUBDIRS += arcstat arc_summary dbufstat endif if BUILD_LINUX SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait +CPPCHECKDIRS += mount_zfs zed zgenhostid zvol_id endif + +PHONY = cppcheck +cppcheck: $(CPPCHECKDIRS) + set -e ; for dir in $(CPPCHECKDIRS) ; do \ + $(MAKE) -C $$dir cppcheck ; \ + done diff --git a/sys/contrib/openzfs/cmd/mount_zfs/Makefile.am b/sys/contrib/openzfs/cmd/mount_zfs/Makefile.am index 6c4d6ff79f16..3957602d27ad 100644 --- a/sys/contrib/openzfs/cmd/mount_zfs/Makefile.am +++ b/sys/contrib/openzfs/cmd/mount_zfs/Makefile.am @@ -18,3 +18,5 @@ mount_zfs_LDADD = \ $(abs_top_builddir)/lib/libnvpair/libnvpair.la mount_zfs_LDADD += $(LTLIBINTL) + +include $(top_srcdir)/config/CppCheck.am diff --git a/sys/contrib/openzfs/cmd/mount_zfs/mount_zfs.c b/sys/contrib/openzfs/cmd/mount_zfs/mount_zfs.c index ca39d228479e..5196c3e5cb5f 100644 --- a/sys/contrib/openzfs/cmd/mount_zfs/mount_zfs.c +++ b/sys/contrib/openzfs/cmd/mount_zfs/mount_zfs.c @@ -50,6 +50,21 @@ libzfs_handle_t *g_zfs; static void parse_dataset(const char *target, char **dataset) { + /* + * Prior to util-linux 2.36.2, if a file or directory in the + * current working directory was named 'dataset' then mount(8) + * would prepend the current working directory to the dataset. + * Check for it and strip the prepended path when it is added. + */ + char cwd[PATH_MAX]; + if (getcwd(cwd, PATH_MAX) == NULL) { + perror("getcwd"); + return; + } + int len = strlen(cwd); + if (strncmp(cwd, target, len) == 0) + target += len; + /* Assume pool/dataset is more likely */ strlcpy(*dataset, target, PATH_MAX); diff --git a/sys/contrib/openzfs/cmd/raidz_test/Makefile.am b/sys/contrib/openzfs/cmd/raidz_test/Makefile.am index 72c914e641e4..983ff25dc92a 100644 --- a/sys/contrib/openzfs/cmd/raidz_test/Makefile.am +++ b/sys/contrib/openzfs/cmd/raidz_test/Makefile.am @@ -18,3 +18,5 @@ raidz_test_LDADD = \ $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la raidz_test_LDADD += -lm + +include $(top_srcdir)/config/CppCheck.am diff --git a/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c b/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c index 4e2639f3676d..e3eb4f4ce44a 100644 --- a/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c +++ b/sys/contrib/openzfs/cmd/raidz_test/raidz_test.c @@ -492,8 +492,9 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset, (dc - r) * (rows - 1) + row; } rr->rr_col[c].rc_size = 1ULL << ashift; - rr->rr_col[c].rc_abd = - abd_get_offset(abd, off << ashift); + rr->rr_col[c].rc_abd = abd_get_offset_struct( + &rr->rr_col[c].rc_abdstruct, + abd, off << ashift, 1 << ashift); } asize += rr->rr_col[c].rc_size; diff --git a/sys/contrib/openzfs/cmd/vdev_id/vdev_id b/sys/contrib/openzfs/cmd/vdev_id/vdev_id index 8a75e638b67e..95a4e483b876 100755 --- a/sys/contrib/openzfs/cmd/vdev_id/vdev_id +++ b/sys/contrib/openzfs/cmd/vdev_id/vdev_id @@ -79,6 +79,34 @@ # channel 86:00.0 1 A # channel 86:00.0 0 B +# # +# # Example vdev_id.conf - multipath / multijbod-daisychaining +# # +# +# multipath yes +# multijbod yes +# +# # PCI_ID HBA PORT CHANNEL NAME +# channel 85:00.0 1 A +# channel 85:00.0 0 B +# channel 86:00.0 1 A +# channel 86:00.0 0 B + +# # +# # Example vdev_id.conf - multipath / mixed +# # +# +# multipath yes +# slot mix +# +# # PCI_ID HBA PORT CHANNEL NAME +# channel 85:00.0 3 A +# channel 85:00.0 2 B +# channel 86:00.0 3 A +# channel 86:00.0 2 B +# channel af:00.0 0 C +# channel af:00.0 1 C + # # # # Example vdev_id.conf - alias # # @@ -92,9 +120,10 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin CONFIG=/etc/zfs/vdev_id.conf PHYS_PER_PORT= DEV= -MULTIPATH= TOPOLOGY= BAY= +ENCL_ID="" +UNIQ_ENCL_ID="" usage() { cat << EOF @@ -107,6 +136,7 @@ Usage: vdev_id [-h] -e Create enclose device symlinks only (/dev/by-enclosure) -g Storage network topology [default="$TOPOLOGY"] -m Run in multipath mode + -j Run in multijbod mode -p number of phy's per switch port [default=$PHYS_PER_PORT] -h show this summary EOF @@ -117,12 +147,12 @@ map_slot() { LINUX_SLOT=$1 CHANNEL=$2 - MAPPED_SLOT=`awk "\\$1 == \"slot\" && \\$2 == ${LINUX_SLOT} && \ - \\$4 ~ /^${CHANNEL}$|^$/ { print \\$3; exit }" $CONFIG` + MAPPED_SLOT=$(awk '$1 == "slot" && $2 == "${LINUX_SLOT}" && \ + $4 ~ /^${CHANNEL}$|^$/ { print $3; exit}' $CONFIG) if [ -z "$MAPPED_SLOT" ] ; then MAPPED_SLOT=$LINUX_SLOT fi - printf "%d" ${MAPPED_SLOT} + printf "%d" "${MAPPED_SLOT}" } map_channel() { @@ -132,40 +162,120 @@ map_channel() { case $TOPOLOGY in "sas_switch") - MAPPED_CHAN=`awk "\\$1 == \"channel\" && \\$2 == ${PORT} \ - { print \\$3; exit }" $CONFIG` + MAPPED_CHAN=$(awk -v port="$PORT" \ + '$1 == "channel" && $2 == ${PORT} \ + { print $3; exit }' $CONFIG) ;; "sas_direct"|"scsi") - MAPPED_CHAN=`awk "\\$1 == \"channel\" && \ - \\$2 == \"${PCI_ID}\" && \\$3 == ${PORT} \ - { print \\$4; exit }" $CONFIG` + MAPPED_CHAN=$(awk -v pciID="$PCI_ID" -v port="$PORT" \ + '$1 == "channel" && $2 == pciID && $3 == port \ + {print $4}' $CONFIG) ;; esac - printf "%s" ${MAPPED_CHAN} + printf "%s" "${MAPPED_CHAN}" +} + +get_encl_id() { + set -- $(echo $1) + count=$# + + i=1 + while [ $i -le $count ] ; do + d=$(eval echo '$'{$i}) + id=$(cat "/sys/class/enclosure/${d}/id") + ENCL_ID="${ENCL_ID} $id" + i=$((i + 1)) + done +} + +get_uniq_encl_id() { + for uuid in ${ENCL_ID}; do + found=0 + + for count in ${UNIQ_ENCL_ID}; do + if [ $count = $uuid ]; then + found=1 + break + fi + done + + if [ $found -eq 0 ]; then + UNIQ_ENCL_ID="${UNIQ_ENCL_ID} $uuid" + fi + done +} + +# map_jbod explainer: The bsg driver knows the difference between a SAS +# expander and fanout expander. Use hostX instance along with top-level +# (whole enclosure) expander instances in /sys/class/enclosure and +# matching a field in an array of expanders, using the index of the +# matched array field as the enclosure instance, thereby making jbod IDs +# dynamic. Avoids reliance on high overhead userspace commands like +# multipath and lsscsi and instead uses existing sysfs data. $HOSTCHAN +# variable derived from devpath gymnastics in sas_handler() function. +map_jbod() { + DEVEXP=$(ls -l "/sys/block/$DEV/device/" | grep enclos | awk -F/ '{print $(NF-1) }') + DEV=$1 + + # Use "set --" to create index values (Arrays) + set -- $(ls -l /sys/class/enclosure | grep -v "^total" | awk '{print $9}') + # Get count of total elements + JBOD_COUNT=$# + JBOD_ITEM=$* + + # Build JBODs (enclosure) id from sys/class/enclosure//id + get_encl_id "$JBOD_ITEM" + # Different expander instances for each paths. + # Filter out and keep only unique id. + get_uniq_encl_id + + # Identify final 'mapped jbod' + j=0 + for count in ${UNIQ_ENCL_ID}; do + i=1 + j=$((j + 1)) + while [ $i -le $JBOD_COUNT ] ; do + d=$(eval echo '$'{$i}) + id=$(cat "/sys/class/enclosure/${d}/id") + if [ "$d" = "$DEVEXP" ] && [ $id = $count ] ; then + MAPPED_JBOD=$j + break + fi + i=$((i + 1)) + done + done + + printf "%d" "${MAPPED_JBOD}" } sas_handler() { if [ -z "$PHYS_PER_PORT" ] ; then - PHYS_PER_PORT=`awk "\\$1 == \"phys_per_port\" \ - {print \\$2; exit}" $CONFIG` + PHYS_PER_PORT=$(awk '$1 == "phys_per_port" \ + {print $2; exit}' $CONFIG) fi PHYS_PER_PORT=${PHYS_PER_PORT:-4} - if ! echo $PHYS_PER_PORT | grep -q -E '^[0-9]+$' ; then + + if ! echo "$PHYS_PER_PORT" | grep -q -E '^[0-9]+$' ; then echo "Error: phys_per_port value $PHYS_PER_PORT is non-numeric" exit 1 fi if [ -z "$MULTIPATH_MODE" ] ; then - MULTIPATH_MODE=`awk "\\$1 == \"multipath\" \ - {print \\$2; exit}" $CONFIG` + MULTIPATH_MODE=$(awk '$1 == "multipath" \ + {print $2; exit}' $CONFIG) + fi + + if [ -z "$MULTIJBOD_MODE" ] ; then + MULTIJBOD_MODE=$(awk '$1 == "multijbod" \ + {print $2; exit}' $CONFIG) fi # Use first running component device if we're handling a dm-mpath device if [ "$MULTIPATH_MODE" = "yes" ] ; then # If udev didn't tell us the UUID via DM_NAME, check /dev/mapper if [ -z "$DM_NAME" ] ; then - DM_NAME=`ls -l --full-time /dev/mapper | - awk "/\/$DEV$/{print \\$9}"` + DM_NAME=$(ls -l --full-time /dev/mapper | + grep "$DEV"$ | awk '{print $9}') fi # For raw disks udev exports DEVTYPE=partition when @@ -175,28 +285,41 @@ sas_handler() { # we have to append the -part suffix directly in the # helper. if [ "$DEVTYPE" != "partition" ] ; then - PART=`echo $DM_NAME | awk -Fp '/p/{print "-part"$2}'` + PART=$(echo "$DM_NAME" | awk -Fp '/p/{print "-part"$2}') fi # Strip off partition information. - DM_NAME=`echo $DM_NAME | sed 's/p[0-9][0-9]*$//'` + DM_NAME=$(echo "$DM_NAME" | sed 's/p[0-9][0-9]*$//') if [ -z "$DM_NAME" ] ; then return fi - # Get the raw scsi device name from multipath -ll. Strip off - # leading pipe symbols to make field numbering consistent. - DEV=`multipath -ll $DM_NAME | - awk '/running/{gsub("^[|]"," "); print $3 ; exit}'` + # Utilize DM device name to gather subordinate block devices + # using sysfs to avoid userspace utilities + DMDEV=$(ls -l --full-time /dev/mapper | grep $DM_NAME | + awk '{gsub("../", " "); print $NF}') + + # Use sysfs pointers in /sys/block/dm-X/slaves because using + # userspace tools creates lots of overhead and should be avoided + # whenever possible. Use awk to isolate lowest instance of + # sd device member in dm device group regardless of string + # length. + DEV=$(ls "/sys/block/$DMDEV/slaves" | awk ' + { len=sprintf ("%20s",length($0)); gsub(/ /,0,str); a[NR]=len "_" $0; } + END { + asort(a) + print substr(a[1],22) + }') + if [ -z "$DEV" ] ; then return fi fi - if echo $DEV | grep -q ^/devices/ ; then + if echo "$DEV" | grep -q ^/devices/ ; then sys_path=$DEV else - sys_path=`udevadm info -q path -p /sys/block/$DEV 2>/dev/null` + sys_path=$(udevadm info -q path -p "/sys/block/$DEV" 2>/dev/null) fi # Use positional parameters as an ad-hoc array @@ -206,84 +329,104 @@ sas_handler() { # Get path up to /sys/.../hostX i=1 - while [ $i -le $num_dirs ] ; do - d=$(eval echo \${$i}) + + while [ $i -le "$num_dirs" ] ; do + d=$(eval echo '$'{$i}) scsi_host_dir="$scsi_host_dir/$d" - echo $d | grep -q -E '^host[0-9]+$' && break - i=$(($i + 1)) + echo "$d" | grep -q -E '^host[0-9]+$' && break + i=$((i + 1)) done - if [ $i = $num_dirs ] ; then + # Lets grab the SAS host channel number and save it for JBOD sorting later + HOSTCHAN=$(echo "$d" | awk -F/ '{ gsub("host","",$NF); print $NF}') + + if [ $i = "$num_dirs" ] ; then return fi - PCI_ID=$(eval echo \${$(($i -1))} | awk -F: '{print $2":"$3}') + PCI_ID=$(eval echo '$'{$((i -1))} | awk -F: '{print $2":"$3}') # In sas_switch mode, the directory four levels beneath # /sys/.../hostX contains symlinks to phy devices that reveal # the switch port number. In sas_direct mode, the phy links one # directory down reveal the HBA port. port_dir=$scsi_host_dir + case $TOPOLOGY in - "sas_switch") j=$(($i + 4)) ;; - "sas_direct") j=$(($i + 1)) ;; + "sas_switch") j=$((i + 4)) ;; + "sas_direct") j=$((i + 1)) ;; esac - i=$(($i + 1)) + i=$((i + 1)) + while [ $i -le $j ] ; do - port_dir="$port_dir/$(eval echo \${$i})" - i=$(($i + 1)) + port_dir="$port_dir/$(eval echo '$'{$i})" + i=$((i + 1)) done - PHY=`ls -d $port_dir/phy* 2>/dev/null | head -1 | awk -F: '{print $NF}'` + PHY=$(ls -d "$port_dir"/phy* 2>/dev/null | head -1 | awk -F: '{print $NF}') if [ -z "$PHY" ] ; then PHY=0 fi - PORT=$(( $PHY / $PHYS_PER_PORT )) + PORT=$((PHY / PHYS_PER_PORT)) # Look in /sys/.../sas_device/end_device-X for the bay_identifier # attribute. end_device_dir=$port_dir - while [ $i -lt $num_dirs ] ; do - d=$(eval echo \${$i}) + + while [ $i -lt "$num_dirs" ] ; do + d=$(eval echo '$'{$i}) end_device_dir="$end_device_dir/$d" - if echo $d | grep -q '^end_device' ; then + if echo "$d" | grep -q '^end_device' ; then end_device_dir="$end_device_dir/sas_device/$d" break fi - i=$(($i + 1)) + i=$((i + 1)) done + # Add 'mix' slot type for environments where dm-multipath devices + # include end-devices connected via SAS expanders or direct connection + # to SAS HBA. A mixed connectivity environment such as pool devices + # contained in a SAS JBOD and spare drives or log devices directly + # connected in a server backplane without expanders in the I/O path. SLOT= + case $BAY in "bay") - SLOT=`cat $end_device_dir/bay_identifier 2>/dev/null` + SLOT=$(cat "$end_device_dir/bay_identifier" 2>/dev/null) + ;; + "mix") + if [ $(cat "$end_device_dir/bay_identifier" 2>/dev/null) ] ; then + SLOT=$(cat "$end_device_dir/bay_identifier" 2>/dev/null) + else + SLOT=$(cat "$end_device_dir/phy_identifier" 2>/dev/null) + fi ;; "phy") - SLOT=`cat $end_device_dir/phy_identifier 2>/dev/null` + SLOT=$(cat "$end_device_dir/phy_identifier" 2>/dev/null) ;; "port") - d=$(eval echo \${$i}) - SLOT=`echo $d | sed -e 's/^.*://'` + d=$(eval echo '$'{$i}) + SLOT=$(echo "$d" | sed -e 's/^.*://') ;; "id") - i=$(($i + 1)) - d=$(eval echo \${$i}) - SLOT=`echo $d | sed -e 's/^.*://'` + i=$((i + 1)) + d=$(eval echo '$'{$i}) + SLOT=$(echo "$d" | sed -e 's/^.*://') ;; "lun") - i=$(($i + 2)) - d=$(eval echo \${$i}) - SLOT=`echo $d | sed -e 's/^.*://'` + i=$((i + 2)) + d=$(eval echo '$'{$i}) + SLOT=$(echo "$d" | sed -e 's/^.*://') ;; "ses") # look for this SAS path in all SCSI Enclosure Services # (SES) enclosures - sas_address=`cat $end_device_dir/sas_address 2>/dev/null` - enclosures=`lsscsi -g | \ - sed -n -e '/enclosu/s/^.* \([^ ][^ ]*\) *$/\1/p'` + sas_address=$(cat "$end_device_dir/sas_address" 2>/dev/null) + enclosures=$(lsscsi -g | \ + sed -n -e '/enclosu/s/^.* \([^ ][^ ]*\) *$/\1/p') for enclosure in $enclosures; do - set -- $(sg_ses -p aes $enclosure | \ + set -- $(sg_ses -p aes "$enclosure" | \ awk "/device slot number:/{slot=\$12} \ /SAS address: $sas_address/\ *** 11320 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:36:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E95035AA6F0; Wed, 10 Mar 2021 09:36: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 4DwRmC6FD8z4lB5; Wed, 10 Mar 2021 09:36: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 C85504CEE; Wed, 10 Mar 2021 09:36: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 12A9aRcQ013788; Wed, 10 Mar 2021 09:36:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12A9aRiO013787; Wed, 10 Mar 2021 09:36:27 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:36:27 GMT Message-Id: <202103100936.12A9aRiO013787@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 9e8f831780f7 - stable/13 - zfs: change file mode of all merged tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9e8f831780f7107c1c2ace3713b19d50ec825581 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:36:28 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=9e8f831780f7107c1c2ace3713b19d50ec825581 commit 9e8f831780f7107c1c2ace3713b19d50ec825581 Author: Martin Matuska AuthorDate: 2021-02-16 11:23:43 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:25:27 +0000 zfs: change file mode of all merged tests If the ksh files are not executable then the tests are not run and reported as failed. (cherry picked from commit afcb3c4cb49f1ba9690d066c3dc1af9c7bee1ea3) --- .../tests/zfs-tests/tests/functional/checksum/filetest_002_pos.ksh | 0 .../zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh | 0 .../zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_013_pos.ksh | 0 .../zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_014_neg.ksh | 0 .../tests/functional/cli_root/zpool_add/zpool_add_dryrun_output.ksh | 0 .../tests/functional/cli_root/zpool_create/zpool_create_draid_001_pos.ksh | 0 .../tests/functional/cli_root/zpool_create/zpool_create_draid_002_pos.ksh | 0 .../tests/functional/cli_root/zpool_create/zpool_create_draid_003_pos.ksh | 0 .../tests/functional/cli_root/zpool_create/zpool_create_draid_004_pos.ksh | 0 .../tests/functional/cli_root/zpool_create/zpool_create_dryrun_output.ksh | 0 .../tests/functional/cli_root/zpool_import/zpool_import_016_pos.ksh | 0 .../tests/functional/cli_root/zpool_import/zpool_import_017_pos.ksh | 0 .../tests/functional/cli_root/zpool_split/zpool_split_dryrun_output.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/raidz/raidz_003_pos.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/raidz/raidz_004_pos.ksh | 0 .../tests/zfs-tests/tests/functional/redundancy/redundancy_draid1.ksh | 0 .../tests/zfs-tests/tests/functional/redundancy/redundancy_draid2.ksh | 0 .../tests/zfs-tests/tests/functional/redundancy/redundancy_draid3.ksh | 0 .../zfs-tests/tests/functional/redundancy/redundancy_draid_spare1.ksh | 0 .../zfs-tests/tests/functional/redundancy/redundancy_draid_spare2.ksh | 0 .../zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh | 0 .../tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh | 0 .../tests/zfs-tests/tests/functional/redundancy/redundancy_raidz3.ksh | 0 .../tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh | 0 .../tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh | 0 .../zfs-tests/tests/functional/userquota/userspace_send_encrypted.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/cleanup.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/setup.ksh | 0 .../tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh | 0 32 files changed, 0 insertions(+), 0 deletions(-) diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/filetest_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/filetest_002_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_013_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_013_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_014_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_014_neg.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_dryrun_output.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_dryrun_output.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_001_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_002_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_003_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_004_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_dryrun_output.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_dryrun_output.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_016_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_016_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_017_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_017_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_dryrun_output.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_dryrun_output.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/raidz_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/raidz_003_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/raidz_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/raidz_004_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid1.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid1.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid2.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid2.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid3.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid3.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare1.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare1.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare2.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare2.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz3.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz3.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_send_encrypted.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_send_encrypted.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/cleanup.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/setup.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh old mode 100644 new mode 100755 From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:36:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97AE55AA8E7; Wed, 10 Mar 2021 09:36: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 4DwRmS2HnBz4lVG; Wed, 10 Mar 2021 09:36: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 F18385189; Wed, 10 Mar 2021 09:36: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 12A9abf6013918; Wed, 10 Mar 2021 09:36:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12A9ab6e013913; Wed, 10 Mar 2021 09:36:37 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:36:37 GMT Message-Id: <202103100936.12A9ab6e013913@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: e1f9a18f917d - stable/13 - zfs: merge OpenZFS master-bf156c966 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e1f9a18f917d9d5a3f88419bc72c9ee2fbb1c8df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:36:40 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=e1f9a18f917d9d5a3f88419bc72c9ee2fbb1c8df commit e1f9a18f917d9d5a3f88419bc72c9ee2fbb1c8df Author: Martin Matuska AuthorDate: 2021-02-18 14:17:31 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:25:54 +0000 zfs: merge OpenZFS master-bf156c966 Notable upstream changes: bf156c966 Remove unused abd_alloc_scatter_offset_chunkcnt 658fb8020 Add "compatibility" property for zpool feature sets This update introduces a new pool property called "compatibility" that can be used to enable a limited set of pool features on pool creation and "stick" to it, so the "zpool upgrade" does not accidentally enable features that are not desired. The value of this property may then be changed later. See zpool-features(5) for more information about the "compatibility" pool property. Obtained from: OpenZFS (cherry picked from commit ee36e25a86cbe2a9474c1d61f2c4b450da8ef952) --- sys/contrib/openzfs/cmd/zpool/Makefile.am | 47 +- .../openzfs/cmd/zpool/compatibility.d/compat-2018 | 12 + .../openzfs/cmd/zpool/compatibility.d/compat-2019 | 15 + .../openzfs/cmd/zpool/compatibility.d/compat-2020 | 15 + .../openzfs/cmd/zpool/compatibility.d/compat-2021 | 19 + .../openzfs/cmd/zpool/compatibility.d/freebsd-11.0 | 15 + .../openzfs/cmd/zpool/compatibility.d/freebsd-11.2 | 18 + .../openzfs/cmd/zpool/compatibility.d/freebsd-11.3 | 19 + .../cmd/zpool/compatibility.d/freenas-9.10.2 | 13 + .../openzfs/cmd/zpool/compatibility.d/grub2 | 12 + .../cmd/zpool/compatibility.d/openzfs-2.0-freebsd | 33 + .../cmd/zpool/compatibility.d/openzfs-2.0-linux | 34 + .../cmd/zpool/compatibility.d/openzfsonosx-1.7.0 | 16 + .../cmd/zpool/compatibility.d/openzfsonosx-1.8.1 | 21 + .../cmd/zpool/compatibility.d/openzfsonosx-1.9.3 | 27 + .../openzfs/cmd/zpool/compatibility.d/zol-0.6.5 | 12 + .../openzfs/cmd/zpool/compatibility.d/zol-0.7 | 18 + .../openzfs/cmd/zpool/compatibility.d/zol-0.8 | 27 + sys/contrib/openzfs/cmd/zpool/zpool_main.c | 165 +- sys/contrib/openzfs/cmd/ztest/ztest.c | 4 +- sys/contrib/openzfs/config/Rules.am | 1 + sys/contrib/openzfs/include/libzfs.h | 16 + sys/contrib/openzfs/include/sys/fs/zfs.h | 19 +- sys/contrib/openzfs/include/sys/spa_impl.h | 2 + sys/contrib/openzfs/include/zfeature_common.h | 2 - sys/contrib/openzfs/lib/libzfs/libzfs.abi | 6933 ++++++++++++-------- sys/contrib/openzfs/lib/libzfs/libzfs_pool.c | 228 + sys/contrib/openzfs/lib/libzfs/libzfs_status.c | 29 +- sys/contrib/openzfs/lib/libzutil/zutil_import.c | 10 + sys/contrib/openzfs/man/man5/zpool-features.5 | 59 +- sys/contrib/openzfs/man/man8/zpool-create.8 | 16 +- sys/contrib/openzfs/man/man8/zpool-upgrade.8 | 16 +- sys/contrib/openzfs/man/man8/zpoolprops.8 | 19 + sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c | 19 - .../openzfs/module/zcommon/zfeature_common.c | 13 +- sys/contrib/openzfs/module/zcommon/zpool_prop.c | 4 + sys/contrib/openzfs/module/zfs/spa.c | 30 + sys/contrib/openzfs/module/zfs/spa_config.c | 4 + sys/contrib/openzfs/rpm/generic/zfs.spec.in | 6 +- sys/contrib/openzfs/scripts/Makefile.am | 1 + sys/contrib/openzfs/tests/runfiles/common.run | 8 +- .../tests/zfs-tests/cmd/xattrtest/xattrtest.c | 6 +- .../openzfs/tests/zfs-tests/include/default.cfg.in | 1 + .../functional/cli_root/zpool_create/Makefile.am | 3 + .../cli_root/zpool_create/zpool_create.shlib | 81 + .../zpool_create/zpool_create_features_006_pos.ksh | 58 + .../zpool_create/zpool_create_features_007_pos.ksh | 54 + .../zpool_create/zpool_create_features_008_pos.ksh | 54 + .../functional/cli_root/zpool_get/zpool_get.cfg | 1 + .../functional/cli_root/zpool_status/Makefile.am | 3 +- .../zpool_status/zpool_status_features_001_pos.ksh | 63 + .../functional/cli_root/zpool_upgrade/Makefile.am | 3 +- .../zpool_upgrade_features_001_pos.ksh | 67 + 53 files changed, 5513 insertions(+), 2858 deletions(-) diff --git a/sys/contrib/openzfs/cmd/zpool/Makefile.am b/sys/contrib/openzfs/cmd/zpool/Makefile.am index fb03e99a3054..d47051e4fe50 100644 --- a/sys/contrib/openzfs/cmd/zpool/Makefile.am +++ b/sys/contrib/openzfs/cmd/zpool/Makefile.am @@ -39,7 +39,7 @@ include $(top_srcdir)/config/CppCheck.am zpoolconfdir = $(sysconfdir)/zfs/zpool.d zpoolexecdir = $(zfsexecdir)/zpool.d -EXTRA_DIST = zpool.d/README +EXTRA_DIST = zpool.d/README compatibility.d dist_zpoolexec_SCRIPTS = \ zpool.d/dm-deps \ @@ -129,6 +129,48 @@ zpoolconfdefaults = \ test_progress \ test_ended +zpoolcompatdir = $(pkgdatadir)/compatibility.d + +dist_zpoolcompat_DATA = \ + compatibility.d/compat-2018 \ + compatibility.d/compat-2019 \ + compatibility.d/compat-2020 \ + compatibility.d/compat-2021 \ + compatibility.d/freebsd-11.0 \ + compatibility.d/freebsd-11.2 \ + compatibility.d/freebsd-11.3 \ + compatibility.d/freenas-9.10.2 \ + compatibility.d/grub2 \ + compatibility.d/openzfsonosx-1.7.0 \ + compatibility.d/openzfsonosx-1.8.1 \ + compatibility.d/openzfsonosx-1.9.3 \ + compatibility.d/openzfs-2.0-freebsd \ + compatibility.d/openzfs-2.0-linux \ + compatibility.d/zol-0.6.5 \ + compatibility.d/zol-0.7 \ + compatibility.d/zol-0.8 + +# canonical <- alias symbolic link pairs +# eg: "2018" is a link to "compat-2018" +zpoolcompatlinks = \ + "compat-2018 2018" \ + "compat-2019 2019" \ + "compat-2020 2020" \ + "compat-2021 2021" \ + "freebsd-11.0 freebsd-11.1" \ + "freebsd-11.0 freenas-11.0" \ + "freebsd-11.2 freenas-11.2" \ + "freebsd-11.3 freebsd-11.4" \ + "freebsd-11.3 freebsd-12.0" \ + "freebsd-11.3 freebsd-12.1" \ + "freebsd-11.3 freebsd-12.2" \ + "freebsd-11.3 freenas-11.3" \ + "freenas-11.0 freenas-11.1" \ + "openzfsonosx-1.9.3 openzfsonosx-1.9.4" \ + "openzfs-2.0-freebsd truenas-12.0" \ + "zol-0.7 ubuntu-18.04" \ + "zol-0.8 ubuntu-20.04" + install-data-hook: $(MKDIR_P) "$(DESTDIR)$(zpoolconfdir)" for f in $(zpoolconfdefaults); do \ @@ -136,3 +178,6 @@ install-data-hook: -L "$(DESTDIR)$(zpoolconfdir)/$${f}" || \ ln -s "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \ done + for l in $(zpoolcompatlinks); do \ + (cd "$(DESTDIR)$(zpoolcompatdir)"; ln -s $${l} ); \ + done diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2018 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2018 new file mode 100644 index 000000000000..7be44e1eee95 --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2018 @@ -0,0 +1,12 @@ +# Features supported by all Tier 1 platforms as of 2018 +async_destroy +bookmarks +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +spacemap_histogram diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2019 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2019 new file mode 100644 index 000000000000..c105cc70c290 --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2019 @@ -0,0 +1,15 @@ +# Features supported by all Tier 1 platforms as of 2019 +async_destroy +bookmarks +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +multi_vdev_crash_dump +sha512 +skein +spacemap_histogram diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2020 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2020 new file mode 100644 index 000000000000..8d46a571e6ef --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2020 @@ -0,0 +1,15 @@ +# Features supported by all Tier 1 platforms as of 2020 +async_destroy +bookmarks +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +multi_vdev_crash_dump +sha512 +skein +spacemap_histogram diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2021 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2021 new file mode 100644 index 000000000000..f45c82d6560f --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2021 @@ -0,0 +1,19 @@ +# Features supported by all Tier 1 platforms as of 2021 +async_destroy +bookmarks +device_removal +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +multi_vdev_crash_dump +obsolete_counts +sha512 +skein +spacemap_histogram +spacemap_v2 +zpool_checkpoint diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.0 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.0 new file mode 100644 index 000000000000..8718559ffb4c --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.0 @@ -0,0 +1,15 @@ +# Features supported by FreeBSD 11.0 +async_destroy +bookmarks +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +multi_vdev_crash_dump +sha512 +skein +spacemap_histogram diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.2 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.2 new file mode 100644 index 000000000000..14d2d573b2a0 --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.2 @@ -0,0 +1,18 @@ +# Features supported by FreeBSD 11.2 +async_destroy +bookmarks +device_removal +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +multi_vdev_crash_dump +obsolete_counts +sha512 +skein +spacemap_histogram +zpool_checkpoint diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.3 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.3 new file mode 100644 index 000000000000..802cc3630de7 --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.3 @@ -0,0 +1,19 @@ +# Features supported by FreeBSD 11.3 +async_destroy +bookmarks +device_removal +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +multi_vdev_crash_dump +obsolete_counts +sha512 +skein +spacemap_histogram +spacemap_v2 +zpool_checkpoint diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/freenas-9.10.2 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freenas-9.10.2 new file mode 100644 index 000000000000..10789c96cc8f --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freenas-9.10.2 @@ -0,0 +1,13 @@ +# Features supported by FreeNAS 9.10.2 +async_destroy +bookmarks +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +multi_vdev_crash_dump +spacemap_histogram diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/grub2 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/grub2 new file mode 100644 index 000000000000..4e8f21362554 --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/grub2 @@ -0,0 +1,12 @@ +# Features which are supported by GRUB2 +async_destroy +bookmarks +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +spacemap_histogram diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-freebsd b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-freebsd new file mode 100644 index 000000000000..e7ee2f247670 --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-freebsd @@ -0,0 +1,33 @@ +# Features supported by OpenZFS 2.0 on FreeBSD +allocation_classes +async_destroy +bookmark_v2 +bookmark_written +bookmarks +device_rebuild +device_removal +embedded_data +empty_bpobj +enabled_txg +encryption +extensible_dataset +filesystem_limits +hole_birth +large_blocks +large_dnode +livelist +log_spacemap +lz4_compress +multi_vdev_crash_dump +obsolete_counts +project_quota +redacted_datasets +redaction_bookmarks +resilver_defer +sha512 +skein +spacemap_histogram +spacemap_v2 +userobj_accounting +zpool_checkpoint +zstd_compress diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-linux b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-linux new file mode 100644 index 000000000000..ac0f5c863468 --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-linux @@ -0,0 +1,34 @@ +# Features supported by OpenZFS 2.0 on Linux +allocation_classes +async_destroy +bookmark_v2 +bookmark_written +bookmarks +device_rebuild +device_removal +edonr +embedded_data +empty_bpobj +enabled_txg +encryption +extensible_dataset +filesystem_limits +hole_birth +large_blocks +large_dnode +livelist +log_spacemap +lz4_compress +multi_vdev_crash_dump +obsolete_counts +project_quota +redacted_datasets +redaction_bookmarks +resilver_defer +sha512 +skein +spacemap_histogram +spacemap_v2 +userobj_accounting +zpool_checkpoint +zstd_compress diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.7.0 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.7.0 new file mode 100644 index 000000000000..4ae87c964c5e --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.7.0 @@ -0,0 +1,16 @@ +# Features supported by OpenZFSonOSX 1.7.0 +async_destroy +bookmarks +edonr +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +multi_vdev_crash_dump +sha512 +skein +spacemap_histogram diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.8.1 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.8.1 new file mode 100644 index 000000000000..162ff32a7803 --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.8.1 @@ -0,0 +1,21 @@ +# Features supported by OpenZFSonOSX 1.8.1 +async_destroy +bookmarks +device_removal +edonr +embedded_data +empty_bpobj +enabled_txg +encryption +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +multi_vdev_crash_dump +obsolete_counts +sha512 +skein +spacemap_histogram +spacemap_v2 +zpool_checkpoint diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.9.3 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.9.3 new file mode 100644 index 000000000000..b0b28ec04939 --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.9.3 @@ -0,0 +1,27 @@ +# Features supported by OpenZFSonOSX 1.9.3 +allocation_classes +async_destroy +bookmark_v2 +bookmarks +device_removal +edonr +embedded_data +empty_bpobj +enabled_txg +encryption +extensible_dataset +filesystem_limits +hole_birth +large_blocks +large_dnode +lz4_compress +multi_vdev_crash_dump +obsolete_counts +project_quota +resilver_defer +sha512 +skein +spacemap_histogram +spacemap_v2 +userobj_accounting +zpool_checkpoint diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.6.5 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.6.5 new file mode 100644 index 000000000000..cb9a94d88951 --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.6.5 @@ -0,0 +1,12 @@ +# Features supported by ZFSonLinux v0.6.5 +async_destroy +bookmarks +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +lz4_compress +spacemap_histogram diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.7 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.7 new file mode 100644 index 000000000000..22a02936df8c --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.7 @@ -0,0 +1,18 @@ +# Features supported by ZFSonLinux v0.7 +async_destroy +bookmarks +edonr +embedded_data +empty_bpobj +enabled_txg +extensible_dataset +filesystem_limits +hole_birth +large_blocks +large_dnode +lz4_compress +multi_vdev_crash_dump +sha512 +skein +spacemap_histogram +userobj_accounting diff --git a/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.8 b/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.8 new file mode 100644 index 000000000000..762848ef7b4b --- /dev/null +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.8 @@ -0,0 +1,27 @@ +# Features supported by ZFSonLinux v0.8 +allocation_classes +async_destroy +bookmark_v2 +bookmarks +device_removal +edonr +embedded_data +empty_bpobj +enabled_txg +encryption +extensible_dataset +filesystem_limits +hole_birth +large_blocks +large_dnode +lz4_compress +multi_vdev_crash_dump +obsolete_counts +project_quota +resilver_defer +sha512 +skein +spacemap_histogram +spacemap_v2 +userobj_accounting +zpool_checkpoint diff --git a/sys/contrib/openzfs/cmd/zpool/zpool_main.c b/sys/contrib/openzfs/cmd/zpool/zpool_main.c index 50adc0add605..29252e6a24f4 100644 --- a/sys/contrib/openzfs/cmd/zpool/zpool_main.c +++ b/sys/contrib/openzfs/cmd/zpool/zpool_main.c @@ -31,6 +31,7 @@ * Copyright (c) 2017 Open-E, Inc. All Rights Reserved. * Copyright (c) 2017, Intel Corporation. * Copyright (c) 2019, loli10K + * Copyright (c) 2021, Colm Buckley */ #include @@ -124,6 +125,9 @@ static int zpool_do_version(int, char **); static int zpool_do_wait(int, char **); +static zpool_compat_status_t zpool_do_load_compat( + const char *, boolean_t *); + /* * These libumem hooks provide a reasonable set of defaults for the allocator's * debugging facilities. @@ -782,6 +786,8 @@ add_prop_list(const char *propname, char *propval, nvlist_t **props, if (poolprop) { const char *vname = zpool_prop_to_name(ZPOOL_PROP_VERSION); + const char *fname = + zpool_prop_to_name(ZPOOL_PROP_COMPATIBILITY); if ((prop = zpool_name_to_prop(propname)) == ZPOOL_PROP_INVAL && !zpool_prop_feature(propname)) { @@ -804,6 +810,19 @@ add_prop_list(const char *propname, char *propval, nvlist_t **props, return (2); } + /* + * compatibility property and version should not be specified + * at the same time. + */ + if ((prop == ZPOOL_PROP_COMPATIBILITY && + nvlist_exists(proplist, vname)) || + (prop == ZPOOL_PROP_VERSION && + nvlist_exists(proplist, fname))) { + (void) fprintf(stderr, gettext("'compatibility' and " + "'version' properties cannot be specified " + "together\n")); + return (2); + } if (zpool_prop_feature(propname)) normnm = propname; @@ -1374,13 +1393,15 @@ zpool_do_create(int argc, char **argv) { boolean_t force = B_FALSE; boolean_t dryrun = B_FALSE; - boolean_t enable_all_pool_feat = B_TRUE; + boolean_t enable_pool_features = B_TRUE; + int c; nvlist_t *nvroot = NULL; char *poolname; char *tname = NULL; int ret = 1; char *altroot = NULL; + char *compat = NULL; char *mountpoint = NULL; nvlist_t *fsprops = NULL; nvlist_t *props = NULL; @@ -1396,7 +1417,7 @@ zpool_do_create(int argc, char **argv) dryrun = B_TRUE; break; case 'd': - enable_all_pool_feat = B_FALSE; + enable_pool_features = B_FALSE; break; case 'R': altroot = optarg; @@ -1434,11 +1455,14 @@ zpool_do_create(int argc, char **argv) ver = strtoull(propval, &end, 10); if (*end == '\0' && ver < SPA_VERSION_FEATURES) { - enable_all_pool_feat = B_FALSE; + enable_pool_features = B_FALSE; } } if (zpool_name_to_prop(optarg) == ZPOOL_PROP_ALTROOT) altroot = propval; + if (zpool_name_to_prop(optarg) == + ZPOOL_PROP_COMPATIBILITY) + compat = propval; break; case 'O': if ((propval = strchr(optarg, '=')) == NULL) { @@ -1632,10 +1656,26 @@ zpool_do_create(int argc, char **argv) ret = 0; } else { /* - * Hand off to libzfs. + * Load in feature set. + * Note: if compatibility property not given, we'll have + * NULL, which means 'all features'. */ - spa_feature_t i; - for (i = 0; i < SPA_FEATURES; i++) { + boolean_t requested_features[SPA_FEATURES]; + if (zpool_do_load_compat(compat, requested_features) != + ZPOOL_COMPATIBILITY_OK) + goto errout; + + /* + * props contains list of features to enable. + * For each feature: + * - remove it if feature@name=disabled + * - leave it there if feature@name=enabled + * - add it if: + * - enable_pool_features (ie: no '-d' or '-o version') + * - it's supported by the kernel module + * - it's in the requested feature set + */ + for (spa_feature_t i = 0; i < SPA_FEATURES; i++) { char propname[MAXPATHLEN]; char *propval; zfeature_info_t *feat = &spa_feature_table[i]; @@ -1643,18 +1683,14 @@ zpool_do_create(int argc, char **argv) (void) snprintf(propname, sizeof (propname), "feature@%s", feat->fi_uname); - /* - * Only features contained in props will be enabled: - * remove from the nvlist every ZFS_FEATURE_DISABLED - * value and add every missing ZFS_FEATURE_ENABLED if - * enable_all_pool_feat is set. - */ if (!nvlist_lookup_string(props, propname, &propval)) { if (strcmp(propval, ZFS_FEATURE_DISABLED) == 0) (void) nvlist_remove_all(props, propname); - } else if (enable_all_pool_feat && - feat->fi_zfs_mod_supported) { + } else if ( + enable_pool_features && + feat->fi_zfs_mod_supported && + requested_features[i]) { ret = add_prop_list(propname, ZFS_FEATURE_ENABLED, &props, B_TRUE); if (ret != 0) @@ -2674,8 +2710,15 @@ show_import(nvlist_t *config) case ZPOOL_STATUS_FEAT_DISABLED: printf_color(ANSI_BOLD, gettext("status: ")); - printf_color(ANSI_YELLOW, gettext("Some supported features are " - "not enabled on the pool.\n")); + printf_color(ANSI_YELLOW, gettext("Some supported and " + "requested features are not enabled on the pool.\n")); + break; + + case ZPOOL_STATUS_COMPATIBILITY_ERR: + printf_color(ANSI_BOLD, gettext("status: ")); + printf_color(ANSI_YELLOW, gettext("Error reading or parsing " + "the file(s) indicated by the 'compatibility'\n" + "property.\n")); break; case ZPOOL_STATUS_UNSUP_FEAT_READ: @@ -2767,6 +2810,12 @@ show_import(nvlist_t *config) "imported using its name or numeric identifier, " "though\n\tsome features will not be available " "without an explicit 'zpool upgrade'.\n")); + } else if (reason == ZPOOL_STATUS_COMPATIBILITY_ERR) { + (void) printf(gettext(" action: The pool can be " + "imported using its name or numeric\n\tidentifier, " + "though the file(s) indicated by its " + "'compatibility'\n\tproperty cannot be parsed at " + "this time.\n")); } else if (reason == ZPOOL_STATUS_HOSTID_MISMATCH) { (void) printf(gettext(" action: The pool can be " "imported using its name or numeric " @@ -7942,7 +7991,8 @@ status_callback(zpool_handle_t *zhp, void *data) if (cbp->cb_explain && (reason == ZPOOL_STATUS_OK || reason == ZPOOL_STATUS_VERSION_OLDER || - reason == ZPOOL_STATUS_FEAT_DISABLED)) { + reason == ZPOOL_STATUS_FEAT_DISABLED || + reason == ZPOOL_STATUS_COMPATIBILITY_ERR)) { if (!cbp->cb_allpools) { (void) printf(gettext("pool '%s' is healthy\n"), zpool_get_name(zhp)); @@ -8117,9 +8167,10 @@ status_callback(zpool_handle_t *zhp, void *data) case ZPOOL_STATUS_FEAT_DISABLED: printf_color(ANSI_BOLD, gettext("status: ")); - printf_color(ANSI_YELLOW, gettext("Some supported features are " - "not enabled on the pool. The pool can\n\tstill be used, " - "but some features are unavailable.\n")); + printf_color(ANSI_YELLOW, gettext("Some supported and " + "requested features are not enabled on the pool.\n\t" + "The pool can still be used, but some features are " + "unavailable.\n")); printf_color(ANSI_BOLD, gettext("action: ")); printf_color(ANSI_YELLOW, gettext("Enable all features using " "'zpool upgrade'. Once this is done,\n\tthe pool may no " @@ -8127,6 +8178,19 @@ status_callback(zpool_handle_t *zhp, void *data) "the features. See zpool-features(5) for details.\n")); break; + case ZPOOL_STATUS_COMPATIBILITY_ERR: + printf_color(ANSI_BOLD, gettext("status: ")); + printf_color(ANSI_YELLOW, gettext("This pool has a " + "compatibility list specified, but it could not be\n\t" + "read/parsed at this time. The pool can still be used, " + "but this\n\tshould be investigated.\n")); + printf_color(ANSI_BOLD, gettext("action: ")); + printf_color(ANSI_YELLOW, gettext("Check the value of the " + "'compatibility' property against the\n\t" + "appropriate file in " ZPOOL_SYSCONF_COMPAT_D " or " + ZPOOL_DATA_COMPAT_D ".\n")); + break; + case ZPOOL_STATUS_UNSUP_FEAT_READ: printf_color(ANSI_BOLD, gettext("status: ")); printf_color(ANSI_YELLOW, gettext("The pool cannot be accessed " @@ -8625,11 +8689,25 @@ upgrade_enable_all(zpool_handle_t *zhp, int *countp) boolean_t firstff = B_TRUE; nvlist_t *enabled = zpool_get_features(zhp); + char compat[ZFS_MAXPROPLEN]; + if (zpool_get_prop(zhp, ZPOOL_PROP_COMPATIBILITY, compat, + ZFS_MAXPROPLEN, NULL, B_FALSE) != 0) + compat[0] = '\0'; + + boolean_t requested_features[SPA_FEATURES]; + if (zpool_do_load_compat(compat, requested_features) != + ZPOOL_COMPATIBILITY_OK) + return (-1); + count = 0; for (i = 0; i < SPA_FEATURES; i++) { const char *fname = spa_feature_table[i].fi_uname; const char *fguid = spa_feature_table[i].fi_guid; - if (!nvlist_exists(enabled, fguid)) { + + if (!spa_feature_table[i].fi_zfs_mod_supported) + continue; + + if (!nvlist_exists(enabled, fguid) && requested_features[i]) { char *propname; verify(-1 != asprintf(&propname, "feature@%s", fname)); ret = zpool_set_prop(zhp, propname, @@ -8759,6 +8837,10 @@ upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg) for (i = 0; i < SPA_FEATURES; i++) { const char *fguid = spa_feature_table[i].fi_guid; const char *fname = spa_feature_table[i].fi_uname; + + if (!spa_feature_table[i].fi_zfs_mod_supported) + continue; + if (!nvlist_exists(enabled, fguid)) { if (cbp->cb_first) { (void) printf(gettext("\nSome " @@ -8847,7 +8929,7 @@ upgrade_one(zpool_handle_t *zhp, void *data) printnl = B_TRUE; } else if (cur_version == SPA_VERSION) { (void) printf(gettext("Pool '%s' already has all " - "supported features enabled.\n"), + "supported and requested features enabled.\n"), zpool_get_name(zhp)); } } @@ -9008,8 +9090,8 @@ zpool_do_upgrade(int argc, char **argv) (void) printf(gettext("All pools are already " "formatted using feature flags.\n\n")); (void) printf(gettext("Every feature flags " - "pool already has all supported features " - "enabled.\n")); + "pool already has all supported and " + "requested features enabled.\n")); } else { (void) printf(gettext("All pools are already " "formatted with version %llu or higher.\n"), @@ -9035,7 +9117,7 @@ zpool_do_upgrade(int argc, char **argv) if (cb.cb_first) { (void) printf(gettext("Every feature flags pool has " - "all supported features enabled.\n")); + "all supported and requested features enabled.\n")); } else { (void) printf(gettext("\n")); } @@ -10339,6 +10421,39 @@ zpool_do_version(int argc, char **argv) return (0); } +/* + * Do zpool_load_compat() and print error message on failure + */ +static zpool_compat_status_t +zpool_do_load_compat(const char *compat, boolean_t *list) +{ + char badword[ZFS_MAXPROPLEN]; + char badfile[MAXPATHLEN]; + zpool_compat_status_t ret; + + switch (ret = zpool_load_compat(compat, list, badword, badfile)) { + case ZPOOL_COMPATIBILITY_OK: + break; + case ZPOOL_COMPATIBILITY_READERR: + (void) fprintf(stderr, gettext("error reading compatibility " + "file '%s'\n"), badfile); + break; + case ZPOOL_COMPATIBILITY_BADFILE: + (void) fprintf(stderr, gettext("compatibility file '%s' " + "too large or not newline-terminated\n"), badfile); + break; + case ZPOOL_COMPATIBILITY_BADWORD: + (void) fprintf(stderr, gettext("unknown feature '%s' in " + "compatibility file '%s'\n"), badword, badfile); + break; + case ZPOOL_COMPATIBILITY_NOFILES: + (void) fprintf(stderr, gettext("no compatibility files " + "specified\n")); + break; + } + return (ret); +} + int main(int argc, char **argv) { diff --git a/sys/contrib/openzfs/cmd/ztest/ztest.c b/sys/contrib/openzfs/cmd/ztest/ztest.c index ab20a635d55a..d2bf0101993e 100644 --- a/sys/contrib/openzfs/cmd/ztest/ztest.c +++ b/sys/contrib/openzfs/cmd/ztest/ztest.c @@ -133,7 +133,7 @@ #include #include #include -#ifdef __GLIBC__ +#if (__GLIBC__ && !__UCLIBC__) #include /* for backtrace() */ #endif @@ -563,7 +563,7 @@ dump_debug_buffer(void) static void sig_handler(int signo) { struct sigaction action; -#ifdef __GLIBC__ /* backtrace() is a GNU extension */ +#if (__GLIBC__ && !__UCLIBC__) /* backtrace() is a GNU extension */ int nptrs; void *buffer[BACKTRACE_SZ]; diff --git a/sys/contrib/openzfs/config/Rules.am b/sys/contrib/openzfs/config/Rules.am index e9cd134edea8..99587eab2bf8 100644 --- a/sys/contrib/openzfs/config/Rules.am +++ b/sys/contrib/openzfs/config/Rules.am @@ -44,6 +44,7 @@ AM_CPPFLAGS += -DLIBEXECDIR=\"$(libexecdir)\" AM_CPPFLAGS += -DRUNSTATEDIR=\"$(runstatedir)\" AM_CPPFLAGS += -DSBINDIR=\"$(sbindir)\" AM_CPPFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\" +AM_CPPFLAGS += -DPKGDATADIR=\"$(pkgdatadir)\" AM_CPPFLAGS += $(DEBUG_CPPFLAGS) AM_CPPFLAGS += $(CODE_COVERAGE_CPPFLAGS) if BUILD_LINUX diff --git a/sys/contrib/openzfs/include/libzfs.h b/sys/contrib/openzfs/include/libzfs.h index 66cedd0ee0fe..5f0bc03be144 100644 --- a/sys/contrib/openzfs/include/libzfs.h +++ b/sys/contrib/openzfs/include/libzfs.h @@ -28,6 +28,7 @@ * Copyright 2016 Nexenta Systems, Inc. * Copyright (c) 2017 Open-E, Inc. All Rights Reserved. * Copyright (c) 2019 Datto Inc. + * Copyright (c) 2021, Colm Buckley */ #ifndef _LIBZFS_H @@ -391,6 +392,7 @@ typedef enum { ZPOOL_STATUS_REBUILDING, /* device being rebuilt */ ZPOOL_STATUS_REBUILD_SCRUB, /* recommend scrubbing the pool */ ZPOOL_STATUS_NON_NATIVE_ASHIFT, /* (e.g. 512e dev with ashift of 9) */ + ZPOOL_STATUS_COMPATIBILITY_ERR, /* bad 'compatibility' property */ /* * Finally, the following indicates a healthy pool. @@ -912,6 +914,20 @@ int zfs_smb_acl_rename(libzfs_handle_t *, char *, char *, char *, char *); extern int zpool_enable_datasets(zpool_handle_t *, const char *, int); extern int zpool_disable_datasets(zpool_handle_t *, boolean_t); +/* + * Parse a features file for -o compatibility + */ +typedef enum { + ZPOOL_COMPATIBILITY_OK, + ZPOOL_COMPATIBILITY_READERR, + ZPOOL_COMPATIBILITY_BADFILE, + ZPOOL_COMPATIBILITY_BADWORD, + ZPOOL_COMPATIBILITY_NOFILES +} zpool_compat_status_t; + +extern zpool_compat_status_t zpool_load_compat(const char *, + boolean_t *, char *, char *); + #ifdef __FreeBSD__ /* diff --git a/sys/contrib/openzfs/include/sys/fs/zfs.h b/sys/contrib/openzfs/include/sys/fs/zfs.h index 65515e3829f3..71d736d5cc97 100644 --- a/sys/contrib/openzfs/include/sys/fs/zfs.h *** 9816 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:36:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9BE05AAD8E; Wed, 10 Mar 2021 09: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 4DwRmY4TnHz4lXj; Wed, 10 Mar 2021 09: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 6F278518A; Wed, 10 Mar 2021 09: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 12A9ajJH014038; Wed, 10 Mar 2021 09: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 12A9ajh0014037; Wed, 10 Mar 2021 09:36:45 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:36:45 GMT Message-Id: <202103100936.12A9ajh0014037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: e295b9d9f598 - stable/13 - zfs: bump version and install new share files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e295b9d9f598e08598725e9352140f03f4163129 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:36:46 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=e295b9d9f598e08598725e9352140f03f4163129 commit e295b9d9f598e08598725e9352140f03f4163129 Author: Martin Matuska AuthorDate: 2021-02-18 11:08:20 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:26:35 +0000 zfs: bump version and install new share files - bump version to 2.0.0-FreeBSD_gbf156c966 - install definition files for the new "-o compatibility" option to "zpool create" MFC after: 2 weeks (cherry picked from commit 10f57cb98fd61b2669640a84aa73ad118601f281) --- cddl/Makefile | 2 +- cddl/lib/libzfs/Makefile | 2 ++ cddl/sbin/zpool/Makefile | 3 ++- cddl/share/Makefile | 13 +++++++++++++ cddl/share/zfs/Makefile | 9 +++++++++ cddl/share/zfs/compatibility.d/Makefile | 28 ++++++++++++++++++++++++++++ etc/mtree/BSD.root.dist | 2 ++ etc/mtree/BSD.usr.dist | 4 ++++ sys/modules/zfs/zfs_config.h | 4 ++-- 9 files changed, 63 insertions(+), 4 deletions(-) diff --git a/cddl/Makefile b/cddl/Makefile index d01199b5d9af..7b9d13146afa 100644 --- a/cddl/Makefile +++ b/cddl/Makefile @@ -3,7 +3,7 @@ .include SUBDIR= lib .WAIT \ - sbin usr.bin usr.sbin + sbin share usr.bin usr.sbin SUBDIR.${MK_TESTS}+= tests diff --git a/cddl/lib/libzfs/Makefile b/cddl/lib/libzfs/Makefile index d0b3458eda64..b159955c0212 100644 --- a/cddl/lib/libzfs/Makefile +++ b/cddl/lib/libzfs/Makefile @@ -103,6 +103,8 @@ CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h CFLAGS+= -DHAVE_ISSETUGID CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h +CFLAGS+= -DSYSCONFDIR=\"/etc\" +CFLAGS+= -DPKGDATADIR=\"/usr/share/zfs\" .include diff --git a/cddl/sbin/zpool/Makefile b/cddl/sbin/zpool/Makefile index fbde6beec331..43cc8f2997b7 100644 --- a/cddl/sbin/zpool/Makefile +++ b/cddl/sbin/zpool/Makefile @@ -71,7 +71,8 @@ CFLAGS+= \ -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \ -DHAVE_ISSETUGID \ -include ${SRCTOP}/sys/modules/zfs/zfs_config.h \ - -DSYSCONFDIR=\"/etc\" + -DSYSCONFDIR=\"/etc\" \ + -DPKGDATADIR=\"/usr/share/zfs\" LIBADD= geom nvpair uutil zfs zutil avl spl tpool zfs_core m LDADD+= -pthread diff --git a/cddl/share/Makefile b/cddl/share/Makefile new file mode 100644 index 000000000000..68670ffbe7e0 --- /dev/null +++ b/cddl/share/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.include + +SUBDIR= ${_zfs} + +.if ${MK_ZFS} != "no" +_zfs= zfs +.endif + +SUBDIR_PARALLEL= + +.include diff --git a/cddl/share/zfs/Makefile b/cddl/share/zfs/Makefile new file mode 100644 index 000000000000..98e10b60aae6 --- /dev/null +++ b/cddl/share/zfs/Makefile @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.include + +SUBDIR= compatibility.d + +SUBDIR_PARALLEL= + +.include diff --git a/cddl/share/zfs/compatibility.d/Makefile b/cddl/share/zfs/compatibility.d/Makefile new file mode 100644 index 000000000000..6531430ef050 --- /dev/null +++ b/cddl/share/zfs/compatibility.d/Makefile @@ -0,0 +1,28 @@ +# $FreeBSD$ + +ZFSTOP= ${SRCTOP}/sys/contrib/openzfs + +.PATH: ${ZFSTOP}/cmd/zpool/compatibility.d + +FILES= \ + compat-2018 \ + compat-2019 \ + compat-2020 \ + compat-2021 \ + freebsd-11.0 \ + freebsd-11.2 \ + freebsd-11.3 \ + freenas-9.10.2 \ + grub2 \ + openzfsonosx-1.7.0 \ + openzfsonosx-1.8.1 \ + openzfsonosx-1.9.3 \ + openzfs-2.0-freebsd \ + openzfs-2.0-linux \ + zol-0.6.5 \ + zol-0.7 \ + zol-0.8 + +FILESDIR= ${SHAREDIR}/zfs/compatibility.d + +.include diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist index 2cfa18dd5662..f734f7891429 100644 --- a/etc/mtree/BSD.root.dist +++ b/etc/mtree/BSD.root.dist @@ -95,6 +95,8 @@ syslog.d .. zfs + compatibility.d + .. .. .. lib diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 375cf3a96447..9ae3acbe6eba 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -1230,6 +1230,10 @@ keymaps .. .. + zfs + compatibility.d + .. + .. zoneinfo Africa .. diff --git a/sys/modules/zfs/zfs_config.h b/sys/modules/zfs/zfs_config.h index 73a56f9291c6..18ca44d1b3c1 100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@ -734,7 +734,7 @@ /* #undef ZFS_IS_GPL_COMPATIBLE */ /* Define the project alias string. */ -#define ZFS_META_ALIAS "zfs-2.0.0-FreeBSD_g436ab35a5" +#define ZFS_META_ALIAS "zfs-2.0.0-FreeBSD_gbf156c966" /* Define the project author. */ #define ZFS_META_AUTHOR "OpenZFS" @@ -764,7 +764,7 @@ #define ZFS_META_NAME "zfs" /* Define the project release. */ -#define ZFS_META_RELEASE "FreeBSD_g436ab35a5" +#define ZFS_META_RELEASE "FreeBSD_gbf156c966" /* Define the project version. */ #define ZFS_META_VERSION "2.0.0" From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:37:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0575B5AA9D4; Wed, 10 Mar 2021 09:37:03 +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 4DwRms6c4Bz4ldr; Wed, 10 Mar 2021 09:37: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 DF5755134; Wed, 10 Mar 2021 09:36: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 12A9awME014174; Wed, 10 Mar 2021 09:36:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12A9awNl014173; Wed, 10 Mar 2021 09:36:58 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:36:58 GMT Message-Id: <202103100936.12A9awNl014173@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 57b9b81894e8 - stable/13 - zfs: merge OpenZFS master-9312e0fd1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 57b9b81894e89f8fc686246618b3ac422a756641 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:37:03 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=57b9b81894e89f8fc686246618b3ac422a756641 commit 57b9b81894e89f8fc686246618b3ac422a756641 Author: Martin Matuska AuthorDate: 2021-02-22 11:35:56 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:53:32 +0000 zfs: merge OpenZFS master-9312e0fd1 Notable upstream changes: 778869fa1 Fix reporting of mount progress e7adccf7f Disable use of hardware crypto offload drivers on FreeBSD 03e02e5b5 Fix checksum errors not being counted on repeated repair 64e0fe14f Restore FreeBSD resource usage accounting 11f2e9a49 Fix panic if scrubbing after removing a slog device (cherry picked from commit ba27dd8be821792e15bdabfac69fd6cab0cf9dd3) --- cddl/lib/libzpool/Makefile | 2 +- stand/libsa/zfs/zstd_shim.c | 5 + sys/contrib/openzfs/cmd/zfs/zfs_main.c | 3 - sys/contrib/openzfs/cmd/ztest/ztest.c | 113 ++++++++- .../openzfs/include/os/freebsd/spl/sys/uio.h | 43 +--- sys/contrib/openzfs/include/os/linux/spl/sys/uio.h | 22 +- .../include/os/linux/zfs/sys/zfs_context_os.h | 1 - sys/contrib/openzfs/include/sys/spa.h | 3 +- sys/contrib/openzfs/include/sys/uio_impl.h | 21 +- sys/contrib/openzfs/include/sys/zfs_context.h | 3 +- sys/contrib/openzfs/lib/libzpool/util.c | 74 ++++-- .../lib/libzutil/os/linux/zutil_device_path_os.c | 252 ++++++++++++--------- .../openzfs/module/os/freebsd/spl/spl_uio.c | 9 +- sys/contrib/openzfs/module/zfs/dsl_scan.c | 6 +- sys/contrib/openzfs/module/zfs/spa_config.c | 2 +- sys/contrib/openzfs/module/zfs/vdev.c | 5 +- sys/contrib/openzfs/module/zfs/vdev_indirect.c | 10 +- sys/contrib/openzfs/module/zfs/vdev_raidz.c | 20 +- sys/contrib/openzfs/module/zfs/vdev_rebuild.c | 3 + sys/contrib/openzfs/module/zfs/zfs_fm.c | 46 +++- sys/contrib/openzfs/module/zfs/zfs_ioctl.c | 2 +- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 2 +- sys/contrib/openzfs/module/zfs/zio.c | 11 +- sys/contrib/openzfs/scripts/zfs.sh | 2 +- sys/contrib/openzfs/tests/runfiles/common.run | 3 +- .../functional/cli_root/zpool_events/Makefile.am | 3 +- .../zpool_events/zpool_events_clear_retained.ksh | 135 +++++++++++ .../zpool_events/zpool_events_duplicates.ksh | 11 - sys/modules/zfs/zfs_config.h | 2 +- 29 files changed, 569 insertions(+), 245 deletions(-) diff --git a/cddl/lib/libzpool/Makefile b/cddl/lib/libzpool/Makefile index 819f67ceec5a..6893e31ff20a 100644 --- a/cddl/lib/libzpool/Makefile +++ b/cddl/lib/libzpool/Makefile @@ -160,9 +160,9 @@ KERNEL_C = \ zfs_debug.c \ zfs_fm.c \ zfs_fuid.c \ - zfs_racct.c \ zfs_sa.c \ zfs_znode.c \ + zfs_racct.c \ zfs_ratelimit.c \ zfs_rlock.c \ zil.c \ diff --git a/stand/libsa/zfs/zstd_shim.c b/stand/libsa/zfs/zstd_shim.c index b94df6f51913..91f5171a72b5 100644 --- a/stand/libsa/zfs/zstd_shim.c +++ b/stand/libsa/zfs/zstd_shim.c @@ -37,4 +37,9 @@ __FBSDID("$FreeBSD$"); #define ZFS_MODULE_PARAM_ARGS void typedef int boolean_t; /* This one may be tough to get rid of */ +/* TODO: openzfs/include/sys/uio_impl.h must not be included */ +#ifndef _SYS_UIO_IMPL_H +#define _SYS_UIO_IMPL_H +#endif + #include diff --git a/sys/contrib/openzfs/cmd/zfs/zfs_main.c b/sys/contrib/openzfs/cmd/zfs/zfs_main.c index ab2b006ae460..9a59fddbf06d 100644 --- a/sys/contrib/openzfs/cmd/zfs/zfs_main.c +++ b/sys/contrib/openzfs/cmd/zfs/zfs_main.c @@ -6912,9 +6912,6 @@ report_mount_progress(int current, int total) time_t now = time(NULL); char info[32]; - /* report 1..n instead of 0..n-1 */ - ++current; - /* display header if we're here for the first time */ if (current == 1) { set_progress_header(gettext("Mounting ZFS filesystems")); diff --git a/sys/contrib/openzfs/cmd/ztest/ztest.c b/sys/contrib/openzfs/cmd/ztest/ztest.c index d2bf0101993e..cfa1290d78d1 100644 --- a/sys/contrib/openzfs/cmd/ztest/ztest.c +++ b/sys/contrib/openzfs/cmd/ztest/ztest.c @@ -158,6 +158,9 @@ enum ztest_class_state { ZTEST_VDEV_CLASS_RND }; +#define ZO_GVARS_MAX_ARGLEN ((size_t)64) +#define ZO_GVARS_MAX_COUNT ((size_t)10) + typedef struct ztest_shared_opts { char zo_pool[ZFS_MAX_DATASET_NAME_LEN]; char zo_dir[ZFS_MAX_DATASET_NAME_LEN]; @@ -185,6 +188,8 @@ typedef struct ztest_shared_opts { int zo_mmp_test; int zo_special_vdevs; int zo_dump_dbgmsg; + int zo_gvars_count; + char zo_gvars[ZO_GVARS_MAX_COUNT][ZO_GVARS_MAX_ARGLEN]; } ztest_shared_opts_t; static const ztest_shared_opts_t ztest_opts_defaults = { @@ -212,6 +217,7 @@ static const ztest_shared_opts_t ztest_opts_defaults = { .zo_maxloops = 50, /* max loops during spa_freeze() */ .zo_metaslab_force_ganging = 64 << 10, .zo_special_vdevs = ZTEST_VDEV_CLASS_RND, + .zo_gvars_count = 0, }; extern uint64_t metaslab_force_ganging; @@ -918,8 +924,21 @@ process_options(int argc, char **argv) ztest_parse_name_value(optarg, zo); break; case 'o': - if (set_global_var(optarg) != 0) + if (zo->zo_gvars_count >= ZO_GVARS_MAX_COUNT) { + (void) fprintf(stderr, + "max global var count (%zu) exceeded\n", + ZO_GVARS_MAX_COUNT); + usage(B_FALSE); + } + char *v = zo->zo_gvars[zo->zo_gvars_count]; + if (strlcpy(v, optarg, ZO_GVARS_MAX_ARGLEN) >= + ZO_GVARS_MAX_ARGLEN) { + (void) fprintf(stderr, + "global var option '%s' is too long\n", + optarg); usage(B_FALSE); + } + zo->zo_gvars_count++; break; case 'G': zo->zo_dump_dbgmsg = 1; @@ -6373,6 +6392,75 @@ ztest_fletcher_incr(ztest_ds_t *zd, uint64_t id) } } +static int +ztest_set_global_vars(void) +{ + for (size_t i = 0; i < ztest_opts.zo_gvars_count; i++) { + char *kv = ztest_opts.zo_gvars[i]; + VERIFY3U(strlen(kv), <=, ZO_GVARS_MAX_ARGLEN); + VERIFY3U(strlen(kv), >, 0); + int err = set_global_var(kv); + if (ztest_opts.zo_verbose > 0) { + (void) printf("setting global var %s ... %s\n", kv, + err ? "failed" : "ok"); + } + if (err != 0) { + (void) fprintf(stderr, + "failed to set global var '%s'\n", kv); + return (err); + } + } + return (0); +} + +static char ** +ztest_global_vars_to_zdb_args(void) +{ + char **args = calloc(2*ztest_opts.zo_gvars_count + 1, sizeof (char *)); + char **cur = args; + for (size_t i = 0; i < ztest_opts.zo_gvars_count; i++) { + char *kv = ztest_opts.zo_gvars[i]; + *cur = "-o"; + cur++; + *cur = strdup(kv); + cur++; + } + ASSERT3P(cur, ==, &args[2*ztest_opts.zo_gvars_count]); + *cur = NULL; + return (args); +} + +/* The end of strings is indicated by a NULL element */ +static char * +join_strings(char **strings, const char *sep) +{ + size_t totallen = 0; + for (char **sp = strings; *sp != NULL; sp++) { + totallen += strlen(*sp); + totallen += strlen(sep); + } + if (totallen > 0) { + ASSERT(totallen >= strlen(sep)); + totallen -= strlen(sep); + } + + size_t buflen = totallen + 1; + char *o = malloc(buflen); /* trailing 0 byte */ + o[0] = '\0'; + for (char **sp = strings; *sp != NULL; sp++) { + size_t would; + would = strlcat(o, *sp, buflen); + VERIFY3U(would, <, buflen); + if (*(sp+1) == NULL) { + break; + } + would = strlcat(o, sep, buflen); + VERIFY3U(would, <, buflen); + } + ASSERT3S(strlen(o), ==, totallen); + return (o); +} + static int ztest_check_path(char *path) { @@ -6601,13 +6689,21 @@ ztest_run_zdb(char *pool) ztest_get_zdb_bin(bin, len); - (void) sprintf(zdb, - "%s -bcc%s%s -G -d -Y -e -y -p %s %s", + char **set_gvars_args = ztest_global_vars_to_zdb_args(); + char *set_gvars_args_joined = join_strings(set_gvars_args, " "); + free(set_gvars_args); + + size_t would = snprintf(zdb, len, + "%s -bcc%s%s -G -d -Y -e -y %s -p %s %s", bin, ztest_opts.zo_verbose >= 3 ? "s" : "", ztest_opts.zo_verbose >= 4 ? "v" : "", + set_gvars_args_joined, ztest_opts.zo_dir, pool); + ASSERT3U(would, <, len); + + free(set_gvars_args_joined); if (ztest_opts.zo_verbose >= 5) (void) printf("Executing %s\n", strstr(zdb, "zdb ")); @@ -7727,7 +7823,7 @@ main(int argc, char **argv) char numbuf[NN_NUMBUF_SZ]; char *cmd; boolean_t hasalt; - int f; + int f, err; char *fd_data_str = getenv("ZTEST_FD_DATA"); struct sigaction action; @@ -7794,6 +7890,15 @@ main(int argc, char **argv) } ASSERT3U(ztest_opts.zo_datasets, ==, ztest_shared_hdr->zh_ds_count); + err = ztest_set_global_vars(); + if (err != 0 && !fd_data_str) { + /* error message done by ztest_set_global_vars */ + exit(EXIT_FAILURE); + } else { + /* children should not be spawned if setting gvars fails */ + VERIFY3S(err, ==, 0); + } + /* Override location of zpool.cache */ VERIFY3S(asprintf((char **)&spa_config_path, "%s/zpool.cache", ztest_opts.zo_dir), !=, -1); diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/uio.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/uio.h index f1d30195f048..b71f2f2e5625 100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/uio.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/uio.h @@ -55,38 +55,12 @@ typedef struct zfs_uio { #define zfs_uio_fault_disable(u, set) #define zfs_uio_prefaultpages(size, u) (0) - -static __inline void -zfs_uio_init(zfs_uio_t *uio, struct uio *uio_s) -{ - GET_UIO_STRUCT(uio) = uio_s; -} - -static __inline void +static inline void zfs_uio_setoffset(zfs_uio_t *uio, offset_t off) { zfs_uio_offset(uio) = off; } -static __inline int -zfs_uiomove(void *cp, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio) -{ - ASSERT(zfs_uio_rw(uio) == dir); - return (uiomove(cp, (int)n, GET_UIO_STRUCT(uio))); -} - -int zfs_uiocopy(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, - size_t *cbytes); -void zfs_uioskip(zfs_uio_t *uiop, size_t n); -int zfs_uio_fault_move(void *p, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio); - -static inline void -zfs_uio_iov_at_index(zfs_uio_t *uio, uint_t idx, void **base, uint64_t *len) -{ - *base = zfs_uio_iovbase(uio, idx); - *len = zfs_uio_iovlen(uio, idx); -} - static inline void zfs_uio_advance(zfs_uio_t *uio, size_t size) { @@ -94,19 +68,14 @@ zfs_uio_advance(zfs_uio_t *uio, size_t size) zfs_uio_offset(uio) += size; } -static inline offset_t -zfs_uio_index_at_offset(zfs_uio_t *uio, offset_t off, uint_t *vec_idx) +static __inline void +zfs_uio_init(zfs_uio_t *uio, struct uio *uio_s) { - *vec_idx = 0; - while (*vec_idx < zfs_uio_iovcnt(uio) && - off >= zfs_uio_iovlen(uio, *vec_idx)) { - off -= zfs_uio_iovlen(uio, *vec_idx); - (*vec_idx)++; - } - - return (off); + GET_UIO_STRUCT(uio) = uio_s; } +int zfs_uio_fault_move(void *p, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio); + #endif /* !_STANDALONE */ #endif /* !_OPENSOLARIS_SYS_UIO_H_ */ diff --git a/sys/contrib/openzfs/include/os/linux/spl/sys/uio.h b/sys/contrib/openzfs/include/os/linux/spl/sys/uio.h index 0deed3c5736d..66af2b0b534c 100644 --- a/sys/contrib/openzfs/include/os/linux/spl/sys/uio.h +++ b/sys/contrib/openzfs/include/os/linux/spl/sys/uio.h @@ -78,19 +78,14 @@ typedef struct zfs_uio { #define zfs_uio_rlimit_fsize(z, u) (0) #define zfs_uio_fault_move(p, n, rw, u) zfs_uiomove((p), (n), (rw), (u)) +extern int zfs_uio_prefaultpages(ssize_t, zfs_uio_t *); + static inline void zfs_uio_setoffset(zfs_uio_t *uio, offset_t off) { uio->uio_loffset = off; } -static inline void -zfs_uio_iov_at_index(zfs_uio_t *uio, uint_t idx, void **base, uint64_t *len) -{ - *base = zfs_uio_iovbase(uio, idx); - *len = zfs_uio_iovlen(uio, idx); -} - static inline void zfs_uio_advance(zfs_uio_t *uio, size_t size) { @@ -98,19 +93,6 @@ zfs_uio_advance(zfs_uio_t *uio, size_t size) uio->uio_loffset += size; } -static inline offset_t -zfs_uio_index_at_offset(zfs_uio_t *uio, offset_t off, uint_t *vec_idx) -{ - *vec_idx = 0; - while (*vec_idx < zfs_uio_iovcnt(uio) && - off >= zfs_uio_iovlen(uio, *vec_idx)) { - off -= zfs_uio_iovlen(uio, *vec_idx); - (*vec_idx)++; - } - - return (off); -} - static inline void zfs_uio_iovec_init(zfs_uio_t *uio, const struct iovec *iov, unsigned long nr_segs, offset_t offset, zfs_uio_seg_t seg, ssize_t resid, diff --git a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_context_os.h b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_context_os.h index 9e5fdd79f019..de7015b929b6 100644 --- a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_context_os.h +++ b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_context_os.h @@ -23,7 +23,6 @@ #ifndef ZFS_CONTEXT_OS_H #define ZFS_CONTEXT_OS_H -#include #include #include diff --git a/sys/contrib/openzfs/include/sys/spa.h b/sys/contrib/openzfs/include/sys/spa.h index 0762ae8a3e13..8391be8328b6 100644 --- a/sys/contrib/openzfs/include/sys/spa.h +++ b/sys/contrib/openzfs/include/sys/spa.h @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2020 by Delphix. All rights reserved. + * Copyright (c) 2011, 2021 by Delphix. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved. * Copyright 2013 Saso Kiselkov. All rights reserved. @@ -1150,6 +1150,7 @@ extern int zfs_ereport_post(const char *clazz, spa_t *spa, vdev_t *vd, extern boolean_t zfs_ereport_is_valid(const char *clazz, spa_t *spa, vdev_t *vd, zio_t *zio); extern void zfs_ereport_taskq_fini(void); +extern void zfs_ereport_clear(spa_t *spa, vdev_t *vd); extern nvlist_t *zfs_event_create(spa_t *spa, vdev_t *vd, const char *type, const char *name, nvlist_t *aux); extern void zfs_post_remove(spa_t *spa, vdev_t *vd); diff --git a/sys/contrib/openzfs/include/sys/uio_impl.h b/sys/contrib/openzfs/include/sys/uio_impl.h index be70cea54818..cde3ef40485b 100644 --- a/sys/contrib/openzfs/include/sys/uio_impl.h +++ b/sys/contrib/openzfs/include/sys/uio_impl.h @@ -42,8 +42,27 @@ #include extern int zfs_uiomove(void *, size_t, zfs_uio_rw_t, zfs_uio_t *); -extern int zfs_uio_prefaultpages(ssize_t, zfs_uio_t *); extern int zfs_uiocopy(void *, size_t, zfs_uio_rw_t, zfs_uio_t *, size_t *); extern void zfs_uioskip(zfs_uio_t *, size_t); +static inline void +zfs_uio_iov_at_index(zfs_uio_t *uio, uint_t idx, void **base, uint64_t *len) +{ + *base = zfs_uio_iovbase(uio, idx); + *len = zfs_uio_iovlen(uio, idx); +} + +static inline offset_t +zfs_uio_index_at_offset(zfs_uio_t *uio, offset_t off, uint_t *vec_idx) +{ + *vec_idx = 0; + while (*vec_idx < zfs_uio_iovcnt(uio) && + off >= zfs_uio_iovlen(uio, *vec_idx)) { + off -= zfs_uio_iovlen(uio, *vec_idx); + (*vec_idx)++; + } + + return (off); +} + #endif /* _SYS_UIO_IMPL_H */ diff --git a/sys/contrib/openzfs/include/sys/zfs_context.h b/sys/contrib/openzfs/include/sys/zfs_context.h index ee3216d6763a..6cdcc6d30966 100644 --- a/sys/contrib/openzfs/include/sys/zfs_context.h +++ b/sys/contrib/openzfs/include/sys/zfs_context.h @@ -72,6 +72,7 @@ extern "C" { #include #include #include +#include #include #else /* _KERNEL || _STANDALONE */ @@ -652,7 +653,7 @@ extern void random_fini(void); struct spa; extern void show_pool_stats(struct spa *); -extern int set_global_var(char *arg); +extern int set_global_var(char const *arg); typedef struct callb_cpr { kmutex_t *cc_lockp; diff --git a/sys/contrib/openzfs/lib/libzpool/util.c b/sys/contrib/openzfs/lib/libzpool/util.c index ebfaa9b41a2a..2da2375a1d2d 100644 --- a/sys/contrib/openzfs/lib/libzpool/util.c +++ b/sys/contrib/openzfs/lib/libzpool/util.c @@ -148,18 +148,54 @@ show_pool_stats(spa_t *spa) nvlist_free(config); } +/* *k_out must be freed by the caller */ +static int +set_global_var_parse_kv(const char *arg, char **k_out, u_longlong_t *v_out) +{ + int err; + VERIFY(arg); + char *d = strdup(arg); + + char *save = NULL; + char *k = strtok_r(d, "=", &save); + char *v_str = strtok_r(NULL, "=", &save); + char *follow = strtok_r(NULL, "=", &save); + if (k == NULL || v_str == NULL || follow != NULL) { + err = EINVAL; + goto err_free; + } + + u_longlong_t val = strtoull(v_str, NULL, 0); + if (val > UINT32_MAX) { + fprintf(stderr, "Value for global variable '%s' must " + "be a 32-bit unsigned integer, got '%s'\n", k, v_str); + err = EOVERFLOW; + goto err_free; + } + + *k_out = k; + *v_out = val; + return (0); + +err_free: + free(k); + + return (err); +} + /* * Sets given global variable in libzpool to given unsigned 32-bit value. * arg: "=" */ int -set_global_var(char *arg) +set_global_var(char const *arg) { void *zpoolhdl; - char *varname = arg, *varval; + char *varname; u_longlong_t val; + int ret; -#ifndef _LITTLE_ENDIAN +#ifndef _ZFS_LITTLE_ENDIAN /* * On big endian systems changing a 64-bit variable would set the high * 32 bits instead of the low 32 bits, which could cause unexpected @@ -167,19 +203,12 @@ set_global_var(char *arg) */ fprintf(stderr, "Setting global variables is only supported on " "little-endian systems\n"); - return (ENOTSUP); + ret = ENOTSUP; + goto out_ret; #endif - if (arg != NULL && (varval = strchr(arg, '=')) != NULL) { - *varval = '\0'; - varval++; - val = strtoull(varval, NULL, 0); - if (val > UINT32_MAX) { - fprintf(stderr, "Value for global variable '%s' must " - "be a 32-bit unsigned integer\n", varname); - return (EOVERFLOW); - } - } else { - return (EINVAL); + + if ((ret = set_global_var_parse_kv(arg, &varname, &val)) != 0) { + goto out_ret; } zpoolhdl = dlopen("libzpool.so", RTLD_LAZY); @@ -189,18 +218,25 @@ set_global_var(char *arg) if (var == NULL) { fprintf(stderr, "Global variable '%s' does not exist " "in libzpool.so\n", varname); - return (EINVAL); + ret = EINVAL; + goto out_dlclose; } *var = (uint32_t)val; - dlclose(zpoolhdl); } else { fprintf(stderr, "Failed to open libzpool.so to set global " "variable\n"); - return (EIO); + ret = EIO; + goto out_dlclose; } - return (0); + ret = 0; + +out_dlclose: + dlclose(zpoolhdl); + free(varname); +out_ret: + return (ret); } static nvlist_t * diff --git a/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_os.c b/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_os.c index 36331fd72bf7..1f767bb7a6e7 100644 --- a/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_os.c +++ b/sys/contrib/openzfs/lib/libzutil/os/linux/zutil_device_path_os.c @@ -154,15 +154,124 @@ zfs_strip_path(char *path) return (strrchr(path, '/') + 1); } +/* + * Given a dev name like "sda", return the full enclosure sysfs path to + * the disk. You can also pass in the name with "/dev" prepended + * to it (like /dev/sda). + * + * For example, disk "sda" in enclosure slot 1: + * dev: "sda" + * returns: "/sys/class/enclosure/1:0:3:0/Slot 1" + * + * 'dev' must be a non-devicemapper device. + * + * Returned string must be freed. + */ +char * +zfs_get_enclosure_sysfs_path(const char *dev_name) +{ + DIR *dp = NULL; + struct dirent *ep; + char buf[MAXPATHLEN]; + char *tmp1 = NULL; + char *tmp2 = NULL; + char *tmp3 = NULL; + char *path = NULL; + size_t size; + int tmpsize; + + if (dev_name == NULL) + return (NULL); + + /* If they preface 'dev' with a path (like "/dev") then strip it off */ + tmp1 = strrchr(dev_name, '/'); + if (tmp1 != NULL) + dev_name = tmp1 + 1; /* +1 since we want the chr after '/' */ + + tmpsize = asprintf(&tmp1, "/sys/block/%s/device", dev_name); + if (tmpsize == -1 || tmp1 == NULL) { + tmp1 = NULL; + goto end; + } + + dp = opendir(tmp1); + if (dp == NULL) { + tmp1 = NULL; /* To make free() at the end a NOP */ + goto end; + } + + /* + * Look though all sysfs entries in /sys/block//device for + * the enclosure symlink. + */ + while ((ep = readdir(dp))) { + /* Ignore everything that's not our enclosure_device link */ + if (strstr(ep->d_name, "enclosure_device") == NULL) + continue; + + if (asprintf(&tmp2, "%s/%s", tmp1, ep->d_name) == -1 || + tmp2 == NULL) + break; + + size = readlink(tmp2, buf, sizeof (buf)); + + /* Did readlink fail or crop the link name? */ + if (size == -1 || size >= sizeof (buf)) { + free(tmp2); + tmp2 = NULL; /* To make free() at the end a NOP */ + break; + } + + /* + * We got a valid link. readlink() doesn't terminate strings + * so we have to do it. + */ + buf[size] = '\0'; + + /* + * Our link will look like: + * + * "../../../../port-11:1:2/..STUFF../enclosure/1:0:3:0/SLOT 1" + * + * We want to grab the "enclosure/1:0:3:0/SLOT 1" part + */ + tmp3 = strstr(buf, "enclosure"); + if (tmp3 == NULL) + break; + + if (asprintf(&path, "/sys/class/%s", tmp3) == -1) { + /* If asprintf() fails, 'path' is undefined */ + path = NULL; + break; + } + + if (path == NULL) + break; + } + +end: + free(tmp2); + free(tmp1); + + if (dp != NULL) + closedir(dp); + + return (path); +} + /* * Allocate and return the underlying device name for a device mapper device. - * If a device mapper device maps to multiple devices, return the first device. * * For example, dm_name = "/dev/dm-0" could return "/dev/sda". Symlinks to a * DM device (like /dev/disk/by-vdev/A0) are also allowed. * - * Returns device name, or NULL on error or no match. If dm_name is not a DM - * device then return NULL. + * If the DM device has multiple underlying devices (like with multipath + * DM devices), then favor underlying devices that have a symlink back to their + * back to their enclosure device in sysfs. This will be useful for the + * zedlet scripts that toggle the fault LED. + * + * Returns an underlying device name, or NULL on error or no match. If dm_name + * is not a DM device then return NULL. * * NOTE: The returned name string must be *freed*. */ @@ -176,6 +285,8 @@ dm_get_underlying_path(const char *dm_name) char *path = NULL; char *dev_str; int size; + char *first_path = NULL; + char *enclosure_path; if (dm_name == NULL) return (NULL); @@ -204,13 +315,27 @@ dm_get_underlying_path(const char *dm_name) goto end; /* - * Return first entry (that isn't itself a directory) in the - * directory containing device-mapper dependent (underlying) - * devices. + * A device-mapper device can have multiple paths to it (multipath). + * Favor paths that have a symlink back to their enclosure device. + * We have to do this since some enclosures may only provide a symlink + * back for one underlying path to a disk and not the other. + * + * If no paths have links back to their enclosure, then just return the + * first path. */ while ((ep = readdir(dp))) { if (ep->d_type != DT_DIR) { /* skip "." and ".." dirs */ + if (!first_path) + first_path = strdup(ep->d_name); + + enclosure_path = + zfs_get_enclosure_sysfs_path(ep->d_name); + + if (!enclosure_path) + continue; + size = asprintf(&path, "/dev/%s", ep->d_name); + free(enclosure_path); break; } } @@ -220,6 +345,17 @@ end: closedir(dp); free(tmp); free(realp); + + if (!path) { + /* + * None of the underlying paths had a link back to their + * enclosure devices. Throw up out hands and return the first + * underlying path. + */ + size = asprintf(&path, "/dev/%s", first_path); + } + + free(first_path); return (path); } @@ -331,110 +467,6 @@ zfs_get_underlying_path(const char *dev_name) return (name); } -/* - * Given a dev name like "sda", return the full enclosure sysfs path to - * the disk. You can also pass in the name with "/dev" prepended - * to it (like /dev/sda). - * - * For example, disk "sda" in enclosure slot 1: - * dev: "sda" - * returns: "/sys/class/enclosure/1:0:3:0/Slot 1" - * - * 'dev' must be a non-devicemapper device. - * - * Returned string must be freed. - */ -char * -zfs_get_enclosure_sysfs_path(const char *dev_name) -{ - DIR *dp = NULL; - struct dirent *ep; - char buf[MAXPATHLEN]; - char *tmp1 = NULL; - char *tmp2 = NULL; - char *tmp3 = NULL; - char *path = NULL; - size_t size; - int tmpsize; - - if (dev_name == NULL) - return (NULL); - - /* If they preface 'dev' with a path (like "/dev") then strip it off */ - tmp1 = strrchr(dev_name, '/'); - if (tmp1 != NULL) - dev_name = tmp1 + 1; /* +1 since we want the chr after '/' */ - - tmpsize = asprintf(&tmp1, "/sys/block/%s/device", dev_name); - if (tmpsize == -1 || tmp1 == NULL) { - tmp1 = NULL; - goto end; - } - - dp = opendir(tmp1); - if (dp == NULL) { - tmp1 = NULL; /* To make free() at the end a NOP */ - goto end; - } - - /* - * Look though all sysfs entries in /sys/block//device for - * the enclosure symlink. - */ - while ((ep = readdir(dp))) { - /* Ignore everything that's not our enclosure_device link */ - if (strstr(ep->d_name, "enclosure_device") == NULL) - continue; - - if (asprintf(&tmp2, "%s/%s", tmp1, ep->d_name) == -1 || - tmp2 == NULL) - break; - - size = readlink(tmp2, buf, sizeof (buf)); - - /* Did readlink fail or crop the link name? */ - if (size == -1 || size >= sizeof (buf)) { - free(tmp2); - tmp2 = NULL; /* To make free() at the end a NOP */ - break; - } - - /* - * We got a valid link. readlink() doesn't terminate strings - * so we have to do it. - */ - buf[size] = '\0'; - - /* - * Our link will look like: - * - * "../../../../port-11:1:2/..STUFF../enclosure/1:0:3:0/SLOT 1" - * - * We want to grab the "enclosure/1:0:3:0/SLOT 1" part - */ - tmp3 = strstr(buf, "enclosure"); - if (tmp3 == NULL) - break; - - if (asprintf(&path, "/sys/class/%s", tmp3) == -1) { - /* If asprintf() fails, 'path' is undefined */ - path = NULL; - break; - } - - if (path == NULL) - break; - } - -end: - free(tmp2); - free(tmp1); - - if (dp != NULL) - closedir(dp); - - return (path); -} #ifdef HAVE_LIBUDEV diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_uio.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_uio.c index f5f3524f7b9d..59a781ee1b64 100644 --- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_uio.c +++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_uio.c @@ -41,10 +41,17 @@ */ #include -#include +#include #include #include +int +zfs_uiomove(void *cp, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio) +{ + ASSERT(zfs_uio_rw(uio) == dir); + return (uiomove(cp, (int)n, GET_UIO_STRUCT(uio))); +} + /* * same as zfs_uiomove() but doesn't modify uio structure. * return in cbytes how many bytes were copied. diff --git a/sys/contrib/openzfs/module/zfs/dsl_scan.c b/sys/contrib/openzfs/module/zfs/dsl_scan.c index 40adfbcee4e1..a54cd6ca800e 100644 --- a/sys/contrib/openzfs/module/zfs/dsl_scan.c +++ b/sys/contrib/openzfs/module/zfs/dsl_scan.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2018 by Delphix. All rights reserved. + * Copyright (c) 2011, 2021 by Delphix. All rights reserved. * Copyright 2016 Gary Mills * Copyright (c) 2017, 2019, Datto Inc. All rights reserved. * Copyright (c) 2015, Nexenta Systems, Inc. All rights reserved. @@ -987,6 +987,10 @@ dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx) (u_longlong_t)spa_get_errlog_size(spa)); spa_async_request(spa, SPA_ASYNC_RESILVER); } + + /* Clear recent error events (i.e. duplicate events tracking) */ + if (complete) + zfs_ereport_clear(spa, NULL); } scn->scn_phys.scn_end_time = gethrestime_sec(); diff --git a/sys/contrib/openzfs/module/zfs/spa_config.c b/sys/contrib/openzfs/module/zfs/spa_config.c index 4a3144313267..ad82932ce567 100644 --- a/sys/contrib/openzfs/module/zfs/spa_config.c +++ b/sys/contrib/openzfs/module/zfs/spa_config.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -40,6 +39,7 @@ #include #include #include +#include #ifdef _KERNEL #include #endif diff --git a/sys/contrib/openzfs/module/zfs/vdev.c b/sys/contrib/openzfs/module/zfs/vdev.c index 553e470ad461..ad4f3efb87b1 100644 --- a/sys/contrib/openzfs/module/zfs/vdev.c +++ b/sys/contrib/openzfs/module/zfs/vdev.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011, 2020 by Delphix. All rights reserved. + * Copyright (c) 2011, 2021 by Delphix. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome @@ -4170,6 +4170,9 @@ vdev_clear(spa_t *spa, vdev_t *vd) vd->vdev_parent->vdev_ops == &vdev_spare_ops && vd->vdev_parent->vdev_child[0] == vd) vd->vdev_unspare = B_TRUE; + + /* Clear recent error events cache (i.e. duplicate events tracking) */ + zfs_ereport_clear(spa, vd); } boolean_t diff --git a/sys/contrib/openzfs/module/zfs/vdev_indirect.c b/sys/contrib/openzfs/module/zfs/vdev_indirect.c index b26d0993711a..416f4c54d8e8 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_indirect.c *** 418 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:37:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D25D5AAE87; Wed, 10 Mar 2021 09:37: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 4DwRmx6lSvz4lZ6; Wed, 10 Mar 2021 09:37: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 D63524D4F; Wed, 10 Mar 2021 09:37: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 12A9b598014294; Wed, 10 Mar 2021 09:37:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12A9b5kJ014293; Wed, 10 Mar 2021 09:37:05 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:37:05 GMT Message-Id: <202103100937.12A9b5kJ014293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 16f5a4ea9109 - stable/13 - Install links for zpool feature compat aliases MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 16f5a4ea910964e6c8410ecb079f7ee10ae6f63c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:37:06 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=16f5a4ea910964e6c8410ecb079f7ee10ae6f63c commit 16f5a4ea910964e6c8410ecb079f7ee10ae6f63c Author: Ryan Moeller AuthorDate: 2021-02-25 19:16:09 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:56:46 +0000 Install links for zpool feature compat aliases The alias links were missed when this feature was introduced to the FreeBSD build system in 10f57cb98fd61b2669640a84aa73ad118601f281. Reviewed by: mm Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D28925 (cherry picked from commit 2ae79aa362e7a2ee72657b39be64f1390158aaf6) --- cddl/share/zfs/compatibility.d/Makefile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cddl/share/zfs/compatibility.d/Makefile b/cddl/share/zfs/compatibility.d/Makefile index 6531430ef050..8bc18bcd6391 100644 --- a/cddl/share/zfs/compatibility.d/Makefile +++ b/cddl/share/zfs/compatibility.d/Makefile @@ -25,4 +25,25 @@ FILES= \ FILESDIR= ${SHAREDIR}/zfs/compatibility.d +LINKS= \ + ${FILESDIR}/compat-2018 ${FILESDIR}/2018 \ + ${FILESDIR}/compat-2019 ${FILESDIR}/2019 \ + ${FILESDIR}/compat-2020 ${FILESDIR}/2020 \ + ${FILESDIR}/compat-2021 ${FILESDIR}/2021 \ + ${FILESDIR}/freebsd-11.0 ${FILESDIR}/freebsd-11.1 \ + ${FILESDIR}/freebsd-11.0 ${FILESDIR}/freenas-11.0 \ + ${FILESDIR}/freebsd-11.2 ${FILESDIR}/freenas-11.2 \ + ${FILESDIR}/freebsd-11.3 ${FILESDIR}/freebsd-11.4 \ + ${FILESDIR}/freebsd-11.3 ${FILESDIR}/freebsd-12.0 \ + ${FILESDIR}/freebsd-11.3 ${FILESDIR}/freebsd-12.1 \ + ${FILESDIR}/freebsd-11.3 ${FILESDIR}/freebsd-12.2 \ + ${FILESDIR}/freebsd-11.3 ${FILESDIR}/freenas-11.3 \ + ${FILESDIR}/freenas-11.0 ${FILESDIR}/freenas-11.1 \ + ${FILESDIR}/openzfsonosx-1.9.3 ${FILESDIR}/openzfsonosx-1.9.4 \ + ${FILESDIR}/openzfs-2.0-freebsd ${FILESDIR}/truenas-12.0 \ + ${FILESDIR}/zol-0.7 ${FILESDIR}/ubuntu-18.04 \ + ${FILESDIR}/zol-0.8 ${FILESDIR}/ubuntu-20.04 + +LINKMODE= ${NOBINMODE} + .include From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:37:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 960395AAF0D; Wed, 10 Mar 2021 09:37: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 4DwRnV3kBdz4lrv; Wed, 10 Mar 2021 09:37: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 70A684E4A; Wed, 10 Mar 2021 09:37: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 12A9bYLe014474; Wed, 10 Mar 2021 09:37:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12A9bY6O014473; Wed, 10 Mar 2021 09:37:34 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:37:34 GMT Message-Id: <202103100937.12A9bY6O014473@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: ee36544bd811 - stable/13 - zfs: add missing checks for unsupported features MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ee36544bd8113595dc15034cae2dfa83a7014751 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:37:34 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=ee36544bd8113595dc15034cae2dfa83a7014751 commit ee36544bd8113595dc15034cae2dfa83a7014751 Author: Martin Matuska AuthorDate: 2021-02-26 21:52:41 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:57:03 +0000 zfs: add missing checks for unsupported features After the merge of OpenZFS master-9312e0fd1 it has become possible to import ZFS pools witn an active org.illumos:edonr feature on FreeBSD, leading to a panic. In addition, "zpool status" reported all pools without edonr as upgradable and "zpool upgrade -v" lists edonr in the list of upgradable features. This is an accepted but not yet included bugfix by upstream. Obtained from: https://github.com/openzfs/zfs/pull/11653 Differential Revision: https://reviews.freebsd.org/D28935 Reported by: garga (on freebsd-current@) Reviewed by: freqlabs (cherry picked from commit c170aa9f37e4ce9338a0f26e3e983f7123ea8c1a) --- sys/contrib/openzfs/cmd/zpool/zpool_main.c | 2 ++ sys/contrib/openzfs/cmd/ztest/ztest.c | 3 +++ sys/contrib/openzfs/lib/libzfs/libzfs_status.c | 2 ++ sys/contrib/openzfs/module/zcommon/zfeature_common.c | 2 ++ 4 files changed, 9 insertions(+) diff --git a/sys/contrib/openzfs/cmd/zpool/zpool_main.c b/sys/contrib/openzfs/cmd/zpool/zpool_main.c index 29252e6a24f4..e89eb3bea770 100644 --- a/sys/contrib/openzfs/cmd/zpool/zpool_main.c +++ b/sys/contrib/openzfs/cmd/zpool/zpool_main.c @@ -9030,6 +9030,8 @@ zpool_do_upgrade(int argc, char **argv) "---------------\n"); for (i = 0; i < SPA_FEATURES; i++) { zfeature_info_t *fi = &spa_feature_table[i]; + if (!fi->fi_zfs_mod_supported) + continue; const char *ro = (fi->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ? " (read-only compatible)" : ""; diff --git a/sys/contrib/openzfs/cmd/ztest/ztest.c b/sys/contrib/openzfs/cmd/ztest/ztest.c index cfa1290d78d1..1a030280704a 100644 --- a/sys/contrib/openzfs/cmd/ztest/ztest.c +++ b/sys/contrib/openzfs/cmd/ztest/ztest.c @@ -7592,6 +7592,9 @@ ztest_init(ztest_shared_t *zs) for (i = 0; i < SPA_FEATURES; i++) { char *buf; + if (!spa_feature_table[i].fi_zfs_mod_supported) + continue; + /* * 75% chance of using the log space map feature. We want ztest * to exercise both the code paths that use the log space map diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_status.c b/sys/contrib/openzfs/lib/libzfs/libzfs_status.c index fadae9388ac1..5e5cb5f5d440 100644 --- a/sys/contrib/openzfs/lib/libzfs/libzfs_status.c +++ b/sys/contrib/openzfs/lib/libzfs/libzfs_status.c @@ -482,6 +482,8 @@ check_status(nvlist_t *config, boolean_t isimport, return (ZPOOL_STATUS_COMPATIBILITY_ERR); for (i = 0; i < SPA_FEATURES; i++) { zfeature_info_t *fi = &spa_feature_table[i]; + if (!fi->fi_zfs_mod_supported) + continue; if (pool_features[i] && !nvlist_exists(feat, fi->fi_guid)) return (ZPOOL_STATUS_FEAT_DISABLED); diff --git a/sys/contrib/openzfs/module/zcommon/zfeature_common.c b/sys/contrib/openzfs/module/zcommon/zfeature_common.c index e95a85e89ba2..fc0e09605eef 100644 --- a/sys/contrib/openzfs/module/zcommon/zfeature_common.c +++ b/sys/contrib/openzfs/module/zcommon/zfeature_common.c @@ -100,6 +100,8 @@ zfeature_is_supported(const char *guid) for (spa_feature_t i = 0; i < SPA_FEATURES; i++) { zfeature_info_t *feature = &spa_feature_table[i]; + if (!feature->fi_zfs_mod_supported) + continue; if (strcmp(guid, feature->fi_guid) == 0) return (B_TRUE); } From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:37:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B65575AB08C; Wed, 10 Mar 2021 09:37: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 4DwRnk2zsSz4ly8; Wed, 10 Mar 2021 09:37: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 EEAE5518B; Wed, 10 Mar 2021 09: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 12A9bhkQ014598; Wed, 10 Mar 2021 09:37:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12A9bh33014597; Wed, 10 Mar 2021 09:37:43 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:37:43 GMT Message-Id: <202103100937.12A9bh33014597@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 9629ecfeefb3 - stable/13 - zfs: add missing seqc write begin/end around zfs_acl_chown_setattr MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9629ecfeefb3c3c89bafabb8e253d4dc98363f45 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:37:46 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=9629ecfeefb3c3c89bafabb8e253d4dc98363f45 commit 9629ecfeefb3c3c89bafabb8e253d4dc98363f45 Author: Mateusz Guzik AuthorDate: 2021-02-27 22:26:20 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:57:25 +0000 zfs: add missing seqc write begin/end around zfs_acl_chown_setattr It happens to trip over an assert but does not matter for correctness at this time. However, do it for future proofing. Reported by: avg (cherry picked from commit 1d8510c1a64d61a85c74c8b02fb12e6f31ede5a1) --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 2 ++ 1 file changed, 2 insertions(+) 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 d5f0da9ecd4b..8172916c4329 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 @@ -2756,7 +2756,9 @@ zfs_setattr(znode_t *zp, vattr_t *vap, int flags, cred_t *cr) err = zfs_acl_chown_setattr(zp); ASSERT(err == 0); if (attrzp) { + vn_seqc_write_begin(ZTOV(attrzp)); err = zfs_acl_chown_setattr(attrzp); + vn_seqc_write_end(ZTOV(attrzp)); ASSERT(err == 0); } } From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:37:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AE1A5AAF23; Wed, 10 Mar 2021 09:37: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 4DwRnr4YPDz4m84; Wed, 10 Mar 2021 09:37: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 F09F35136; Wed, 10 Mar 2021 09:37: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 12A9bpOw014725; Wed, 10 Mar 2021 09:37:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12A9bpaZ014724; Wed, 10 Mar 2021 09:37:51 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:37:51 GMT Message-Id: <202103100937.12A9bpaZ014724@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 603f1c3da48c - stable/13 - openzfs: attach pam_zfs_key to build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 603f1c3da48c938c4e556760b771fc1a29635b7d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:37:55 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=603f1c3da48c938c4e556760b771fc1a29635b7d commit 603f1c3da48c938c4e556760b771fc1a29635b7d Author: Greg V AuthorDate: 2021-03-02 11:01:14 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:57:42 +0000 openzfs: attach pam_zfs_key to build This PAM module allows unlocking encrypted user home datasets when logging in (and changing passphrase when changing the account password), see https://github.com/openzfs/zfs/pull/9903 Also supposed to unload the key when the last session for the user is done, but there are EBUSY issues: https://github.com/openzfs/zfs/issues/11222#issuecomment-731897858 Submitted by: Greg V Reviewed by: mm Differential Revision: https://reviews.freebsd.org/D28018 (cherry picked from commit ee21ee1572d40a3b74f18638dae38c1a9ad1e9e3) --- cddl/lib/Makefile | 7 ++++++- cddl/lib/pam_zfs_key/Makefile | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/cddl/lib/Makefile b/cddl/lib/Makefile index 2f360a8684a2..ae6862f70443 100644 --- a/cddl/lib/Makefile +++ b/cddl/lib/Makefile @@ -17,7 +17,8 @@ SUBDIR= drti \ ${_libzfs} \ ${_libzfsbootenv} \ ${_libzpool} \ - ${_libzutil} + ${_libzutil} \ + ${_pam_zfs_key} SUBDIR.${MK_TESTS}+= tests @@ -30,6 +31,9 @@ _libzutil= libzutil _libzfsbootenv= libzfsbootenv _libzpool= libzpool _libtpool= libtpool +.if ${MK_OPENSSL} != "no" +_pam_zfs_key= pam_zfs_key +.endif .endif SUBDIR_DEPEND_libctf= libspl @@ -41,6 +45,7 @@ SUBDIR_DEPEND_libzfs= libavl libnvpair libumem libuutil libzfs_core libzutil SUBDIR_DEPEND_libzpool= libavl libnvpair libumem libicp SUBDIR_DEPEND_libzutil= libavl libtpool SUBDIR_DEPEND_libzfsbootenv= libzfs libnvpair +SUBDIR_DEPEND_pam_zfs_key= libnvpair libuutil libzfs libzfs_core SUBDIR_PARALLEL= diff --git a/cddl/lib/pam_zfs_key/Makefile b/cddl/lib/pam_zfs_key/Makefile new file mode 100644 index 000000000000..cf43802090dd --- /dev/null +++ b/cddl/lib/pam_zfs_key/Makefile @@ -0,0 +1,28 @@ +.PATH: ${SRCTOP}/sys/contrib/openzfs/contrib/pam_zfs_key +.PATH: ${SRCTOP}/sys/contrib/openzfs/include + +PACKAGE= utilities +LIB= pam_zfs_key + +SHLIBDIR?= /usr/lib + +LIBADD= zfs zfs_core nvpair uutil crypto + +SRCS= pam_zfs_key.c + +WARNS?= 2 +CSTD= c99 +CFLAGS+= -DIN_BASE +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/ +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include +CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h +CFLAGS+= -DHAVE_ISSETUGID +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs +CFLAGS+= -DRUNSTATEDIR=\"/var/run\" + +.include "../../lib/libpam/modules/Makefile.inc" +.include From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:38:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7D865AAF29; Wed, 10 Mar 2021 09:38: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 4DwRp32p3Bz4mN4; Wed, 10 Mar 2021 09:38: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 5F0D04E4B; Wed, 10 Mar 2021 09:38: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 12A9c29O014858; Wed, 10 Mar 2021 09:38:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12A9c2o7014857; Wed, 10 Mar 2021 09:38:02 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:38:02 GMT Message-Id: <202103100938.12A9c2o7014857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: f2d3322c4511 - stable/13 - zfs: merge OpenZFS master-bedbc13da MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f2d3322c451180acca945aae2a5f1e334c7edd1d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:38:05 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=f2d3322c451180acca945aae2a5f1e334c7edd1d commit f2d3322c451180acca945aae2a5f1e334c7edd1d Author: Martin Matuska AuthorDate: 2021-03-03 01:15:33 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:58:07 +0000 zfs: merge OpenZFS master-bedbc13da Notable upstream commits: 8e43fa12c Fix vdev_rebuild_thread deadlock 03ef8f09e Add missing checks for unsupported features 2e160dee9 Fix assert in FreeBSD-specific dmu_read_pages bedbc13da Cancel TRIM / initialize on FAULTED non-writeable vdevs Obtained from: OpenZFS (cherry picked from commit caed7b1c399de04279822028e15b36367e84232f) --- sys/contrib/openzfs/cmd/vdev_id/vdev_id | 12 ++- sys/contrib/openzfs/cmd/zpool/Makefile.am | 2 +- sys/contrib/openzfs/config/kernel-bio.m4 | 29 ++++++++ .../openzfs/config/kernel-generic_io_acct.m4 | 69 +++++++++++------ sys/contrib/openzfs/configure.ac | 1 + .../include/os/linux/kernel/linux/blkdev_compat.h | 8 +- sys/contrib/openzfs/include/sys/dsl_synctask.h | 9 ++- sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c | 9 +++ .../openzfs/man/man5/zfs-module-parameters.5 | 2 +- .../openzfs/module/os/linux/zfs/vdev_disk.c | 4 + .../openzfs/module/os/linux/zfs/zfs_ioctl_os.c | 2 +- sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c | 4 + sys/contrib/openzfs/module/zfs/spa_misc.c | 27 ++++--- sys/contrib/openzfs/module/zfs/zfs_ioctl.c | 4 +- sys/contrib/openzfs/tests/runfiles/common.run | 2 +- .../openzfs/tests/zfs-tests/cmd/Makefile.am | 1 + .../tests/zfs-tests/cmd/send_doall/.gitignore | 1 + .../tests/zfs-tests/cmd/send_doall/Makefile.am | 11 +++ .../tests/zfs-tests/cmd/send_doall/send_doall.c | 87 ++++++++++++++++++++++ .../openzfs/tests/zfs-tests/include/commands.cfg | 1 + .../zpool_trim/zpool_trim_start_and_cancel_pos.ksh | 22 +++--- .../zfs-tests/tests/functional/rsend/Makefile.am | 4 +- .../tests/functional/rsend/send_doall.ksh | 67 +++++++++++++++++ 23 files changed, 319 insertions(+), 59 deletions(-) diff --git a/sys/contrib/openzfs/cmd/vdev_id/vdev_id b/sys/contrib/openzfs/cmd/vdev_id/vdev_id index 95a4e483b876..8a379a72690e 100755 --- a/sys/contrib/openzfs/cmd/vdev_id/vdev_id +++ b/sys/contrib/openzfs/cmd/vdev_id/vdev_id @@ -285,7 +285,9 @@ sas_handler() { # we have to append the -part suffix directly in the # helper. if [ "$DEVTYPE" != "partition" ] ; then - PART=$(echo "$DM_NAME" | awk -Fp '/p/{print "-part"$2}') + # Match p[number], remove the 'p' and prepend "-part" + PART=$(echo "$DM_NAME" | + awk 'match($0,/p[0-9]+$/) {print "-part"substr($0,RSTART+1,RLENGTH-1)}') fi # Strip off partition information. @@ -499,7 +501,9 @@ scsi_handler() { # we have to append the -part suffix directly in the # helper. if [ "$DEVTYPE" != "partition" ] ; then - PART=$(echo "$DM_NAME" | awk -Fp '/p/{print "-part"$2}') + # Match p[number], remove the 'p' and prepend "-part" + PART=$(echo "$DM_NAME" | + awk 'match($0,/p[0-9]+$/) {print "-part"substr($0,RSTART+1,RLENGTH-1)}') fi # Strip off partition information. @@ -648,7 +652,9 @@ alias_handler () { DM_PART= if echo "$DM_NAME" | grep -q -E 'p[0-9][0-9]*$' ; then if [ "$DEVTYPE" != "partition" ] ; then - DM_PART=$(echo "$DM_NAME" | awk -Fp '/p/{print "-part"$2}') + # Match p[number], remove the 'p' and prepend "-part" + DM_PART=$(echo "$DM_NAME" | + awk 'match($0,/p[0-9]+$/) {print "-part"substr($0,RSTART+1,RLENGTH-1)}') fi fi diff --git a/sys/contrib/openzfs/cmd/zpool/Makefile.am b/sys/contrib/openzfs/cmd/zpool/Makefile.am index d47051e4fe50..abfa940c3d72 100644 --- a/sys/contrib/openzfs/cmd/zpool/Makefile.am +++ b/sys/contrib/openzfs/cmd/zpool/Makefile.am @@ -179,5 +179,5 @@ install-data-hook: ln -s "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \ done for l in $(zpoolcompatlinks); do \ - (cd "$(DESTDIR)$(zpoolcompatdir)"; ln -s $${l} ); \ + (cd "$(DESTDIR)$(zpoolcompatdir)"; ln -sf $${l} ); \ done diff --git a/sys/contrib/openzfs/config/kernel-bio.m4 b/sys/contrib/openzfs/config/kernel-bio.m4 index 0c533531dceb..d8692bd39999 100644 --- a/sys/contrib/openzfs/config/kernel-bio.m4 +++ b/sys/contrib/openzfs/config/kernel-bio.m4 @@ -369,6 +369,33 @@ AC_DEFUN([ZFS_AC_KERNEL_BLKG_TRYGET], [ ]) ]) +dnl # +dnl # Linux 5.12 API, +dnl # +dnl # The Linux 5.12 kernel updated struct bio to create a new bi_bdev member +dnl # and bio->bi_disk was moved to bio->bi_bdev->bd_disk +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_BDEV_DISK], [ + ZFS_LINUX_TEST_SRC([bio_bdev_disk], [ + #include + #include + ],[ + struct bio *b = NULL; + struct gendisk *d = b->bi_bdev->bd_disk; + blk_register_queue(d); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_BDEV_DISK], [ + AC_MSG_CHECKING([whether bio->bi_bdev->bd_disk exists]) + ZFS_LINUX_TEST_RESULT([bio_bdev_disk], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_BIO_BDEV_DISK, 1, [bio->bi_bdev->bd_disk exists]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ ZFS_AC_KERNEL_SRC_REQ ZFS_AC_KERNEL_SRC_BIO_OPS @@ -379,6 +406,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO], [ ZFS_AC_KERNEL_SRC_BIO_SUBMIT_BIO ZFS_AC_KERNEL_SRC_BIO_CURRENT_BIO_LIST ZFS_AC_KERNEL_SRC_BLKG_TRYGET + ZFS_AC_KERNEL_SRC_BIO_BDEV_DISK ]) AC_DEFUN([ZFS_AC_KERNEL_BIO], [ @@ -400,4 +428,5 @@ AC_DEFUN([ZFS_AC_KERNEL_BIO], [ ZFS_AC_KERNEL_BIO_SUBMIT_BIO ZFS_AC_KERNEL_BIO_CURRENT_BIO_LIST ZFS_AC_KERNEL_BLKG_TRYGET + ZFS_AC_KERNEL_BIO_BDEV_DISK ]) diff --git a/sys/contrib/openzfs/config/kernel-generic_io_acct.m4 b/sys/contrib/openzfs/config/kernel-generic_io_acct.m4 index e4ab503d5e1c..0f4381db4c5e 100644 --- a/sys/contrib/openzfs/config/kernel-generic_io_acct.m4 +++ b/sys/contrib/openzfs/config/kernel-generic_io_acct.m4 @@ -2,6 +2,17 @@ dnl # dnl # Check for generic io accounting interface. dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ + ZFS_LINUX_TEST_SRC([disk_io_acct], [ + #include + ], [ + struct gendisk *disk = NULL; + struct bio *bio = NULL; + unsigned long start_time; + + start_time = disk_start_io_acct(disk, bio_sectors(bio), bio_op(bio)); + disk_end_io_acct(disk, bio_op(bio), start_time); + ]) + ZFS_LINUX_TEST_SRC([bio_io_acct], [ #include ], [ @@ -39,48 +50,62 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT], [ AC_DEFUN([ZFS_AC_KERNEL_GENERIC_IO_ACCT], [ dnl # - dnl # 5.7 API, + dnl # 5.12 API, dnl # - dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers. + dnl # bio_start_io_acct() and bio_end_io_acct() became GPL-exported + dnl # so use disk_start_io_acct() and disk_end_io_acct() instead dnl # - AC_MSG_CHECKING([whether generic bio_*_io_acct() are available]) - ZFS_LINUX_TEST_RESULT([bio_io_acct], [ + AC_MSG_CHECKING([whether generic disk_*_io_acct() are available]) + ZFS_LINUX_TEST_RESULT([disk_io_acct], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available]) + AC_DEFINE(HAVE_DISK_IO_ACCT, 1, [disk_*_io_acct() available]) ], [ AC_MSG_RESULT(no) dnl # - dnl # 4.14 API, + dnl # 5.7 API, dnl # - dnl # generic_start_io_acct/generic_end_io_acct now require - dnl # request_queue to be provided. No functional changes, - dnl # but preparation for inflight accounting. + dnl # Added bio_start_io_acct() and bio_end_io_acct() helpers. dnl # - AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args]) - ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args], - [generic_start_io_acct], [block/bio.c], [ + AC_MSG_CHECKING([whether generic bio_*_io_acct() are available]) + ZFS_LINUX_TEST_RESULT([bio_io_acct], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1, - [generic_*_io_acct() 4 arg available]) + AC_DEFINE(HAVE_BIO_IO_ACCT, 1, [bio_*_io_acct() available]) ], [ AC_MSG_RESULT(no) dnl # - dnl # 3.19 API addition + dnl # 4.14 API, dnl # - dnl # torvalds/linux@394ffa50 allows us to increment - dnl # iostat counters without generic_make_request(). + dnl # generic_start_io_acct/generic_end_io_acct now require + dnl # request_queue to be provided. No functional changes, + dnl # but preparation for inflight accounting. dnl # - AC_MSG_CHECKING( - [whether generic_*_io_acct wants 3 args]) - ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args], + AC_MSG_CHECKING([whether generic_*_io_acct wants 4 args]) + ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_4args], [generic_start_io_acct], [block/bio.c], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1, - [generic_*_io_acct() 3 arg available]) + AC_DEFINE(HAVE_GENERIC_IO_ACCT_4ARG, 1, + [generic_*_io_acct() 4 arg available]) ], [ AC_MSG_RESULT(no) + + dnl # + dnl # 3.19 API addition + dnl # + dnl # torvalds/linux@394ffa50 allows us to increment + dnl # iostat counters without generic_make_request(). + dnl # + AC_MSG_CHECKING( + [whether generic_*_io_acct wants 3 args]) + ZFS_LINUX_TEST_RESULT_SYMBOL([generic_acct_3args], + [generic_start_io_acct], [block/bio.c], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GENERIC_IO_ACCT_3ARG, 1, + [generic_*_io_acct() 3 arg available]) + ], [ + AC_MSG_RESULT(no) + ]) ]) ]) ]) diff --git a/sys/contrib/openzfs/configure.ac b/sys/contrib/openzfs/configure.ac index 4520a290a9a5..b2d88554ed7d 100644 --- a/sys/contrib/openzfs/configure.ac +++ b/sys/contrib/openzfs/configure.ac @@ -230,6 +230,7 @@ AC_CONFIG_FILES([ tests/zfs-tests/cmd/readmmap/Makefile tests/zfs-tests/cmd/rename_dir/Makefile tests/zfs-tests/cmd/rm_lnkcnt_zero_file/Makefile + tests/zfs-tests/cmd/send_doall/Makefile tests/zfs-tests/cmd/stride_dd/Makefile tests/zfs-tests/cmd/threadsappend/Makefile tests/zfs-tests/cmd/user_ns_exec/Makefile diff --git a/sys/contrib/openzfs/include/os/linux/kernel/linux/blkdev_compat.h b/sys/contrib/openzfs/include/os/linux/kernel/linux/blkdev_compat.h index e41b248b0405..ee066537b900 100644 --- a/sys/contrib/openzfs/include/os/linux/kernel/linux/blkdev_compat.h +++ b/sys/contrib/openzfs/include/os/linux/kernel/linux/blkdev_compat.h @@ -520,7 +520,9 @@ blk_generic_start_io_acct(struct request_queue *q __attribute__((unused)), struct gendisk *disk __attribute__((unused)), int rw __attribute__((unused)), struct bio *bio) { -#if defined(HAVE_BIO_IO_ACCT) +#if defined(HAVE_DISK_IO_ACCT) + return (disk_start_io_acct(disk, bio_sectors(bio), bio_op(bio))); +#elif defined(HAVE_BIO_IO_ACCT) return (bio_start_io_acct(bio)); #elif defined(HAVE_GENERIC_IO_ACCT_3ARG) unsigned long start_time = jiffies; @@ -541,7 +543,9 @@ blk_generic_end_io_acct(struct request_queue *q __attribute__((unused)), struct gendisk *disk __attribute__((unused)), int rw __attribute__((unused)), struct bio *bio, unsigned long start_time) { -#if defined(HAVE_BIO_IO_ACCT) +#if defined(HAVE_DISK_IO_ACCT) + disk_end_io_acct(disk, bio_op(bio), start_time); +#elif defined(HAVE_BIO_IO_ACCT) bio_end_io_acct(bio, start_time); #elif defined(HAVE_GENERIC_IO_ACCT_3ARG) generic_end_io_acct(rw, &disk->part0, start_time); diff --git a/sys/contrib/openzfs/include/sys/dsl_synctask.h b/sys/contrib/openzfs/include/sys/dsl_synctask.h index 0bb602e8f7ff..5a5b306419f1 100644 --- a/sys/contrib/openzfs/include/sys/dsl_synctask.h +++ b/sys/contrib/openzfs/include/sys/dsl_synctask.h @@ -41,10 +41,11 @@ typedef void (dsl_sigfunc_t)(void *, dmu_tx_t *); typedef enum zfs_space_check { /* - * Normal space check: if there is less than 3.2% free space, - * the operation will fail. Operations which are logically - * creating things should use this (e.g. "zfs create", "zfs snapshot"). - * User writes (via the ZPL / ZVOL) also fail at this point. + * Normal space check: if there is less than 3.2% free space (bounded + * by spa_max_slop), the operation will fail. Operations which are + * logically creating things should use this (e.g. "zfs create", "zfs + * snapshot"). User writes (via the ZPL / ZVOL) also fail at this + * point. */ ZFS_SPACE_CHECK_NORMAL, diff --git a/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c b/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c index 62a94264494f..1e3a0bf5618a 100644 --- a/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c +++ b/sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c @@ -321,6 +321,15 @@ send_iterate_snap(zfs_handle_t *zhp, void *arg) } if (!sd->recursive) { + + /* + * To allow a doall stream to work properly + * with a NULL fromsnap + */ + if (sd->doall && sd->fromsnap == NULL && !sd->seenfrom) { + sd->seenfrom = B_TRUE; + } + if (!sd->seenfrom && isfromsnap) { sd->seenfrom = B_TRUE; zfs_close(zhp); diff --git a/sys/contrib/openzfs/man/man5/zfs-module-parameters.5 b/sys/contrib/openzfs/man/man5/zfs-module-parameters.5 index 8fec44dd37e5..d68e85fa078d 100644 --- a/sys/contrib/openzfs/man/man5/zfs-module-parameters.5 +++ b/sys/contrib/openzfs/man/man5/zfs-module-parameters.5 @@ -1238,7 +1238,7 @@ amount of memory. When the limit is exceeded, the ioctl fails with EINVAL and a description of the error is sent to the zfs-dbgmsg log. This parameter should not need to be touched under normal circumstances. On FreeBSD, the default is based on the system limit on user wired memory. On Linux, the default is -\fBKMALLOC_MAX_SIZE\fR . +\fB128MB\fR. .sp Default value: \fB0\fR (kernel decides) .RE diff --git a/sys/contrib/openzfs/module/os/linux/zfs/vdev_disk.c b/sys/contrib/openzfs/module/os/linux/zfs/vdev_disk.c index b373f2c2e83c..ff71ef4cd065 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/vdev_disk.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/vdev_disk.c @@ -494,7 +494,11 @@ vdev_blkg_tryget(struct blkcg_gq *blkg) static inline void vdev_bio_associate_blkg(struct bio *bio) { +#if defined(HAVE_BIO_BDEV_DISK) + struct request_queue *q = bio->bi_bdev->bd_disk->queue; +#else struct request_queue *q = bio->bi_disk->queue; +#endif ASSERT3P(q, !=, NULL); ASSERT3P(bio->bi_blkg, ==, NULL); diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zfs_ioctl_os.c b/sys/contrib/openzfs/module/os/linux/zfs/zfs_ioctl_os.c index b88e0497d000..6f5cff1770e1 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_ioctl_os.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_ioctl_os.c @@ -209,7 +209,7 @@ zfs_max_nvlist_src_size_os(void) if (zfs_max_nvlist_src_size != 0) return (zfs_max_nvlist_src_size); - return (KMALLOC_MAX_SIZE); + return (MIN(ptob(zfs_totalram_pages) / 4, 128 * 1024 * 1024)); } void diff --git a/sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c b/sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c index 0caf31307718..0d62b1490702 100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c @@ -307,7 +307,11 @@ zvol_request(struct request_queue *q, struct bio *bio) #endif { #ifdef HAVE_SUBMIT_BIO_IN_BLOCK_DEVICE_OPERATIONS +#if defined(HAVE_BIO_BDEV_DISK) + struct request_queue *q = bio->bi_bdev->bd_disk->queue; +#else struct request_queue *q = bio->bi_disk->queue; +#endif #endif zvol_state_t *zv = q->queuedata; fstrans_cookie_t cookie = spl_fstrans_mark(); diff --git a/sys/contrib/openzfs/module/zfs/spa_misc.c b/sys/contrib/openzfs/module/zfs/spa_misc.c index 5d45e5a21159..0dacf9027b27 100644 --- a/sys/contrib/openzfs/module/zfs/spa_misc.c +++ b/sys/contrib/openzfs/module/zfs/spa_misc.c @@ -347,13 +347,14 @@ int spa_asize_inflation = 24; /* * Normally, we don't allow the last 3.2% (1/(2^spa_slop_shift)) of space in - * the pool to be consumed. This ensures that we don't run the pool - * completely out of space, due to unaccounted changes (e.g. to the MOS). - * It also limits the worst-case time to allocate space. If we have less than - * this amount of free space, most ZPL operations (e.g. write, create) will - * return ENOSPC. The ZIL metaslabs (spa_embedded_log_class) are also part of - * this 3.2% of space which can't be consumed by normal writes; the slop space - * "proper" (spa_get_slop_space()) is decreased by the embedded log space. + * the pool to be consumed (bounded by spa_max_slop). This ensures that we + * don't run the pool completely out of space, due to unaccounted changes (e.g. + * to the MOS). It also limits the worst-case time to allocate space. If we + * have less than this amount of free space, most ZPL operations (e.g. write, + * create) will return ENOSPC. The ZIL metaslabs (spa_embedded_log_class) are + * also part of this 3.2% of space which can't be consumed by normal writes; + * the slop space "proper" (spa_get_slop_space()) is decreased by the embedded + * log space. * * Certain operations (e.g. file removal, most administrative actions) can * use half the slop space. They will only return ENOSPC if less than half @@ -376,10 +377,15 @@ int spa_asize_inflation = 24; * 3.2%, in an effort to have it be at least spa_min_slop (128MB), * but we never allow it to be more than half the pool size. * + * Further, on very large pools, the slop space will be smaller than + * 3.2%, to avoid reserving much more space than we actually need; bounded + * by spa_max_slop (128GB). + * * See also the comments in zfs_space_check_t. */ int spa_slop_shift = 5; -uint64_t spa_min_slop = 128 * 1024 * 1024; +uint64_t spa_min_slop = 128ULL * 1024 * 1024; +uint64_t spa_max_slop = 128ULL * 1024 * 1024 * 1024; int spa_allocators = 4; @@ -1781,7 +1787,8 @@ spa_get_worst_case_asize(spa_t *spa, uint64_t lsize) /* * Return the amount of slop space in bytes. It is typically 1/32 of the pool * (3.2%), minus the embedded log space. On very small pools, it may be - * slightly larger than this. The embedded log space is not included in + * slightly larger than this. On very large pools, it will be capped to + * the value of spa_max_slop. The embedded log space is not included in * spa_dspace. By subtracting it, the usable space (per "zfs list") is a * constant 97% of the total space, regardless of metaslab size (assuming the * default spa_slop_shift=5 and a non-tiny pool). @@ -1792,7 +1799,7 @@ uint64_t spa_get_slop_space(spa_t *spa) { uint64_t space = spa_get_dspace(spa); - uint64_t slop = space >> spa_slop_shift; + uint64_t slop = MIN(space >> spa_slop_shift, spa_max_slop); /* * Subtract the embedded log space, but no more than half the (3.2%) diff --git a/sys/contrib/openzfs/module/zfs/zfs_ioctl.c b/sys/contrib/openzfs/module/zfs/zfs_ioctl.c index 922253469fba..5f291d067bef 100644 --- a/sys/contrib/openzfs/module/zfs/zfs_ioctl.c +++ b/sys/contrib/openzfs/module/zfs/zfs_ioctl.c @@ -3988,7 +3988,7 @@ zfs_ioc_pool_initialize(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl) fnvlist_free(vdev_errlist); spa_close(spa, FTAG); - return (total_errors > 0 ? EINVAL : 0); + return (total_errors > 0 ? SET_ERROR(EINVAL) : 0); } /* @@ -4073,7 +4073,7 @@ zfs_ioc_pool_trim(const char *poolname, nvlist_t *innvl, nvlist_t *outnvl) fnvlist_free(vdev_errlist); spa_close(spa, FTAG); - return (total_errors > 0 ? EINVAL : 0); + return (total_errors > 0 ? SET_ERROR(EINVAL) : 0); } /* diff --git a/sys/contrib/openzfs/tests/runfiles/common.run b/sys/contrib/openzfs/tests/runfiles/common.run index f86d0283bf37..fcb0fa6cd24f 100644 --- a/sys/contrib/openzfs/tests/runfiles/common.run +++ b/sys/contrib/openzfs/tests/runfiles/common.run @@ -809,7 +809,7 @@ tests = ['recv_dedup', 'recv_dedup_encrypted_zvol', 'rsend_001_pos', 'send_freeobjects', 'send_realloc_files', 'send_realloc_encrypted_files', 'send_spill_block', 'send_holds', 'send_hole_birth', 'send_mixed_raw', 'send-wR_encrypted_zvol', - 'send_partial_dataset', 'send_invalid'] + 'send_partial_dataset', 'send_invalid', 'send_doall'] tags = ['functional', 'rsend'] [tests/functional/scrub_mirror] diff --git a/sys/contrib/openzfs/tests/zfs-tests/cmd/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/cmd/Makefile.am index 7fe9a2c571f8..2b965ca70009 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/cmd/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/cmd/Makefile.am @@ -25,6 +25,7 @@ SUBDIRS = \ readmmap \ rename_dir \ rm_lnkcnt_zero_file \ + send_doall \ stride_dd \ threadsappend diff --git a/sys/contrib/openzfs/tests/zfs-tests/cmd/send_doall/.gitignore b/sys/contrib/openzfs/tests/zfs-tests/cmd/send_doall/.gitignore new file mode 100644 index 000000000000..6ba2e603f744 --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/cmd/send_doall/.gitignore @@ -0,0 +1 @@ +/send_doall diff --git a/sys/contrib/openzfs/tests/zfs-tests/cmd/send_doall/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/cmd/send_doall/Makefile.am new file mode 100644 index 000000000000..33a6b83122b8 --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/cmd/send_doall/Makefile.am @@ -0,0 +1,11 @@ +include $(top_srcdir)/config/Rules.am + +pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin + +pkgexec_PROGRAMS = send_doall + +send_doall_SOURCES = send_doall.c +send_doall_LDADD = \ + $(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(abs_top_builddir)/lib/libzfs/libzfs.la \ + $(abs_top_builddir)/lib/libnvpair/libnvpair.la diff --git a/sys/contrib/openzfs/tests/zfs-tests/cmd/send_doall/send_doall.c b/sys/contrib/openzfs/tests/zfs-tests/cmd/send_doall/send_doall.c new file mode 100644 index 000000000000..6f47df047478 --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/cmd/send_doall/send_doall.c @@ -0,0 +1,87 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Portions Copyright 2020 iXsystems, Inc. + */ + +/* + * Test a corner case : a "doall" send without children datasets. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include + +static void +usage(const char *name) +{ + fprintf(stderr, "usage: %s snap\n", name); + exit(EX_USAGE); +} + +int +main(int argc, char const * const argv[]) +{ + sendflags_t flags = { 0 }; + libzfs_handle_t *zhdl; + zfs_handle_t *zhp; + const char *tofull, *fsname, *tosnap, *p; + int error; + + if (argc != 2) + usage(argv[0]); + + tofull = argv[1]; + + p = strchr(tofull, '@'); + if (p == NULL) + usage(argv[0]); + tosnap = p + 1; + + fsname = strndup(tofull, p - tofull); + + zhdl = libzfs_init(); + if (zhdl == NULL) + errx(EX_OSERR, "libzfs_init(): %s", libzfs_error_init(errno)); + + zhp = zfs_open(zhdl, fsname, ZFS_TYPE_FILESYSTEM); + if (zhp == NULL) + err(EX_OSERR, "zfs_open(\"%s\")", fsname); + + flags.doall = B_TRUE; + + error = zfs_send(zhp, NULL, tosnap, &flags, + STDOUT_FILENO, NULL, NULL, NULL); + + zfs_close(zhp); + + libzfs_fini(zhdl); + free((void *)fsname); + + return (error); +} diff --git a/sys/contrib/openzfs/tests/zfs-tests/include/commands.cfg b/sys/contrib/openzfs/tests/zfs-tests/include/commands.cfg index 299653547759..a43ddd016fde 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/include/commands.cfg +++ b/sys/contrib/openzfs/tests/zfs-tests/include/commands.cfg @@ -217,6 +217,7 @@ export ZFSTEST_FILES='badsend readmmap rename_dir rm_lnkcnt_zero_file + send_doall threadsappend user_ns_exec xattrtest diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_start_and_cancel_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_start_and_cancel_pos.ksh index eaa4d90444b6..fbb0c291046c 100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_start_and_cancel_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_trim/zpool_trim_start_and_cancel_pos.ksh @@ -20,29 +20,29 @@ # . $STF_SUITE/include/libtest.shlib -. $STF_SUITE/tests/functional/cli_root/zpool_initialize/zpool_initialize.kshlib +. $STF_SUITE/tests/functional/cli_root/zpool_trim/zpool_trim.kshlib # # DESCRIPTION: -# Starting and stopping an initialize works. +# Starting and stopping a trim works. # # STRATEGY: # 1. Create a one-disk pool. -# 2. Start initializing and verify that initializing is active. -# 3. Cancel initializing and verify that initializing is not active. +# 2. Start trimming and verify that trimming is active. +# 3. Cancel trimming and verify that trimming is not active. # DISK1=${DISKS%% *} log_must zpool create -f $TESTPOOL $DISK1 -log_must zpool initialize $TESTPOOL +log_must zpool trim $TESTPOOL -[[ -z "$(initialize_progress $TESTPOOL $DISK1)" ]] && \ - log_fail "Initialize did not start" +[[ -z "$(trim_progress $TESTPOOL $DISK1)" ]] && \ + log_fail "TRIM did not start" -log_must zpool initialize -c $TESTPOOL +log_must zpool trim -c $TESTPOOL -[[ -z "$(initialize_progress $TESTPOOL $DISK1)" ]] || \ - log_fail "Initialize did not stop" +[[ -z "$(trim_progress $TESTPOOL $DISK1)" ]] || \ + log_fail "TRIM did not stop" -log_pass "Initialize start + cancel works" +log_pass "TRIM start + cancel works" diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/Makefile.am index 61be2ec1889d..94bdd2674517 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/Makefile.am @@ -53,7 +53,8 @@ dist_pkgdata_SCRIPTS = \ send_hole_birth.ksh \ send_invalid.ksh \ send_mixed_raw.ksh \ - send-wR_encrypted_zvol.ksh + send-wR_encrypted_zvol.ksh \ + send_doall.ksh dist_pkgdata_DATA = \ dedup.zsend.bz2 \ @@ -62,3 +63,4 @@ dist_pkgdata_DATA = \ fs.tar.gz \ rsend.cfg \ rsend.kshlib + diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_doall.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_doall.ksh new file mode 100755 index 000000000000..e5c3490b32cd --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/rsend/send_doall.ksh @@ -0,0 +1,67 @@ +#!/bin/ksh + +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2019 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/rsend/rsend.kshlib + +# +# Description: +# Verify send_doall stream is properly received +# +# Strategy: +# 1) Create a set of snapshots. +# 2) Send these snapshots (from origin to the last one) to a file using send_doall. +# 3) Receive the file to newfs to test if the stream is properly handled. +# + +verify_runnable "both" + +log_assert "Verify send_doall stream is correct" + +function cleanup +{ + rm -f $BACKDIR/fs@* + destroy_dataset $POOL/fs "-rR" + destroy_dataset $POOL/newfs "-rR" +} + +log_onexit cleanup + +log_must zfs create $POOL/fs +log_must zfs create $POOL/fs/child + +# Create 3 files and a snapshot between each file creation. +for i in {1..3}; do + file="/$POOL/fs/file$i" + log_must mkfile 16384 $file + + file="/$POOL/fs/child/file$i" + log_must mkfile 16384 $file + + log_must zfs snapshot -r $POOL/fs@snap$i +done + +# Snapshot the pool and send it to the new dataset. +log_must eval "send_doall $POOL/fs@snap3 >$BACKDIR/fs@snap3" +log_must eval "zfs recv $POOL/newfs < $BACKDIR/fs@snap3" + +zfs list $POOL/newfs/child +if [[ $? -eq 0 ]]; then + log_fail "Children dataset should not have been received" +fi + +log_pass "Verify send_doall stream is correct" From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:38:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04FA65AAE7C; Wed, 10 Mar 2021 09:38: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 4DwRpL3R0Bz4mLZ; Wed, 10 Mar 2021 09: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 9088B4F9A; Wed, 10 Mar 2021 09: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 12A9cGdM015000; Wed, 10 Mar 2021 09: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 12A9cGbk014999; Wed, 10 Mar 2021 09:38:16 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:38:16 GMT Message-Id: <202103100938.12A9cGbk014999@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 29805b312c77 - stable/13 - zfs: update openzfs version reference to bedbc13da MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 29805b312c7771a294fe41ff918bd75fa626d373 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:38:19 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=29805b312c7771a294fe41ff918bd75fa626d373 commit 29805b312c7771a294fe41ff918bd75fa626d373 Author: Martin Matuska AuthorDate: 2021-03-05 14:52:04 +0000 Commit: Martin Matuska CommitDate: 2021-03-10 01:58:21 +0000 zfs: update openzfs version reference to bedbc13da It was missed in the latest merge. (cherry picked from commit 6781b8a32e702c694d3f813959d326e36facc19f) --- sys/modules/zfs/zfs_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/modules/zfs/zfs_config.h b/sys/modules/zfs/zfs_config.h index 0ef2200d1940..ae5316a46f10 100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@ -734,7 +734,7 @@ /* #undef ZFS_IS_GPL_COMPATIBLE */ /* Define the project alias string. */ -#define ZFS_META_ALIAS "zfs-2.0.0-FreeBSD_gbf156c966" +#define ZFS_META_ALIAS "zfs-2.0.0-FreeBSD_gbedbc13da" /* Define the project author. */ #define ZFS_META_AUTHOR "OpenZFS" @@ -764,7 +764,7 @@ #define ZFS_META_NAME "zfs" /* Define the project release. */ -#define ZFS_META_RELEASE "FreeBSD_g9312e0fd1" +#define ZFS_META_RELEASE "FreeBSD_gbedbc13da" /* Define the project version. */ #define ZFS_META_VERSION "2.0.0" From owner-dev-commits-src-all@freebsd.org Wed Mar 10 09:52:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1492A5AB522; Wed, 10 Mar 2021 09:52: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 4DwS6h041cz4n9m; Wed, 10 Mar 2021 09:52: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 E95015178; Wed, 10 Mar 2021 09:52: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 12A9qRl4040118; Wed, 10 Mar 2021 09:52:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12A9qRKR040117; Wed, 10 Mar 2021 09:52:27 GMT (envelope-from git) Date: Wed, 10 Mar 2021 09:52:27 GMT Message-Id: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d1cbe79089868226625c12ef49f51214d79aa427 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 09:52:28 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d1cbe79089868226625c12ef49f51214d79aa427 commit d1cbe79089868226625c12ef49f51214d79aa427 Author: Hans Petter Selasky AuthorDate: 2021-03-10 09:50:01 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-10 09:51:04 +0000 Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/compat/linuxkpi/common/src/linux_compat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 2ad936311204..707c5e47512e 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2384,7 +2384,8 @@ linux_irq_handler(void *ent) { struct irq_ent *irqe; - linux_set_current(curthread); + if (linux_set_current_flags(curthread, M_NOWAIT)) + return; irqe = ent; irqe->handler(irqe->irq, irqe->arg); From owner-dev-commits-src-all@freebsd.org Wed Mar 10 10:04:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BE255ABBCB; Wed, 10 Mar 2021 10:04:59 +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 4DwSP66sczz4p1T; Wed, 10 Mar 2021 10:04:58 +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)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id EF803260185; Wed, 10 Mar 2021 11:04:56 +0100 (CET) Subject: Re: git: 1ae20f7c70ea - main - kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() To: John Baldwin , Kyle Evans , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202103091117.129BHOZa042851@gitrepo.freebsd.org> <3d67f7e4-c1fc-ca2c-8fc5-417dcf8e4145@FreeBSD.org> From: Hans Petter Selasky Message-ID: <4a923ee1-64a0-93ab-1e73-ff164d690bfc@selasky.org> Date: Wed, 10 Mar 2021 11:04:41 +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: <3d67f7e4-c1fc-ca2c-8fc5-417dcf8e4145@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4DwSP66sczz4p1T 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 10:04:59 -0000 On 3/9/21 6:33 PM, John Baldwin wrote: > On 3/9/21 3:17 AM, Kyle Evans wrote: >> The branch main has been updated by kevans: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=1ae20f7c70ea16fa8b702e409030e170df4f5c13 >> >> >> commit 1ae20f7c70ea16fa8b702e409030e170df4f5c13 >> Author:     Kyle Evans >> AuthorDate: 2021-03-08 06:16:27 +0000 >> Commit:     Kyle Evans >> CommitDate: 2021-03-09 11:16:39 +0000 >> >>      kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() >>      Simple condition flip; we wanted to panic here after >> epoch_trace_list(). >>      Reviewed by:    glebius, markj >>      MFC after:      3 days >>      Differential Revision:  https://reviews.freebsd.org/D29125 >> --- >>   sys/kern/kern_malloc.c | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c >> index 48383358e3ad..0d6f9dcfcab7 100644 >> --- a/sys/kern/kern_malloc.c >> +++ b/sys/kern/kern_malloc.c >> @@ -537,7 +537,7 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct >> malloc_type *mtp, >>   #ifdef EPOCH_TRACE >>               epoch_trace_list(curthread); >>   #endif >> -            KASSERT(1, >> +            KASSERT(0, >>                   ("malloc(M_WAITOK) with sleeping prohibited")); > > I would perhaps just use panic() directly under INVARIANTS instead of > KASSERT(false, ...) > > Either that or duplicate the condition and let the compiler deal with > avoiding checking > it twice, e.g.: > > #ifdef EPOCH_TRACE >      if (!THREAD_CAN_SLEEP()) >          epoc_trace_list(curthread); > #endif >      KASSERT(THREAD_CAN_SLEEP(), ("malloc(M_WAITOK) with sleeping > prohibited")); > Hi, Maybe the KASSERT() can just be a regular warning with backtrace. malloc() doesn't sleep unless there is no memory, would give developers more time to fix their bugs. --HPS From owner-dev-commits-src-all@freebsd.org Wed Mar 10 10:05:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B4095AB8D1; Wed, 10 Mar 2021 10:05:04 +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 4DwSPC34Vkz4nsl; Wed, 10 Mar 2021 10:05:03 +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 12AA4nxN037623 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 10 Mar 2021 12:04:52 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12AA4nxN037623 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12AA4niK037622; Wed, 10 Mar 2021 12:04:49 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 10 Mar 2021 12:04:49 +0200 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . Message-ID: References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202103100952.12A9qRKR040117@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: 4DwSPC34Vkz4nsl 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 10:05:04 -0000 On Wed, Mar 10, 2021 at 09:52:27AM +0000, Hans Petter Selasky wrote: > The branch main has been updated by hselasky: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d1cbe79089868226625c12ef49f51214d79aa427 > > commit d1cbe79089868226625c12ef49f51214d79aa427 > Author: Hans Petter Selasky > AuthorDate: 2021-03-10 09:50:01 +0000 > Commit: Hans Petter Selasky > CommitDate: 2021-03-10 09:51:04 +0000 > > Allocating the LinuxKPI current structure from an interrupt thread must be > done using the M_NOWAIT flag after 1ae20f7c70ea . > > MFC after: 1 week > Sponsored by: Mellanox Technologies // NVIDIA Networking > --- > sys/compat/linuxkpi/common/src/linux_compat.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c > index 2ad936311204..707c5e47512e 100644 > --- a/sys/compat/linuxkpi/common/src/linux_compat.c > +++ b/sys/compat/linuxkpi/common/src/linux_compat.c > @@ -2384,7 +2384,8 @@ linux_irq_handler(void *ent) > { > struct irq_ent *irqe; > > - linux_set_current(curthread); > + if (linux_set_current_flags(curthread, M_NOWAIT)) > + return; > > irqe = ent; > irqe->handler(irqe->irq, irqe->arg); This probably hangs machine instead of panicing. In low memory condition, you do not handle interrupt, which probably mean that the source is not silenced, and after EOI the same interrupt will be generated again. From owner-dev-commits-src-all@freebsd.org Wed Mar 10 10:09:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8B115ABCF9; Wed, 10 Mar 2021 10:09:43 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4DwSVb4Kkvz4pVc; Wed, 10 Mar 2021 10:09:43 +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)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 8967A260185; Wed, 10 Mar 2021 11:09:39 +0100 (CET) Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> From: Hans Petter Selasky Message-ID: <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> Date: Wed, 10 Mar 2021 11:09:23 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DwSVb4Kkvz4pVc 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 10:09:43 -0000 On 3/10/21 11:04 AM, Konstantin Belousov wrote: > This probably hangs machine instead of panicing. In low memory condition, > you do not handle interrupt, which probably mean that the source is not > silenced, and after EOI the same interrupt will be generated again. Hi, This usually happens during boot. Another possibility is to panic() there. I don't see so many options. --HPS From owner-dev-commits-src-all@freebsd.org Wed Mar 10 10:54:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B4E65ACDD4; Wed, 10 Mar 2021 10:54: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 4DwTTg70Gdz4rqJ; Wed, 10 Mar 2021 10:53: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 E33875977; Wed, 10 Mar 2021 10:53: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 12AArxOf019708; Wed, 10 Mar 2021 10:53:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AArx9X019707; Wed, 10 Mar 2021 10:53:59 GMT (envelope-from git) Date: Wed, 10 Mar 2021 10:53:59 GMT Message-Id: <202103101053.12AArx9X019707@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 9ba393f2ca0f - stable/13 - backlight: Fix incr/decr with percent value of 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9ba393f2ca0fd561c1fbf96f38eb014d7f883381 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 10:54:00 -0000 The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=9ba393f2ca0fd561c1fbf96f38eb014d7f883381 commit 9ba393f2ca0fd561c1fbf96f38eb014d7f883381 Author: David Schlachter AuthorDate: 2021-03-03 07:57:35 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-10 10:49:25 +0000 backlight: Fix incr/decr with percent value of 0 This now does nothing instead of incr/decr by 10% MFC After: 3 days PR: 253736 (cherry picked from commit 3b005d51bd0fe4d8d19fb2df4d470b6e8baebf16) --- usr.bin/backlight/backlight.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.bin/backlight/backlight.c b/usr.bin/backlight/backlight.c index 1dae0cfe5c62..9cf7a0912e95 100644 --- a/usr.bin/backlight/backlight.c +++ b/usr.bin/backlight/backlight.c @@ -98,7 +98,7 @@ main(int argc, char *argv[]) BACKLIGHTGETSTATUS, BACKLIGHTUPDATESTATUS, BACKLIGHTGETINFO}; - long percent = 0; + long percent = -1; const char *percent_error; uint32_t i; bool setname; @@ -188,15 +188,20 @@ main(int argc, char *argv[]) } break; case BACKLIGHT_SET_BRIGHTNESS: + if (percent == -1) + usage(); props.brightness = percent; if (ioctl(fd, BACKLIGHTUPDATESTATUS, &props) == -1) errx(1, "Cannot update the backlight device"); break; case BACKLIGHT_INCR: case BACKLIGHT_DECR: + if (percent == 0) + /* Avoid any ioctl if we don't have anything to do */ + break; if (ioctl(fd, BACKLIGHTGETSTATUS, &props) == -1) errx(1, "Cannot query the backlight device"); - percent = percent == 0 ? 10 : percent; + percent = percent == -1 ? 10 : percent; percent = action == BACKLIGHT_INCR ? percent : -percent; props.brightness += percent; if ((int)props.brightness < 0) From owner-dev-commits-src-all@freebsd.org Wed Mar 10 10:54:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C29F5ACEB5; Wed, 10 Mar 2021 10:54: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 4DwTTj0fDSz4sBh; Wed, 10 Mar 2021 10:54: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 07BE66206; Wed, 10 Mar 2021 10:54: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 12AAs0gK019730; Wed, 10 Mar 2021 10:54:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AAs0Dv019729; Wed, 10 Mar 2021 10:54:00 GMT (envelope-from git) Date: Wed, 10 Mar 2021 10:54:00 GMT Message-Id: <202103101054.12AAs0Dv019729@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: f21c0366f532 - stable/13 - backlight(8): Add note that with option it print the current brightness. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f21c0366f532888bec164717a93964610ab6baf6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 10:54:01 -0000 The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=f21c0366f532888bec164717a93964610ab6baf6 commit f21c0366f532888bec164717a93964610ab6baf6 Author: Emmanuel Vadot AuthorDate: 2021-03-03 08:00:42 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-10 10:49:31 +0000 backlight(8): Add note that with option it print the current brightness. MFC after: 3 days PR: 253737 (cherry picked from commit 1df30489a8f7083c98010c94d9ce522f9e8213dc) --- usr.bin/backlight/backlight.8 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.bin/backlight/backlight.8 b/usr.bin/backlight/backlight.8 index 8c3b634e152b..ce2d0e4b0325 100644 --- a/usr.bin/backlight/backlight.8 +++ b/usr.bin/backlight/backlight.8 @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 27, 2020 +.Dd March 03, 2021 .Dt BACKLIGHT 8 .Os .Sh NAME @@ -47,6 +47,9 @@ The .Nm utility can be used to configure brightness levels for registered backlights. .Pp +If call without any option it will print the current brightness level of the first +registered backlight. +.Pp The options are as follows: .Bl -tag -width "-f device" .It Fl f Ar device From owner-dev-commits-src-all@freebsd.org Wed Mar 10 11:54:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 195725AE322; Wed, 10 Mar 2021 11:54: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 4DwVqT0Cftz3C95; Wed, 10 Mar 2021 11:54: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 EE56A6E88; Wed, 10 Mar 2021 11:54: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 12ABsSlG098214; Wed, 10 Mar 2021 11:54:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12ABsSR0098213; Wed, 10 Mar 2021 11:54:28 GMT (envelope-from git) Date: Wed, 10 Mar 2021 11:54:28 GMT Message-Id: <202103101154.12ABsSR0098213@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 6eb60f5b7f7d - main - Use the word "LinuxKPI" instead of "Linux compatibility", to not confuse with user-space Linux compatibility support. No functional change. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6eb60f5b7f7df1a59de139260aebfa0aa5f6d79e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 11:54:29 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=6eb60f5b7f7df1a59de139260aebfa0aa5f6d79e commit 6eb60f5b7f7df1a59de139260aebfa0aa5f6d79e Author: Hans Petter Selasky AuthorDate: 2021-03-10 11:21:01 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-10 11:35:16 +0000 Use the word "LinuxKPI" instead of "Linux compatibility", to not confuse with user-space Linux compatibility support. No functional change. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/kern/kern_intr.c | 4 ++-- sys/sys/interrupt.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index af7c52c6b176..afaf8466a1df 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -783,8 +783,8 @@ intr_handler_barrier(struct intr_handler *handler) * Sleep until an ithread finishes executing an interrupt handler. * * XXX Doesn't currently handle interrupt filters or fast interrupt - * handlers. This is intended for compatibility with linux drivers - * only. Do not use in BSD code. + * handlers. This is intended for LinuxKPI drivers only. + * Do not use in BSD code. */ void _intr_drain(int irq) diff --git a/sys/sys/interrupt.h b/sys/sys/interrupt.h index f1770fe64b0b..56952e45fe75 100644 --- a/sys/sys/interrupt.h +++ b/sys/sys/interrupt.h @@ -190,7 +190,7 @@ int intr_event_resume_handler(void *cookie); int intr_getaffinity(int irq, int mode, void *mask); void *intr_handler_source(void *cookie); int intr_setaffinity(int irq, int mode, void *mask); -void _intr_drain(int irq); /* Linux compat only. */ +void _intr_drain(int irq); /* LinuxKPI only. */ int swi_add(struct intr_event **eventp, const char *name, driver_intr_t handler, void *arg, int pri, enum intr_type flags, void **cookiep); From owner-dev-commits-src-all@freebsd.org Wed Mar 10 11:57:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6BC15AE4B8; Wed, 10 Mar 2021 11:57:46 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) (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 4DwVvG27Hpz3CPp; Wed, 10 Mar 2021 11:57:46 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lj1-x235.google.com with SMTP id a17so25248419ljq.2; Wed, 10 Mar 2021 03:57: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=RTLQArsi/Hl0m7yp8cFzanZ4mLDILxLOMNivZaabkZM=; b=qbRy7xBn6BgVKipWSJw0tWmkm+yRy+6EoftBU9z8Q1GIZ4JRo4AjIQPy4izArHouIz sGn5HZrJcr8kUlATlncnu5TNM9mWFYNJYgvneesOL5ygWXcbkGBZEtYlqNUwB3T0MOzl EKpcaFJEP4PPBkM8wzxONl2urzEvo6FxBT7Bf9zy9SWISEiPE6mqaL1Dfw5Qkzjdr7Kb 7opsdw+3ik+kkCia3765JgvSuwO23Zd8t5vVzZ9x541Ba9Wd+W31BLaGNjosw8rwLD1J /BGzkNeZGAPB1DWHWMDUKu/7ZOXogqn66EOXbTjO5PG8jk2VCq3NgSCwBpnJGu7HMGgO BbGQ== 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=RTLQArsi/Hl0m7yp8cFzanZ4mLDILxLOMNivZaabkZM=; b=m78GFEIt6bIb+dvK/EqAgTyS8/ov4uDrrh+w+NIK+V06qBxmO+oJiaSBMC4CwuAZKn wKaTOW+QIjvtbjrIy+fJ+kKzmItCQ0DibqmPPKITA4tfRlnh8P0FPb47+QICvktLwykt eB8/yrY7a/0cer6r/ZW+p2quTz9Smw8cZajNe29Htn/wvPyYwWhZ78Iyf6wY4RD/TRsj oxjNo162zPylx6OgWh9aoPsCT4Gcha651/Q+n6sAXjEpOOfOJ6G/K7FdxGExo3Pw2O2d APkgfbomNYyUR+Jjyoyi/cQiBoNvXQqUs5dbqg2n9eusftsYtIZ+kFVTo69ADkmBcu8x eDxw== X-Gm-Message-State: AOAM530zSA7DOVooYVF54nAAMC5isQHbYlOzsCqIV4fPNJpg3DiQ+aEr /hU/cdxYYlbkmRp66cYAsq1fBlkKpreQm5OHE3i9fqRnlVw= X-Google-Smtp-Source: ABdhPJwC0+GmcxhlaFtb7Nng99Jh68g0RfBT4wMNoT0eCS7yfYKxAV4qCce3iSSFmu5zQF/aRnl7t/167YGaxhGlq+E= X-Received: by 2002:a2e:9b14:: with SMTP id u20mr1598050lji.463.1615377464661; Wed, 10 Mar 2021 03:57:44 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a2e:b54e:0:0:0:0:0 with HTTP; Wed, 10 Mar 2021 03:57:44 -0800 (PST) In-Reply-To: <202103091117.129BHOZa042851@gitrepo.freebsd.org> References: <202103091117.129BHOZa042851@gitrepo.freebsd.org> From: Mateusz Guzik Date: Wed, 10 Mar 2021 12:57:44 +0100 Message-ID: Subject: Re: git: 1ae20f7c70ea - main - kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() To: Kyle Evans 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: 4DwVvG27Hpz3CPp X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=qbRy7xBn; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::235 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.52 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::235:from]; TO_DN_SOME(0.00)[]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::235:from:127.0.2.255]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::235:from]; NEURAL_HAM_SHORT(-0.52)[-0.515]; NEURAL_HAM_LONG(-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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 11:57:47 -0000 There is something very wrong going on here. Key thing to note is that malloc is ultimately a wrapper around uma_zalloc. Whatever asserts you may want to add to malloc to catch problems sooner, should also present in uma. uma has the following: if (flags & M_WAITOK) { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "uma_zalloc_debug: zone \"%s\"", zone->uz_name); } This code used to execute prior to this commit and fail to catch the problems which got reported already. In other words: - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK is incomplete in terms of internals its internals - the above should be in malloc, perhaps after being abstracted into a an assert-helper - fixing witness deficiency will probably find a slew of new problems - this should remain as a warning (maybe rate-limited) for the foreseable future On 3/9/21, Kyle Evans wrote: > The branch main has been updated by kevans: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=1ae20f7c70ea16fa8b702e409030e170df4f5c13 > > commit 1ae20f7c70ea16fa8b702e409030e170df4f5c13 > Author: Kyle Evans > AuthorDate: 2021-03-08 06:16:27 +0000 > Commit: Kyle Evans > CommitDate: 2021-03-09 11:16:39 +0000 > > kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() > > Simple condition flip; we wanted to panic here after > epoch_trace_list(). > > Reviewed by: glebius, markj > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D29125 > --- > sys/kern/kern_malloc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c > index 48383358e3ad..0d6f9dcfcab7 100644 > --- a/sys/kern/kern_malloc.c > +++ b/sys/kern/kern_malloc.c > @@ -537,7 +537,7 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct > malloc_type *mtp, > #ifdef EPOCH_TRACE > epoch_trace_list(curthread); > #endif > - KASSERT(1, > + KASSERT(0, > ("malloc(M_WAITOK) with sleeping prohibited")); > } > } > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Wed Mar 10 12:31:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E3855AF4B7; Wed, 10 Mar 2021 12:31: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 4DwWdr0Q6gz3F3n; Wed, 10 Mar 2021 12:31: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 0155A7606; Wed, 10 Mar 2021 12:31: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 12ACVBOe048175; Wed, 10 Mar 2021 12:31:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12ACVBXA048161; Wed, 10 Mar 2021 12:31:11 GMT (envelope-from git) Date: Wed, 10 Mar 2021 12:31:11 GMT Message-Id: <202103101231.12ACVBXA048161@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: dfb33cb0ef48 - main - Allocating the LinuxKPI current structure from a software interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfb33cb0ef48084da84072244e8ca486dfcf3a96 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 12:31:12 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=dfb33cb0ef48084da84072244e8ca486dfcf3a96 commit dfb33cb0ef48084da84072244e8ca486dfcf3a96 Author: Hans Petter Selasky AuthorDate: 2021-03-10 12:26:09 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-10 12:27:40 +0000 Allocating the LinuxKPI current structure from a software interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/compat/linuxkpi/common/src/linux_compat.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 707c5e47512e..5f7e2664bee1 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -1913,9 +1913,15 @@ linux_timer_callback_wrapper(void *context) { struct timer_list *timer; - linux_set_current(curthread); - timer = context; + + if (linux_set_current_flags(curthread, M_NOWAIT)) { + /* try again later */ + callout_reset(&timer->callout, 1, + &linux_timer_callback_wrapper, timer); + return; + } + timer->function(timer->data); } From owner-dev-commits-src-all@freebsd.org Wed Mar 10 12:45:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68F505AFC1D; Wed, 10 Mar 2021 12: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 4DwWy92ZTtz3GMM; Wed, 10 Mar 2021 12: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 4B35074D8; Wed, 10 Mar 2021 12: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 12ACjLkK064811; Wed, 10 Mar 2021 12: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 12ACjLn7064810; Wed, 10 Mar 2021 12:45:21 GMT (envelope-from git) Date: Wed, 10 Mar 2021 12:45:21 GMT Message-Id: <202103101245.12ACjLn7064810@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: 953a7d7c61f3 - main - Arch64: Clear VFP state on execve() 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: 953a7d7c61f3b2f5351dfe668510ec782ae282e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 12:45:21 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=953a7d7c61f3b2f5351dfe668510ec782ae282e8 commit 953a7d7c61f3b2f5351dfe668510ec782ae282e8 Author: Alex Richardson AuthorDate: 2021-03-09 19:11:40 +0000 Commit: Alex Richardson CommitDate: 2021-03-10 12:44:42 +0000 Arch64: Clear VFP state on execve() I noticed that many of the math-related tests were failing on AArch64. After a lot of debugging, I noticed that the floating point exception flags were not being reset when starting a new process. This change resets the VFP inside exec_setregs() to ensure no VFP register state is leaked from parent processes to children. This commit also moves the clearing of fpcr that was added in 65618fdda0f27 from fork() to execve() since that makes more sense: fork() can retain current register values, but execve() should result in a well-defined clean state. Reviewed By: andrew MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29060 --- sys/arm64/arm64/elf32_machdep.c | 7 +++++++ sys/arm64/arm64/machdep.c | 7 +++++++ sys/arm64/arm64/vfp.c | 21 +++++++++++++++++++++ sys/arm64/arm64/vm_machdep.c | 1 - sys/arm64/include/vfp.h | 1 + sys/arm64/linux/linux_sysvec.c | 8 ++++++++ 6 files changed, 44 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 916633650d69..84b62caf8590 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef VFP +#include +#endif #include @@ -251,6 +254,10 @@ freebsd32_setregs(struct thread *td, struct image_params *imgp, tf->tf_x[14] = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; tf->tf_spsr = PSR_M_32; + +#ifdef VFP + vfp_reset_state(td, td->td_pcb); +#endif } void diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 73b06beeba7e..91f0a31ebe36 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -552,6 +552,7 @@ void exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) { struct trapframe *tf = td->td_frame; + struct pcb *pcb = td->td_pcb; memset(tf, 0, sizeof(struct trapframe)); @@ -559,6 +560,12 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) tf->tf_sp = STACKALIGN(stack); tf->tf_lr = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; + +#ifdef VFP + vfp_reset_state(td, pcb); +#endif + + /* TODO: Shouldn't we also reset pcb_dbg_regs? */ } /* Sanity check these are the same size, they will be memcpy'd to and fro */ diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c index 23c782c6dccb..5fa420e668c1 100644 --- a/sys/arm64/arm64/vfp.c +++ b/sys/arm64/arm64/vfp.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #ifdef VFP #include #include +#include #include #include #include @@ -199,6 +200,26 @@ vfp_save_state(struct thread *td, struct pcb *pcb) critical_exit(); } +/* + * Reset the FP state to avoid leaking state from the parent process across + * execve() (and to ensure that we get a consistent floating point environment + * in every new process). + */ +void +vfp_reset_state(struct thread *td, struct pcb *pcb) +{ + critical_enter(); + bzero(&pcb->pcb_fpustate.vfp_regs, sizeof(pcb->pcb_fpustate.vfp_regs)); + KASSERT(pcb->pcb_fpusaved == &pcb->pcb_fpustate, + ("pcb_fpusaved should point to pcb_fpustate.")); + pcb->pcb_fpustate.vfp_fpcr = initial_fpcr; + pcb->pcb_fpustate.vfp_fpsr = 0; + pcb->pcb_vfpcpu = UINT_MAX; + pcb->pcb_fpflags = 0; + vfp_discard(td); + critical_exit(); +} + void vfp_restore_state(void) { diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 9a496b40ec98..0193048e2697 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -108,7 +108,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame; td2->td_pcb->pcb_fpusaved = &td2->td_pcb->pcb_fpustate; td2->td_pcb->pcb_vfpcpu = UINT_MAX; - td2->td_pcb->pcb_fpusaved->vfp_fpcr = initial_fpcr; /* Setup to release spin count in fork_exit(). */ td2->td_md.md_spinlock_count = 1; diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h index b0ba01a2a319..3632e5eaa396 100644 --- a/sys/arm64/include/vfp.h +++ b/sys/arm64/include/vfp.h @@ -68,6 +68,7 @@ struct thread; void vfp_init(void); void vfp_discard(struct thread *); +void vfp_reset_state(struct thread *, struct pcb *); void vfp_restore_state(void); void vfp_save_state(struct thread *, struct pcb *); diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 1d628ffe6ecb..67feacfa876b 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -57,6 +57,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef VFP +#include +#endif + MODULE_VERSION(linux64elf, 1); const char *linux_kplatform; @@ -360,6 +364,10 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, regs->tf_lr = 0xffffffffffffffff; #endif regs->tf_elr = imgp->entry_addr; + +#ifdef VFP + vfp_reset_state(td, td->td_pcb); +#endif } int From owner-dev-commits-src-all@freebsd.org Wed Mar 10 15:06:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B1C656B946; Wed, 10 Mar 2021 15:06: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 4Dwb4n2brvz3hYB; Wed, 10 Mar 2021 15:06: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 4BE9B11647; Wed, 10 Mar 2021 15:06: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 12AF6Hkb050419; Wed, 10 Mar 2021 15:06:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AF6Hmd050418; Wed, 10 Mar 2021 15:06:17 GMT (envelope-from git) Date: Wed, 10 Mar 2021 15:06:17 GMT Message-Id: <202103101506.12AF6Hmd050418@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: 7e7f7beee732 - main - ns8250: don't drop IER_TXRDY on bus_grab/ungrab 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: 7e7f7beee732810d3afcc83828341ac3e139b5bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 15:06:17 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=7e7f7beee732810d3afcc83828341ac3e139b5bd commit 7e7f7beee732810d3afcc83828341ac3e139b5bd Author: Mitchell Horne AuthorDate: 2021-03-10 14:57:12 +0000 Commit: Mitchell Horne CommitDate: 2021-03-10 15:04:42 +0000 ns8250: don't drop IER_TXRDY on bus_grab/ungrab It has been observed that some systems are often unable to resume from ddb after entering with debug.kdb.enter=1. Checking the status further shows the terminal is blocked waiting in tty_drain(), but it never makes progress in clearing the output queue, because sc->sc_txbusy is high. I noticed that when entering polling mode for the debugger, IER_TXRDY is set in the failure case. Since this bit is never tracked by the softc, it will not be restored by ns8250_bus_ungrab(). This creates a race in which a TX interrupt can be lost, creating the hang described above. Ensuring that this bit is restored is enough to prevent this, and resume from ddb as expected. The solution is to track this bit in the sc->ier field, for the same lifetime that TX interrupts are enabled. PR: 223917, 240122 Reviewed by: imp, manu Tested by: bz MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29130 --- sys/dev/uart/uart_dev_ns8250.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index d920a76ae275..45b4d315c3d5 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -738,6 +738,7 @@ ns8250_bus_ipend(struct uart_softc *sc) } else { if (iir & IIR_TXRDY) { ipend |= SER_INT_TXIDLE; + ns8250->ier &= ~IER_ETXRDY; uart_setreg(bas, REG_IER, ns8250->ier); uart_barrier(bas); } else @@ -1035,7 +1036,9 @@ ns8250_bus_transmit(struct uart_softc *sc) uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]); uart_barrier(bas); } - uart_setreg(bas, REG_IER, ns8250->ier | IER_ETXRDY); + if (!broken_txfifo) + ns8250->ier |= IER_ETXRDY; + uart_setreg(bas, REG_IER, ns8250->ier); uart_barrier(bas); if (broken_txfifo) ns8250_drain(bas, UART_DRAIN_TRANSMITTER); From owner-dev-commits-src-all@freebsd.org Wed Mar 10 15:53:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B06DA56F78E; Wed, 10 Mar 2021 15:53:41 +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 4Dwc7T4bPRz3m1J; Wed, 10 Mar 2021 15:53:41 +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 9066812141; Wed, 10 Mar 2021 15:53:41 +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 12AFrfW0015590; Wed, 10 Mar 2021 15:53:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AFrfHB015589; Wed, 10 Mar 2021 15:53:41 GMT (envelope-from git) Date: Wed, 10 Mar 2021 15:53:41 GMT Message-Id: <202103101553.12AFrfHB015589@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling Smørgrav Subject: git: e5f02c140bf1 - main - Fix local-unbound setup for some IPv6 deployments. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5f02c140bf1e519a95bd6331382e8a2a1b6219f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 15:53:41 -0000 The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=e5f02c140bf1e519a95bd6331382e8a2a1b6219f commit e5f02c140bf1e519a95bd6331382e8a2a1b6219f Author: Dag-Erling Smørgrav AuthorDate: 2021-03-10 14:01:38 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2021-03-10 15:53:22 +0000 Fix local-unbound setup for some IPv6 deployments. PR: 250984 MFC after: 1 week --- usr.sbin/unbound/setup/local-unbound-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/unbound/setup/local-unbound-setup.sh b/usr.sbin/unbound/setup/local-unbound-setup.sh index c51145cf2312..3be78339b0ba 100755 --- a/usr.sbin/unbound/setup/local-unbound-setup.sh +++ b/usr.sbin/unbound/setup/local-unbound-setup.sh @@ -66,7 +66,7 @@ bkext=$(date "+%Y%m%d.%H%M%S") RE_octet="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])" RE_ipv4="(${RE_octet}(\\.${RE_octet}){3})" RE_word="([0-9A-Fa-f]{1,4})" -RE_ipv6="((${RE_word}:){1,}(:|(:${RE_word})*)|::1)" +RE_ipv6="((${RE_word}:){1,}(:|${RE_word}?(:${RE_word})*)|::1)" RE_port="([1-9][0-9]{0,3}|[1-5][0-9]{4,4}|6([0-4][0-9]{3}|5([0-4][0-9]{2}|5([0-2][0-9]|3[0-5]))))" RE_dnsname="([0-9A-Za-z-]{1,}(\\.[0-9A-Za-z-]{1,})*\\.?)" RE_forward_addr="((${RE_ipv4}|${RE_ipv6})(@${RE_port})?)" From owner-dev-commits-src-all@freebsd.org Wed Mar 10 15:53:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAB1356F80A; Wed, 10 Mar 2021 15:53: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 4Dwc7V5sKdz3ls3; Wed, 10 Mar 2021 15:53: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 BBEC2122DF; Wed, 10 Mar 2021 15:53: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 12AFrg0d015608; Wed, 10 Mar 2021 15:53:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AFrgIl015607; Wed, 10 Mar 2021 15:53:42 GMT (envelope-from git) Date: Wed, 10 Mar 2021 15:53:42 GMT Message-Id: <202103101553.12AFrgIl015607@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling Smørgrav Subject: git: 409388cfac49 - main - Fix post-start check when unbound.conf has moved. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 409388cfac49a312034e9397c870e3f81ff90734 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 15:53:42 -0000 The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=409388cfac49a312034e9397c870e3f81ff90734 commit 409388cfac49a312034e9397c870e3f81ff90734 Author: Dag-Erling Smørgrav AuthorDate: 2021-03-10 14:18:59 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2021-03-10 15:53:25 +0000 Fix post-start check when unbound.conf has moved. Reported by: phk@ MFC after: 1 week --- libexec/rc/rc.d/local_unbound | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/local_unbound b/libexec/rc/rc.d/local_unbound index 858ef56dbc0d..19cb9a6c5c01 100755 --- a/libexec/rc/rc.d/local_unbound +++ b/libexec/rc/rc.d/local_unbound @@ -106,7 +106,7 @@ local_unbound_poststart() local retry=5 echo -n "Waiting for nameserver to start..." - until "${command}-control" status | grep -q "is running" ; do + until "${command}-control" -c "${local_unbound_config}" status | grep -q "is running" ; do if [ $((retry -= 1)) -eq 0 ] ; then echo " giving up" return 1 From owner-dev-commits-src-all@freebsd.org Wed Mar 10 17:29:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEA48571574; Wed, 10 Mar 2021 17:29:53 +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 4DwfGT5yTKz3slb; Wed, 10 Mar 2021 17:29:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 52EF03790; Wed, 10 Mar 2021 17:29:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 953a7d7c61f3 - main - Arch64: Clear VFP state on execve() To: Alex Richardson , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202103101245.12ACjLn7064810@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Wed, 10 Mar 2021 09:29:51 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <202103101245.12ACjLn7064810@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 17:29:53 -0000 On 3/10/21 4:45 AM, Alex Richardson wrote: > The branch main has been updated by arichardson: > > URL: https://cgit.FreeBSD.org/src/commit/?id=953a7d7c61f3b2f5351dfe668510ec782ae282e8 > > commit 953a7d7c61f3b2f5351dfe668510ec782ae282e8 > Author: Alex Richardson > AuthorDate: 2021-03-09 19:11:40 +0000 > Commit: Alex Richardson > CommitDate: 2021-03-10 12:44:42 +0000 > > Arch64: Clear VFP state on execve() > > I noticed that many of the math-related tests were failing on AArch64. > After a lot of debugging, I noticed that the floating point exception flags > were not being reset when starting a new process. This change resets the > VFP inside exec_setregs() to ensure no VFP register state is leaked from > parent processes to children. > > This commit also moves the clearing of fpcr that was added in 65618fdda0f27 > from fork() to execve() since that makes more sense: fork() can retain > current register values, but execve() should result in a well-defined > clean state. > > Reviewed By: andrew > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D29060 FYI, cpu_thread_copy() should copy the creating thread's state to the new thread, not reset it. POSIX actually says that new threads inherit the "floating point environment" from the creating thread for pthread_create(). I have a patch I'm testing to fix thix for x86. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Wed Mar 10 17:38:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9CB1571EC4; Wed, 10 Mar 2021 17:38:04 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 4DwfRw1xnQz3tLq; Wed, 10 Mar 2021 17:38:03 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ed1-f54.google.com with SMTP id t1so29323963eds.7; Wed, 10 Mar 2021 09:38:03 -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=CnpwdviPwppKQIfOgzncJKqkxdD2LWVsoLJ/gwSTBcE=; b=GNlKDDCPtybC1WyTDK2GEJ/sCkz2FKaI7pYcXae8llAdH+WfgwG2IWzxKSVb6SzHeP UduYWvH52TGJKD/9ab+FZQu4jXqY+XgIikmWRqsPDu5IpYehF0etLXaD1uaQphsmDBSX WXCm8o80gXypS09pgDKUC/nZz95nD92fVYXdUxur3y29QgbhVTehWY8cW4LsA3rq7QpZ +Sp2A97mtgpPJl23AJMk5hpdp2ztq+cG3G0LqBWD6H09+phiLnS46oIWbC6160Alh1pN vCipvgHrOTyBBg5ZaJbdqOkjocsi82+1XpuZweJN6s5YPHgLa3YyNtWql7CqTz4E9A5s ZLSA== X-Gm-Message-State: AOAM533y4kQ9UWe4jIivM5DTey6XOe3zO8QwiSm9c83JSWrUBbKRgZMx JVqlduvER6ypb90l/lURwn2iMh1VutfHRA== X-Google-Smtp-Source: ABdhPJxSdrevv8c1wCdmx7FBYvNkS7jbkL9xUk8BgJ+cXPuDMC2XtO+Rxzc5quGjaCuwg1/9LKYDwg== X-Received: by 2002:a50:c00b:: with SMTP id r11mr4591354edb.35.1615397882141; Wed, 10 Mar 2021 09:38:02 -0800 (PST) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com. [209.85.221.47]) by smtp.gmail.com with ESMTPSA id y11sm61211ejd.72.2021.03.10.09.38.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Mar 2021 09:38:02 -0800 (PST) Received: by mail-wr1-f47.google.com with SMTP id w11so24271185wrr.10; Wed, 10 Mar 2021 09:38:01 -0800 (PST) X-Received: by 2002:a05:6000:118c:: with SMTP id g12mr4676388wrx.353.1615397881613; Wed, 10 Mar 2021 09:38:01 -0800 (PST) MIME-Version: 1.0 References: <202103101245.12ACjLn7064810@gitrepo.freebsd.org> In-Reply-To: From: Alexander Richardson Date: Wed, 10 Mar 2021 17:37:50 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 953a7d7c61f3 - main - Arch64: Clear VFP state on execve() To: John Baldwin 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: 4DwfRw1xnQz3tLq 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 17:38:04 -0000 On Wed, 10 Mar 2021 at 17:29, John Baldwin wrote: > > On 3/10/21 4:45 AM, Alex Richardson wrote: > > The branch main has been updated by arichardson: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=953a7d7c61f3b2f5351dfe668510ec782ae282e8 > > > > commit 953a7d7c61f3b2f5351dfe668510ec782ae282e8 > > Author: Alex Richardson > > AuthorDate: 2021-03-09 19:11:40 +0000 > > Commit: Alex Richardson > > CommitDate: 2021-03-10 12:44:42 +0000 > > > > Arch64: Clear VFP state on execve() > > > > I noticed that many of the math-related tests were failing on AArch64. > > After a lot of debugging, I noticed that the floating point exception flags > > were not being reset when starting a new process. This change resets the > > VFP inside exec_setregs() to ensure no VFP register state is leaked from > > parent processes to children. > > > > This commit also moves the clearing of fpcr that was added in 65618fdda0f27 > > from fork() to execve() since that makes more sense: fork() can retain > > current register values, but execve() should result in a well-defined > > clean state. > > > > Reviewed By: andrew > > MFC after: 1 week > > Differential Revision: https://reviews.freebsd.org/D29060 > > FYI, cpu_thread_copy() should copy the creating thread's state to the new thread, > not reset it. POSIX actually says that new threads inherit the "floating point > environment" from the creating thread for pthread_create(). I have a patch I'm > testing to fix thix for x86. > I believe sv_setregs is only called for execve() not for new threads? cpu_copy_thread() is not affected by this patch and I see it does a bcopy(td0->td_pcb, td->td_pcb, sizeof(struct pcb)); so should be fine? Alex From owner-dev-commits-src-all@freebsd.org Wed Mar 10 18:07:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C92085721D6; Wed, 10 Mar 2021 18:07: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 4Dwg5f5LgFz3vZq; Wed, 10 Mar 2021 18:07: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 AA89C13D5B; Wed, 10 Mar 2021 18:07: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 12AI7It0089871; Wed, 10 Mar 2021 18:07:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AI7IVW089870; Wed, 10 Mar 2021 18:07:18 GMT (envelope-from git) Date: Wed, 10 Mar 2021 18:07:18 GMT Message-Id: <202103101807.12AI7IVW089870@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Houchard Subject: git: c328f64d8107 - main - arm64: Fix COMPAT_FREEBSD32. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cognet X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c328f64d81079bad5064c8a387883df50ab5aaed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 18:07:18 -0000 The branch main has been updated by cognet: URL: https://cgit.FreeBSD.org/src/commit/?id=c328f64d81079bad5064c8a387883df50ab5aaed commit c328f64d81079bad5064c8a387883df50ab5aaed Author: Olivier Houchard AuthorDate: 2021-03-10 18:01:41 +0000 Commit: Olivier Houchard CommitDate: 2021-03-10 18:06:42 +0000 arm64: Fix COMPAT_FREEBSD32. The ENTRY() macro was modified by commit 28d945204ea1014d7de6906af8470ed8b3311335 to add an optional NOP instruction at the beginning of the function. It is of course an arm64 instruction, so unsuitable for the 32bits sigcode. So just use EENTRY() instead for aarch32_sigcode. This should fix receiving signals when running 32bits binaries on FreeBSD/arm64. MFC After: 1 week --- sys/arm64/arm64/locore.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index bd013a870e34..f5e6bbd604a5 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -805,7 +805,7 @@ esigcode: szsigcode: .quad esigcode - sigcode -ENTRY(aarch32_sigcode) +EENTRY(aarch32_sigcode) .word 0xe1a0000d // mov r0, sp .word 0xe2800040 // add r0, r0, #SIGF_UC .word 0xe59f700c // ldr r7, [pc, #12] @@ -813,7 +813,7 @@ ENTRY(aarch32_sigcode) .word 0xe59f7008 // ldr r7, [pc, #8] .word 0xef000000 // swi #0 .word 0xeafffffa // b . - 16 -END(aarch32_sigcode) +EEND(aarch32_sigcode) .word SYS_sigreturn .word SYS_exit .align 3 From owner-dev-commits-src-all@freebsd.org Wed Mar 10 18:36:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFDE657352E for ; Wed, 10 Mar 2021 18:36:39 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.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 4DwglW4Q4Hz4SV6 for ; Wed, 10 Mar 2021 18:36:39 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f49.google.com with SMTP id 7so24488871wrz.0 for ; Wed, 10 Mar 2021 10:36: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:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=SYPW1/rwuoBm47vUZW2vETjGKNJorbaI7+nCpaKvVVU=; b=PHwnZ/6Py1PPEO1dgl7e0IwzlKqo6jBuCtlAq5GKwmT1lULu6cm2AdbmGmToYh6n6n yLJJX5H2z1NtWqJMP/mbutVPHcXOQa9pJn2J8MBiDLVeJxK/yb//iYhi2OcObge0bblQ APoR3xv0Nm4y9584cxoluwjuqPqIJrjIvsUjRP8CEazq8QI0xMB72PqCrNCI2ICVpd/9 iyiEeCoklSmSbzLTsp8zGoKSlSqbtP8hezBnqpmQd/2Yjj9nrTqqWWkIr3yTk1yLhOFn p01TTau4ZHlsJ+nKl/lrKXfLKS9mmTZvzPNxW2ngBZ0SfY5R6hH6JIcxt/Qm5ETvXSi9 X9QA== X-Gm-Message-State: AOAM53012ls+1SB0XJ9N6fH5I01QoSBOTexCDLL1lfgN5c7xy96+++yc xSwRs0uU4zI+FHWpocp/iHvISA== X-Google-Smtp-Source: ABdhPJzGX01xAWHSPw7VtSJ8Pu9fCriMcwm538KbebTDykI8oKO1zN2ylCNYXgVwF5/U4UlZbpq9hQ== X-Received: by 2002:a5d:6404:: with SMTP id z4mr3449089wru.109.1615401397929; Wed, 10 Mar 2021 10:36:37 -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 u63sm305967wmg.24.2021.03.10.10.36.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Mar 2021 10:36:36 -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: c328f64d8107 - main - arm64: Fix COMPAT_FREEBSD32. From: Jessica Clarke In-Reply-To: <202103101807.12AI7IVW089870@gitrepo.freebsd.org> Date: Wed, 10 Mar 2021 18:36:35 +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: <28B50FA6-65E4-4A5A-8339-8A4A8720974B@freebsd.org> References: <202103101807.12AI7IVW089870@gitrepo.freebsd.org> To: Olivier Houchard , John Baldwin X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DwglW4Q4Hz4SV6 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 18:36:39 -0000 On 10 Mar 2021, at 18:07, Olivier Houchard wrote: >=20 > The branch main has been updated by cognet: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dc328f64d81079bad5064c8a387883df5= 0ab5aaed >=20 > commit c328f64d81079bad5064c8a387883df50ab5aaed > Author: Olivier Houchard > AuthorDate: 2021-03-10 18:01:41 +0000 > Commit: Olivier Houchard > CommitDate: 2021-03-10 18:06:42 +0000 >=20 > arm64: Fix COMPAT_FREEBSD32. >=20 > The ENTRY() macro was modified by commit > 28d945204ea1014d7de6906af8470ed8b3311335 to add an optional NOP = instruction > at the beginning of the function. It is of course an arm64 = instruction, so > unsuitable for the 32bits sigcode. So just use EENTRY() instead for > aarch32_sigcode. This should fix receiving signals when running = 32bits > binaries on FreeBSD/arm64. Hmm, that's a good point, does the extra nop for the AArch64 sigcode cause issues for gdb detecting it? Perhaps we should upstream CheriBSD's SIGCODE macros?.. Jess Jess From owner-dev-commits-src-all@freebsd.org Wed Mar 10 18:39:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4363573373; Wed, 10 Mar 2021 18:39:46 +0000 (UTC) (envelope-from cognet@ci0.org) Received: from kanar.ci0.org (kanar.ci0.org [IPv6:2001:bc8:35e6::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-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "sd-143795", Issuer "sd-143795" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dwgq64ZVWz4Sk8; Wed, 10 Mar 2021 18:39:46 +0000 (UTC) (envelope-from cognet@ci0.org) Received: from kanar.ci0.org (localhost [127.0.0.1]) by kanar.ci0.org (8.16.1/8.16.1) with ESMTPS id 12AIdYBd004713 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 10 Mar 2021 19:39:34 +0100 (CET) (envelope-from cognet@ci0.org) Received: (from doginou@localhost) by kanar.ci0.org (8.16.1/8.16.1/Submit) id 12AIdYo1004712; Wed, 10 Mar 2021 19:39:34 +0100 (CET) (envelope-from cognet@ci0.org) X-Authentication-Warning: kanar.ci0.org: doginou set sender to cognet@ci0.org using -f Date: Wed, 10 Mar 2021 19:39:34 +0100 From: Olivier Houchard To: Jessica Clarke Cc: Olivier Houchard , John Baldwin , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: c328f64d8107 - main - arm64: Fix COMPAT_FREEBSD32. Message-ID: References: <202103101807.12AI7IVW089870@gitrepo.freebsd.org> <28B50FA6-65E4-4A5A-8339-8A4A8720974B@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <28B50FA6-65E4-4A5A-8339-8A4A8720974B@freebsd.org> X-Rspamd-Queue-Id: 4Dwgq64ZVWz4Sk8 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 18:39:46 -0000 Hi Jessica, On Wed, Mar 10, 2021 at 06:36:35PM +0000, Jessica Clarke wrote: > On 10 Mar 2021, at 18:07, Olivier Houchard wrote: > > > > The branch main has been updated by cognet: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=c328f64d81079bad5064c8a387883df50ab5aaed > > > > commit c328f64d81079bad5064c8a387883df50ab5aaed > > Author: Olivier Houchard > > AuthorDate: 2021-03-10 18:01:41 +0000 > > Commit: Olivier Houchard > > CommitDate: 2021-03-10 18:06:42 +0000 > > > > arm64: Fix COMPAT_FREEBSD32. > > > > The ENTRY() macro was modified by commit > > 28d945204ea1014d7de6906af8470ed8b3311335 to add an optional NOP instruction > > at the beginning of the function. It is of course an arm64 instruction, so > > unsuitable for the 32bits sigcode. So just use EENTRY() instead for > > aarch32_sigcode. This should fix receiving signals when running 32bits > > binaries on FreeBSD/arm64. > > Hmm, that's a good point, does the extra nop for the AArch64 sigcode > cause issues for gdb detecting it? > > Perhaps we should upstream CheriBSD's SIGCODE macros?.. > I wondered about that, but decided not to dig that rabbit hole :) Having specific macros would certainly make sense. Olivier From owner-dev-commits-src-all@freebsd.org Wed Mar 10 18:52:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86D8A5740A7; Wed, 10 Mar 2021 18:52: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 4Dwh6J3NYgz4WnK; Wed, 10 Mar 2021 18:52: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 6709C16838; Wed, 10 Mar 2021 18:52: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 12AIquVl054768; Wed, 10 Mar 2021 18:52:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AIquTp054767; Wed, 10 Mar 2021 18:52:56 GMT (envelope-from git) Date: Wed, 10 Mar 2021 18:52:56 GMT Message-Id: <202103101852.12AIquTp054767@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: 2cee045b4d62 - main - Move time math out of disabled interrupts sections. 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: 2cee045b4d62568d065b838a6cf129fed2424709 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 18:52:56 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=2cee045b4d62568d065b838a6cf129fed2424709 commit 2cee045b4d62568d065b838a6cf129fed2424709 Author: Alexander Motin AuthorDate: 2021-03-10 18:39:15 +0000 Commit: Alexander Motin CommitDate: 2021-03-10 18:52:51 +0000 Move time math out of disabled interrupts sections. We don't need the result before next sleep time, so no reason to additionally increase interrupt latency. While there, remove extra PM ticks to microseconds conversion, making C2/C3 sleep times look 4 times smaller than really. The conversion is already done by AcpiGetTimerDuration(). Now I see reported sleep times up to 0.5s, just as expected for planned 2 wakeups per second. MFC after: 1 month --- sys/dev/acpica/acpi_cpu.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 56182ed743de..3c81d55436ca 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -114,8 +114,6 @@ struct acpi_cpu_device { (bus_space_write_ ## width(rman_get_bustag((reg)), \ rman_get_bushandle((reg)), 0, (val))) -#define PM_USEC(x) ((x) >> 2) /* ~4 clocks per usec (3.57955 Mhz) */ - #define ACPI_NOTIFY_CX_STATES 0x81 /* _CST changed. */ #define CPU_QUIRK_NO_C3 (1<<0) /* C3-type states are not usable. */ @@ -1107,7 +1105,7 @@ acpi_cpu_idle(sbintime_t sbt) { struct acpi_cpu_softc *sc; struct acpi_cx *cx_next; - uint64_t cputicks; + uint64_t start_ticks, end_ticks; uint32_t start_time, end_time; ACPI_STATUS status; int bm_active, cx_next_idx, i, us; @@ -1176,7 +1174,7 @@ acpi_cpu_idle(sbintime_t sbt) * we are called inside critical section, delaying context switch. */ if (cx_next->type == ACPI_STATE_C1) { - cputicks = cpu_ticks(); + start_ticks = cpu_ticks(); if (cx_next->p_lvlx != NULL) { /* C1 I/O then Halt */ CPU_GET_REG(cx_next->p_lvlx, 1); @@ -1185,12 +1183,13 @@ acpi_cpu_idle(sbintime_t sbt) acpi_cpu_idle_mwait(cx_next->mwait_hint); else acpi_cpu_c1(); - end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); - if (curthread->td_critnest == 0) - end_time = min(end_time, 500000 / hz); + end_ticks = cpu_ticks(); /* acpi_cpu_c1() returns with interrupts enabled. */ if (cx_next->do_mwait) ACPI_ENABLE_IRQS(); + end_time = ((end_ticks - start_ticks) << 20) / cpu_tickrate(); + if (!cx_next->do_mwait && curthread->td_critnest == 0) + end_time = min(end_time, 500000 / hz); sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + end_time) / 4; return; } @@ -1215,10 +1214,10 @@ acpi_cpu_idle(sbintime_t sbt) */ if (cx_next->type == ACPI_STATE_C3) { AcpiGetTimer(&start_time); - cputicks = 0; + start_ticks = 0; } else { start_time = 0; - cputicks = cpu_ticks(); + start_ticks = cpu_ticks(); } if (cx_next->do_mwait) { acpi_cpu_idle_mwait(cx_next->mwait_hint); @@ -1233,11 +1232,10 @@ acpi_cpu_idle(sbintime_t sbt) AcpiGetTimer(&end_time); } - if (cx_next->type == ACPI_STATE_C3) { + if (cx_next->type == ACPI_STATE_C3) AcpiGetTimer(&end_time); - AcpiGetTimerDuration(start_time, end_time, &end_time); - } else - end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); + else + end_ticks = cpu_ticks(); /* Enable bus master arbitration and disable bus master wakeup. */ if (cx_next->type == ACPI_STATE_C3 && @@ -1247,7 +1245,11 @@ acpi_cpu_idle(sbintime_t sbt) } ACPI_ENABLE_IRQS(); - sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + PM_USEC(end_time)) / 4; + if (cx_next->type == ACPI_STATE_C3) + AcpiGetTimerDuration(start_time, end_time, &end_time); + else + end_time = ((end_ticks - start_ticks) << 20) / cpu_tickrate(); + sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + end_time) / 4; } #endif From owner-dev-commits-src-all@freebsd.org Wed Mar 10 19:08:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A12D5746D9; Wed, 10 Mar 2021 19: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 4DwhS328GHz4XLd; Wed, 10 Mar 2021 19: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 3CA0B16974; Wed, 10 Mar 2021 19: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 12AJ8JQ7069325; Wed, 10 Mar 2021 19: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 12AJ8Jw6069324; Wed, 10 Mar 2021 19:08:19 GMT (envelope-from git) Date: Wed, 10 Mar 2021 19:08:19 GMT Message-Id: <202103101908.12AJ8Jw6069324@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: 3fa034210c75 - main - ktls: Fix non-inplace TLS 1.3 encryption. 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: 3fa034210c75431173cb0a2375f6938386e25315 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 19:08:19 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3fa034210c75431173cb0a2375f6938386e25315 commit 3fa034210c75431173cb0a2375f6938386e25315 Author: John Baldwin AuthorDate: 2021-03-10 19:07:40 +0000 Commit: John Baldwin CommitDate: 2021-03-10 19:07:40 +0000 ktls: Fix non-inplace TLS 1.3 encryption. Copy the iovec for the trailer from the proper place. This is the same fix for CBC encryption from ff6a7e4ba6bf. Reported by: gallatin Reviewed by: gallatin, markj Fixes: 49f6925ca Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29177 --- sys/opencrypto/ktls_ocf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index 7414e26bb3e2..2f2249cd3bfe 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -574,7 +574,7 @@ ktls_ocf_tls13_aead_encrypt(struct ktls_session *tls, if (!inplace) { /* Duplicate the output iov to append the trailer. */ memcpy(out_iov, outiov, outiovcnt * sizeof(*out_iov)); - out_iov[outiovcnt] = iov[outiovcnt]; + out_iov[outiovcnt] = iov[iniovcnt]; out_uio.uio_iov = out_iov; out_uio.uio_iovcnt = outiovcnt + 1; From owner-dev-commits-src-all@freebsd.org Wed Mar 10 19:19:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3DB45749DD; Wed, 10 Mar 2021 19:19:27 +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 4Dwhhv5D9Wz4YJj; Wed, 10 Mar 2021 19:19:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 2E53E3F2D; Wed, 10 Mar 2021 19:19:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 953a7d7c61f3 - main - Arch64: Clear VFP state on execve() To: Alexander Richardson Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103101245.12ACjLn7064810@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Wed, 10 Mar 2021 11:19:26 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.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-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 19:19:27 -0000 On 3/10/21 9:37 AM, Alexander Richardson wrote: > On Wed, 10 Mar 2021 at 17:29, John Baldwin wrote: >> >> On 3/10/21 4:45 AM, Alex Richardson wrote: >>> The branch main has been updated by arichardson: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=953a7d7c61f3b2f5351dfe668510ec782ae282e8 >>> >>> commit 953a7d7c61f3b2f5351dfe668510ec782ae282e8 >>> Author: Alex Richardson >>> AuthorDate: 2021-03-09 19:11:40 +0000 >>> Commit: Alex Richardson >>> CommitDate: 2021-03-10 12:44:42 +0000 >>> >>> Arch64: Clear VFP state on execve() >>> >>> I noticed that many of the math-related tests were failing on AArch64. >>> After a lot of debugging, I noticed that the floating point exception flags >>> were not being reset when starting a new process. This change resets the >>> VFP inside exec_setregs() to ensure no VFP register state is leaked from >>> parent processes to children. >>> >>> This commit also moves the clearing of fpcr that was added in 65618fdda0f27 >>> from fork() to execve() since that makes more sense: fork() can retain >>> current register values, but execve() should result in a well-defined >>> clean state. >>> >>> Reviewed By: andrew >>> MFC after: 1 week >>> Differential Revision: https://reviews.freebsd.org/D29060 >> >> FYI, cpu_thread_copy() should copy the creating thread's state to the new thread, >> not reset it. POSIX actually says that new threads inherit the "floating point >> environment" from the creating thread for pthread_create(). I have a patch I'm >> testing to fix thix for x86. >> > > I believe sv_setregs is only called for execve() not for new threads? > cpu_copy_thread() is not affected by this patch and I see it does a > bcopy(td0->td_pcb, td->td_pcb, sizeof(struct pcb)); so should be fine? Ah, I thought you touched cpu_copy_thread() as well. I do think cpu_copy_thread() resets some pcb flags which might be the thing to fix (it's what I have to fix for x86 which was copying the state, but then clearing the INITDONE flags such that the copied state was always overwritten by the trap on first use) -- John Baldwin From owner-dev-commits-src-all@freebsd.org Wed Mar 10 19:25:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECD4E574CF0; Wed, 10 Mar 2021 19:25:01 +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 4DwhqK5HWbz4YgM; Wed, 10 Mar 2021 19:25:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 2371549CE; Wed, 10 Mar 2021 19:25:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: Jessica Clarke , Olivier Houchard Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202103101807.12AI7IVW089870@gitrepo.freebsd.org> <28B50FA6-65E4-4A5A-8339-8A4A8720974B@freebsd.org> From: John Baldwin Subject: Re: git: c328f64d8107 - main - arm64: Fix COMPAT_FREEBSD32. Message-ID: <4e2cf000-991c-c09a-8c23-43ad4f5ef715@FreeBSD.org> Date: Wed, 10 Mar 2021 11:25:00 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <28B50FA6-65E4-4A5A-8339-8A4A8720974B@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 19:25:02 -0000 On 3/10/21 10:36 AM, Jessica Clarke wrote: > On 10 Mar 2021, at 18:07, Olivier Houchard wrote: >> >> The branch main has been updated by cognet: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=c328f64d81079bad5064c8a387883df50ab5aaed >> >> commit c328f64d81079bad5064c8a387883df50ab5aaed >> Author: Olivier Houchard >> AuthorDate: 2021-03-10 18:01:41 +0000 >> Commit: Olivier Houchard >> CommitDate: 2021-03-10 18:06:42 +0000 >> >> arm64: Fix COMPAT_FREEBSD32. >> >> The ENTRY() macro was modified by commit >> 28d945204ea1014d7de6906af8470ed8b3311335 to add an optional NOP instruction >> at the beginning of the function. It is of course an arm64 instruction, so >> unsuitable for the 32bits sigcode. So just use EENTRY() instead for >> aarch32_sigcode. This should fix receiving signals when running 32bits >> binaries on FreeBSD/arm64. > > Hmm, that's a good point, does the extra nop for the AArch64 sigcode > cause issues for gdb detecting it? I think GDB might be ok because the nop comes first as it looks for the sequence of instructions after the nop to identify the signal frame (it doesn't care what instructions come before the sequence). -- John Baldwin From owner-dev-commits-src-all@freebsd.org Wed Mar 10 21:28:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E6055782A7; Wed, 10 Mar 2021 21:28: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 4DwlYk747hz4hdf; Wed, 10 Mar 2021 21:28: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 E5A9318905; Wed, 10 Mar 2021 21:28: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 12ALSQWY053341; Wed, 10 Mar 2021 21:28:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12ALSQjR053340; Wed, 10 Mar 2021 21:28:26 GMT (envelope-from git) Date: Wed, 10 Mar 2021 21:28:26 GMT Message-Id: <202103102128.12ALSQjR053340@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: b1d63265ac39 - main - Flush remaining routes from the routing table during VNET shutdown. 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: b1d63265ac399112b3bca36c3d75df1a3c2c8102 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 21:28:27 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=b1d63265ac399112b3bca36c3d75df1a3c2c8102 commit b1d63265ac399112b3bca36c3d75df1a3c2c8102 Author: Alexander V. Chernikov AuthorDate: 2021-03-08 21:35:41 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:10:14 +0000 Flush remaining routes from the routing table during VNET shutdown. Summary: This fixes rtentry leak for the cloned interfaces created inside the VNET. PR: 253998 Reported by: rashey at superbox.pl MFC after: 3 days Loopback teardown order is `SI_SUB_INIT_IF`, which happens after `SI_SUB_PROTO_DOMAIN` (route table teardown). Thus, any route table operations are too late to schedule. As the intent of the vnet teardown procedures to minimise the amount of effort by doing global cleanups instead of per-interface ones, address this by adding a relatively light-weight routing table cleanup function, `rib_flush_routes()`. It removes all remaining routes from the routing table and schedules the deletion, which will happen later, when `rtables_destroy()` waits for the current epoch to finish. Test Plan: ``` set_skip:set_skip_group_lo -> passed [0.053s] tail -n 200 /var/log/messages | grep rtentry ``` Reviewers: #network, kp, bz Reviewed By: kp Subscribers: imp, ae Differential Revision: https://reviews.freebsd.org/D29116 --- sys/net/route.c | 15 --------------- sys/net/route.h | 2 +- sys/net/route/route_ctl.c | 36 ++++++++++++++++++++++++++++++++++++ sys/netinet/ip_input.c | 6 +----- sys/netinet6/ip6_input.c | 5 +++-- 5 files changed, 41 insertions(+), 23 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index d2b405fafcbf..2416aa9a983f 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -493,21 +493,6 @@ rt_ifdelroute(const struct rtentry *rt, const struct nhop_object *nh, void *arg) return (1); } -/* - * Delete all remaining routes using this interface - * Unfortuneatly the only way to do this is to slog through - * the entire routing table looking for routes which point - * to this interface...oh well... - */ -void -rt_flushifroutes_af(struct ifnet *ifp, int af) -{ - KASSERT((af >= 1 && af <= AF_MAX), ("%s: af %d not >= 1 and <= %d", - __func__, af, AF_MAX)); - - rib_foreach_table_walk_del(af, rt_ifdelroute, ifp); -} - void rt_flushifroutes(struct ifnet *ifp) { diff --git a/sys/net/route.h b/sys/net/route.h index ab6e1aabc5ae..3fdca303596e 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -429,7 +429,6 @@ struct sockaddr *rtsock_fix_netmask(const struct sockaddr *dst, void rt_updatemtu(struct ifnet *); -void rt_flushifroutes_af(struct ifnet *, int); void rt_flushifroutes(struct ifnet *ifp); /* XXX MRT NEW VERSIONS THAT USE FIBs @@ -442,6 +441,7 @@ int rib_lookup_info(uint32_t, const struct sockaddr *, uint32_t, uint32_t, void rib_free_info(struct rt_addrinfo *info); /* New API */ +void rib_flush_routes_family(int family); struct nhop_object *rib_lookup(uint32_t fibnum, const struct sockaddr *dst, uint32_t flags, uint32_t flowid); #endif diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index e07a94295b89..d9fd1aa18c92 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -1328,6 +1328,42 @@ rib_walk_del(u_int fibnum, int family, rib_filter_f_t *filter_f, void *arg, bool NET_EPOCH_EXIT(et); } +static int +rt_delete_unconditional(struct radix_node *rn, void *arg) +{ + struct rtentry *rt = RNTORT(rn); + struct rib_head *rnh = (struct rib_head *)arg; + + rn = rnh->rnh_deladdr(rt_key(rt), rt_mask(rt), &rnh->head); + if (RNTORT(rn) == rt) + rtfree(rt); + + return (0); +} + +/* + * Removes all routes from the routing table without executing notifications. + * rtentres will be removed after the end of a current epoch. + */ +static void +rib_flush_routes(struct rib_head *rnh) +{ + RIB_WLOCK(rnh); + rnh->rnh_walktree(&rnh->head, rt_delete_unconditional, rnh); + RIB_WUNLOCK(rnh); +} + +void +rib_flush_routes_family(int family) +{ + struct rib_head *rnh; + + for (uint32_t fibnum = 0; fibnum < rt_numfibs; fibnum++) { + if ((rnh = rt_tables_get_rnh(fibnum, family)) != NULL) + rib_flush_routes(rnh); + } +} + static void rib_notify(struct rib_head *rnh, enum rib_subscription_type type, struct rib_cmd_info *rc) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index be21decff6cb..a85f8ac7b567 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -379,7 +379,6 @@ ip_init(void) static void ip_destroy(void *unused __unused) { - struct ifnet *ifp; int error; #ifdef RSS @@ -405,10 +404,7 @@ ip_destroy(void *unused __unused) in_ifscrub_all(); /* Make sure the IPv4 routes are gone as well. */ - IFNET_RLOCK(); - CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) - rt_flushifroutes_af(ifp, AF_INET); - IFNET_RUNLOCK(); + rib_flush_routes_family(AF_INET); /* Destroy IP reassembly queue. */ ipreass_destroy(); diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 80e5acc62548..9ea578f88417 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -386,11 +386,12 @@ ip6_destroy(void *unused __unused) /* IF_ADDR_UNLOCK(ifp); */ in6_ifdetach_destroy(ifp); mld_domifdetach(ifp); - /* Make sure any routes are gone as well. */ - rt_flushifroutes_af(ifp, AF_INET6); } IFNET_RUNLOCK(); + /* Make sure any routes are gone as well. */ + rib_flush_routes_family(AF_INET6); + frag6_destroy(); nd6_destroy(); in6_ifattach_destroy(); From owner-dev-commits-src-all@freebsd.org Wed Mar 10 21:51:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47FAC578891; Wed, 10 Mar 2021 21:51: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 4Dwm461Znxz4jdZ; Wed, 10 Mar 2021 21:51: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 291FC18DA9; Wed, 10 Mar 2021 21:51: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 12ALpInp087502; Wed, 10 Mar 2021 21:51:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12ALpIo4087501; Wed, 10 Mar 2021 21:51:18 GMT (envelope-from git) Date: Wed, 10 Mar 2021 21:51:18 GMT Message-Id: <202103102151.12ALpIo4087501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 3ef7b71f3b77 - stable/12 - Partially revert libcxxrt changes to avoid _Unwind_Exception change MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3ef7b71f3b7739cdb556e7419e7e66a865ca83f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 21:51:18 -0000 The branch stable/12 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=3ef7b71f3b7739cdb556e7419e7e66a865ca83f3 commit 3ef7b71f3b7739cdb556e7419e7e66a865ca83f3 Author: Dimitry Andric AuthorDate: 2021-03-10 21:31:40 +0000 Commit: Dimitry Andric CommitDate: 2021-03-10 21:31:40 +0000 Partially revert libcxxrt changes to avoid _Unwind_Exception change After the recent cherry-picking of libcxxrt commits 0ee0dbfb0d26 and d2b3fadf2db5, users reported that editors/libreoffice packages from the official package builders did not start anymore. It turns out that the combination of these commits subtly changes the ABI, requiring all applications that depend on internal details of struct _Unwind_Exception (available via unwind-arm.h and unwind-itanium.h) to be recompiled. However, the FreeBSD package builders always use -RELEASE jails, so these still use the old declaration of struct _Unwind_Exception, which is not entirely compatible. In particular, LibreOffice uses this struct in its internal "uno bridge" component, where it attempts to setup its own exception handling mechanism. To fix this incompatibility, go back to the old declarations of struct _Unwind_Exception, and restore the __LP64__ specific workaround we had in place before (which was to cope with yet another, older ABI bug). Effectively, this reverts upstream libcxxrt commits 88bdf6b290da ("Specify double-word alignment for ARM unwind") and b96169641f79 ("Updated Itanium unwind"), and reapplies our commit 3c4fd2463bb2 ("libcxxrt: add padding in __cxa_allocate_* to fix alignment"). PR: 253840 --- contrib/libcxxrt/exception.cc | 30 ++++++++++++++++++++++++------ contrib/libcxxrt/unwind-arm.h | 2 +- contrib/libcxxrt/unwind-itanium.h | 9 +++------ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc index 0fb26ddb4ed2..0de878e9e6db 100644 --- a/contrib/libcxxrt/exception.cc +++ b/contrib/libcxxrt/exception.cc @@ -572,6 +572,19 @@ static void free_exception(char *e) } } +#ifdef __LP64__ +/** + * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte + * alignment but it was broken by the addition of the referenceCount. + * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep + * compatibility with consumers of the broken __cxa_exception, explicitly add + * padding on allocation (and account for it on free). + */ +static const int exception_alignment_padding = 8; +#else +static const int exception_alignment_padding = 0; +#endif + /** * Allocates an exception structure. Returns a pointer to the space that can * be used to store an object of thrown_size bytes. This function will use an @@ -580,16 +593,19 @@ static void free_exception(char *e) */ extern "C" void *__cxa_allocate_exception(size_t thrown_size) { - size_t size = thrown_size + sizeof(__cxa_exception); + size_t size = exception_alignment_padding + sizeof(__cxa_exception) + + thrown_size; char *buffer = alloc_or_die(size); - return buffer+sizeof(__cxa_exception); + return buffer + exception_alignment_padding + sizeof(__cxa_exception); } extern "C" void *__cxa_allocate_dependent_exception(void) { - size_t size = sizeof(__cxa_dependent_exception); + size_t size = exception_alignment_padding + + sizeof(__cxa_dependent_exception); char *buffer = alloc_or_die(size); - return buffer+sizeof(__cxa_dependent_exception); + return buffer + exception_alignment_padding + + sizeof(__cxa_dependent_exception); } /** @@ -617,7 +633,8 @@ extern "C" void __cxa_free_exception(void *thrown_exception) } } - free_exception(reinterpret_cast(ex)); + free_exception(reinterpret_cast(ex) - + exception_alignment_padding); } static void releaseException(__cxa_exception *exception) @@ -644,7 +661,8 @@ void __cxa_free_dependent_exception(void *thrown_exception) { releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); } - free_exception(reinterpret_cast(ex)); + free_exception(reinterpret_cast(ex) - + exception_alignment_padding); } /** diff --git a/contrib/libcxxrt/unwind-arm.h b/contrib/libcxxrt/unwind-arm.h index ec81237e573b..6eb9d9e45981 100644 --- a/contrib/libcxxrt/unwind-arm.h +++ b/contrib/libcxxrt/unwind-arm.h @@ -97,7 +97,7 @@ struct _Unwind_Exception } pr_cache; /** Force alignment of next item to 8-byte boundary */ long long int :0; -} __attribute__((__aligned__(8))); +}; /* Unwinding functions */ _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *ucbp); diff --git a/contrib/libcxxrt/unwind-itanium.h b/contrib/libcxxrt/unwind-itanium.h index 199d91de283d..1ee0cf0e81c4 100644 --- a/contrib/libcxxrt/unwind-itanium.h +++ b/contrib/libcxxrt/unwind-itanium.h @@ -79,12 +79,9 @@ struct _Unwind_Exception { uint64_t exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; - uintptr_t private_1; - uintptr_t private_2; -#if __SIZEOF_POINTER__ == 4 - uint32_t reserved[3]; -#endif - } __attribute__((__aligned__)); + unsigned long private_1; + unsigned long private_2; + } ; extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, From owner-dev-commits-src-all@freebsd.org Wed Mar 10 21:53:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CE725786E1; Wed, 10 Mar 2021 21:53:03 +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 4Dwm6744fGz4jwx; Wed, 10 Mar 2021 21:53: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 7560A18B4B; Wed, 10 Mar 2021 21:53: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 12ALr3dT091779; Wed, 10 Mar 2021 21:53:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12ALr37D091778; Wed, 10 Mar 2021 21:53:03 GMT (envelope-from git) Date: Wed, 10 Mar 2021 21:53:03 GMT Message-Id: <202103102153.12ALr37D091778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 3a5074327da0 - stable/11 - Partially revert libcxxrt changes to avoid _Unwind_Exception change MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 3a5074327da0ceba770aef60e41e91dc7d054019 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 21:53:03 -0000 The branch stable/11 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=3a5074327da0ceba770aef60e41e91dc7d054019 commit 3a5074327da0ceba770aef60e41e91dc7d054019 Author: Dimitry Andric AuthorDate: 2021-03-10 21:32:18 +0000 Commit: Dimitry Andric CommitDate: 2021-03-10 21:32:18 +0000 Partially revert libcxxrt changes to avoid _Unwind_Exception change After the recent cherry-picking of libcxxrt commits 0ee0dbfb0d26 and d2b3fadf2db5, users reported that editors/libreoffice packages from the official package builders did not start anymore. It turns out that the combination of these commits subtly changes the ABI, requiring all applications that depend on internal details of struct _Unwind_Exception (available via unwind-arm.h and unwind-itanium.h) to be recompiled. However, the FreeBSD package builders always use -RELEASE jails, so these still use the old declaration of struct _Unwind_Exception, which is not entirely compatible. In particular, LibreOffice uses this struct in its internal "uno bridge" component, where it attempts to setup its own exception handling mechanism. To fix this incompatibility, go back to the old declarations of struct _Unwind_Exception, and restore the __LP64__ specific workaround we had in place before (which was to cope with yet another, older ABI bug). Effectively, this reverts upstream libcxxrt commits 88bdf6b290da ("Specify double-word alignment for ARM unwind") and b96169641f79 ("Updated Itanium unwind"), and reapplies our commit 3c4fd2463bb2 ("libcxxrt: add padding in __cxa_allocate_* to fix alignment"). PR: 253840 --- contrib/libcxxrt/exception.cc | 30 ++++++++++++++++++++++++------ contrib/libcxxrt/unwind-arm.h | 2 +- contrib/libcxxrt/unwind-itanium.h | 9 +++------ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc index 0fb26ddb4ed2..0de878e9e6db 100644 --- a/contrib/libcxxrt/exception.cc +++ b/contrib/libcxxrt/exception.cc @@ -572,6 +572,19 @@ static void free_exception(char *e) } } +#ifdef __LP64__ +/** + * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte + * alignment but it was broken by the addition of the referenceCount. + * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep + * compatibility with consumers of the broken __cxa_exception, explicitly add + * padding on allocation (and account for it on free). + */ +static const int exception_alignment_padding = 8; +#else +static const int exception_alignment_padding = 0; +#endif + /** * Allocates an exception structure. Returns a pointer to the space that can * be used to store an object of thrown_size bytes. This function will use an @@ -580,16 +593,19 @@ static void free_exception(char *e) */ extern "C" void *__cxa_allocate_exception(size_t thrown_size) { - size_t size = thrown_size + sizeof(__cxa_exception); + size_t size = exception_alignment_padding + sizeof(__cxa_exception) + + thrown_size; char *buffer = alloc_or_die(size); - return buffer+sizeof(__cxa_exception); + return buffer + exception_alignment_padding + sizeof(__cxa_exception); } extern "C" void *__cxa_allocate_dependent_exception(void) { - size_t size = sizeof(__cxa_dependent_exception); + size_t size = exception_alignment_padding + + sizeof(__cxa_dependent_exception); char *buffer = alloc_or_die(size); - return buffer+sizeof(__cxa_dependent_exception); + return buffer + exception_alignment_padding + + sizeof(__cxa_dependent_exception); } /** @@ -617,7 +633,8 @@ extern "C" void __cxa_free_exception(void *thrown_exception) } } - free_exception(reinterpret_cast(ex)); + free_exception(reinterpret_cast(ex) - + exception_alignment_padding); } static void releaseException(__cxa_exception *exception) @@ -644,7 +661,8 @@ void __cxa_free_dependent_exception(void *thrown_exception) { releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); } - free_exception(reinterpret_cast(ex)); + free_exception(reinterpret_cast(ex) - + exception_alignment_padding); } /** diff --git a/contrib/libcxxrt/unwind-arm.h b/contrib/libcxxrt/unwind-arm.h index ec81237e573b..6eb9d9e45981 100644 --- a/contrib/libcxxrt/unwind-arm.h +++ b/contrib/libcxxrt/unwind-arm.h @@ -97,7 +97,7 @@ struct _Unwind_Exception } pr_cache; /** Force alignment of next item to 8-byte boundary */ long long int :0; -} __attribute__((__aligned__(8))); +}; /* Unwinding functions */ _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *ucbp); diff --git a/contrib/libcxxrt/unwind-itanium.h b/contrib/libcxxrt/unwind-itanium.h index 199d91de283d..1ee0cf0e81c4 100644 --- a/contrib/libcxxrt/unwind-itanium.h +++ b/contrib/libcxxrt/unwind-itanium.h @@ -79,12 +79,9 @@ struct _Unwind_Exception { uint64_t exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; - uintptr_t private_1; - uintptr_t private_2; -#if __SIZEOF_POINTER__ == 4 - uint32_t reserved[3]; -#endif - } __attribute__((__aligned__)); + unsigned long private_1; + unsigned long private_2; + } ; extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EFC857951A; Wed, 10 Mar 2021 22:27: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 4Dwmt373Lfz4lx4; Wed, 10 Mar 2021 22:27: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 E0CEB19722; Wed, 10 Mar 2021 22:27: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 12AMRd7i032333; Wed, 10 Mar 2021 22:27:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMRdZw032332; Wed, 10 Mar 2021 22:27:39 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:39 GMT Message-Id: <202103102227.12AMRdZw032332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 3cff9b2ccfd0 - stable/13 - Do not reference returned ifa in in6_ifawithifp(). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3cff9b2ccfd0b0a2d2309f80bfb98dbd3b025c01 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:40 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=3cff9b2ccfd0b0a2d2309f80bfb98dbd3b025c01 commit 3cff9b2ccfd0b0a2d2309f80bfb98dbd3b025c01 Author: Alexander V. Chernikov AuthorDate: 2021-02-14 10:11:06 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:44:31 +0000 Do not reference returned ifa in in6_ifawithifp(). The only place where in6_ifawithifp() is used is ip6_output(), which uses the returned ifa to bump traffic counters. Given ifa stability guarantees is provided by epoch, do not refcount ifa. This eliminates 2 atomic ops from IPv6 fast path. Reviewed By: rstone Differential Revision: https://reviews.freebsd.org/D28649 (cherry picked from commit 1bd44b11e59f1e9ee7245f8de1f823bc5287b9ef) --- sys/netinet6/in6.c | 14 +++----------- sys/netinet6/ip6_output.c | 1 - 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 48fa8dd2efc6..057c0ee91e02 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1921,10 +1921,8 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) besta = (struct in6_ifaddr *)ifa; } } - if (besta) { - ifa_ref(&besta->ia_ifa); + if (besta) return (besta); - } CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) @@ -1941,20 +1939,14 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst) continue; } - if (ifa != NULL) - ifa_ref(ifa); return (struct in6_ifaddr *)ifa; } /* use the last-resort values, that are, deprecated addresses */ - if (dep[0]) { - ifa_ref((struct ifaddr *)dep[0]); + if (dep[0]) return dep[0]; - } - if (dep[1]) { - ifa_ref((struct ifaddr *)dep[1]); + if (dep[1]) return dep[1]; - } return NULL; } diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index df1e9e6f2dcd..58334788b05b 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1177,7 +1177,6 @@ passout: counter_u64_add(ia6->ia_ifa.ifa_opackets, 1); counter_u64_add(ia6->ia_ifa.ifa_obytes, m->m_pkthdr.len); - ifa_free(&ia6->ia_ifa); } error = ip6_output_send(inp, ifp, origifp, m, dst, ro, (flags & IP_NO_SND_TAG_RL) ? false : true); From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DA3D5794F0; Wed, 10 Mar 2021 22:27:41 +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 4Dwmt50Djtz4lgQ; Wed, 10 Mar 2021 22:27:41 +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 EDB7919242; Wed, 10 Mar 2021 22:27: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 12AMReW6032354; Wed, 10 Mar 2021 22:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMRerA032353; Wed, 10 Mar 2021 22:27:40 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:40 GMT Message-Id: <202103102227.12AMRerA032353@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 4904fbfc7201 - stable/13 - Remove now-unused RTF_RNH_LOCKED route flag. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4904fbfc7201cf670b0351092bd26bfeae776081 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:41 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=4904fbfc7201cf670b0351092bd26bfeae776081 commit 4904fbfc7201cf670b0351092bd26bfeae776081 Author: Alexander V. Chernikov AuthorDate: 2021-02-14 13:45:14 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:45:07 +0000 Remove now-unused RTF_RNH_LOCKED route flag. (cherry picked from commit 64d5c2777731c1376dd44b6a5fdb68b168d073dc) --- sys/net/route.h | 2 +- sys/net/rtsock.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/net/route.h b/sys/net/route.h index f9928ab6a776..ab6e1aabc5ae 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -197,7 +197,7 @@ VNET_DECLARE(u_int, fib_hash_outbound); /* 0x8000000 and up unassigned */ #define RTF_STICKY 0x10000000 /* always route dst->src */ -#define RTF_RNH_LOCKED 0x40000000 /* radix node head is locked */ +/* 0x40000000 unused, was RTF_RNH_LOCKED */ #define RTF_GWFLAG_COMPAT 0x80000000 /* a compatibility bit for interacting with existing routing apps */ diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index ba1182d55439..7beb6ff347fe 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -587,8 +587,6 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fibnum, struct rt_addrinfo * if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, info)) return (EINVAL); - if (rtm->rtm_flags & RTF_RNH_LOCKED) - return (EINVAL); info->rti_flags = rtm->rtm_flags; if (info->rti_info[RTAX_DST] == NULL || info->rti_info[RTAX_DST]->sa_family >= AF_MAX || From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 661B75793B4; Wed, 10 Mar 2021 22: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 4Dwmt773YSz4m2x; Wed, 10 Mar 2021 22:27: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 50F9C192C7; Wed, 10 Mar 2021 22:27: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 12AMRhJi032396; Wed, 10 Mar 2021 22:27:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMRhXU032395; Wed, 10 Mar 2021 22:27:43 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:43 GMT Message-Id: <202103102227.12AMRhXU032395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: f67641675958 - stable/13 - Make in_localip_more() fib-aware. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: f67641675958cb566b0ae50dc6942017d42393fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:44 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=f67641675958cb566b0ae50dc6942017d42393fe commit f67641675958cb566b0ae50dc6942017d42393fe Author: Alexander V. Chernikov AuthorDate: 2021-02-16 20:00:46 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:47:39 +0000 Make in_localip_more() fib-aware. It fixes loopback route installation for the interfaces in the different fibs using the same prefix. Reviewed By: donner PR: 189088 Differential Revision: https://reviews.freebsd.org/D28673 (cherry picked from commit 9fdbf7eef5c006002769add15b1ebb8fa8d9e220) --- sys/netinet/in.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index eb58c3453cfc..bcf071a81e0e 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -163,18 +163,23 @@ in_ifhasaddr(struct ifnet *ifp, struct in_addr in) * the supplied one but with same IP address value. */ static struct in_ifaddr * -in_localip_more(struct in_ifaddr *ia) +in_localip_more(struct in_ifaddr *original_ia) { struct rm_priotracker in_ifa_tracker; - in_addr_t in = IA_SIN(ia)->sin_addr.s_addr; - struct in_ifaddr *it; + in_addr_t original_addr = IA_SIN(original_ia)->sin_addr.s_addr; + uint32_t original_fib = original_ia->ia_ifa.ifa_ifp->if_fib; + struct in_ifaddr *ia; IN_IFADDR_RLOCK(&in_ifa_tracker); - LIST_FOREACH(it, INADDR_HASH(in), ia_hash) { - if (it != ia && IA_SIN(it)->sin_addr.s_addr == in) { - ifa_ref(&it->ia_ifa); + LIST_FOREACH(ia, INADDR_HASH(original_addr), ia_hash) { + in_addr_t addr = IA_SIN(ia)->sin_addr.s_addr; + uint32_t fib = ia->ia_ifa.ifa_ifp->if_fib; + if (!V_rt_add_addr_allfibs && (original_fib != fib)) + continue; + if ((original_ia != ia) && (original_addr == addr)) { + ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(&in_ifa_tracker); - return (it); + return (ia); } } IN_IFADDR_RUNLOCK(&in_ifa_tracker); @@ -1007,11 +1012,6 @@ in_scrubprefix(struct in_ifaddr *target, u_int flags) if (ia_need_loopback_route(target) && (flags & LLE_STATIC)) { struct in_ifaddr *eia; - /* - * XXXME: add fib-aware in_localip. - * We definitely don't want to switch between - * prefixes in different fibs. - */ eia = in_localip_more(target); if (eia != NULL) { From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2E4A579249; Wed, 10 Mar 2021 22:27: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 4Dwmt631svz4lgV; Wed, 10 Mar 2021 22:27: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 2F3B8194B5; Wed, 10 Mar 2021 22:27: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 12AMRgwt032376; Wed, 10 Mar 2021 22:27:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMRgW2032375; Wed, 10 Mar 2021 22:27:42 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:42 GMT Message-Id: <202103102227.12AMRgW2032375@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 3f241e7aac2e - stable/13 - Remove per-packet ifa refcounting from IPv6 fast path. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3f241e7aac2e37d2fa84c240568065cc1de7c635 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:44 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=3f241e7aac2e37d2fa84c240568065cc1de7c635 commit 3f241e7aac2e37d2fa84c240568065cc1de7c635 Author: Alexander V. Chernikov AuthorDate: 2021-02-15 21:59:21 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:45:55 +0000 Remove per-packet ifa refcounting from IPv6 fast path. Currently ip6_input() calls in6ifa_ifwithaddr() for every local packet, in order to check if the target ip belongs to the local ifa in proper state and increase its counters. in6ifa_ifwithaddr() references found ifa. With epoch changes, both `ip6_input()` and all other current callers of `in6ifa_ifwithaddr()` do not need this reference anymore, as epoch provides stability guarantee. Given that, update `in6ifa_ifwithaddr()` to allow it to return ifa without referencing it, while preserving option for getting referenced ifa if so desired. Differential Revision: https://reviews.freebsd.org/D28648 (cherry picked from commit 8268d82cff1bcd7969e5b3c676f28684784a7a43) --- sys/netinet/tcp_input.c | 10 ++-------- sys/netinet6/frag6.c | 6 ++---- sys/netinet6/icmp6.c | 8 ++------ sys/netinet6/in6.c | 7 ++++--- sys/netinet6/in6_ifattach.c | 4 +--- sys/netinet6/in6_src.c | 8 ++------ sys/netinet6/in6_var.h | 2 +- sys/netinet6/ip6_input.c | 4 +--- sys/netinet6/send.c | 10 +++++++--- 9 files changed, 22 insertions(+), 37 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index e000c589c78e..4b0f102ca51b 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -593,16 +593,13 @@ tcp6_input(struct mbuf **mp, int *offp, int proto) * better place to put this in? */ ip6 = mtod(m, struct ip6_hdr *); - ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); if (ia6 && (ia6->ia6_flags & IN6_IFF_ANYCAST)) { - ifa_free(&ia6->ia_ifa); icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR, (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); *mp = NULL; return (IPPROTO_DONE); } - if (ia6) - ifa_free(&ia6->ia_ifa); *mp = m; return (tcp_input(mp, offp, proto)); @@ -1250,10 +1247,9 @@ tfo_socket_result: if (isipv6 && !V_ip6_use_deprecated) { struct in6_ifaddr *ia6; - ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); if (ia6 != NULL && (ia6->ia6_flags & IN6_IFF_DEPRECATED)) { - ifa_free(&ia6->ia_ifa); if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) log(LOG_DEBUG, "%s; %s: Listen socket: " "Connection attempt to deprecated " @@ -1262,8 +1258,6 @@ tfo_socket_result: rstreason = BANDLIM_RST_OPENPORT; goto dropwithreset; } - if (ia6) - ifa_free(&ia6->ia_ifa); } #endif /* INET6 */ /* diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index c22e931dee33..f227930743b7 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -396,11 +396,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) dstifp = NULL; /* Find the destination interface of the packet. */ - ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); - if (ia6 != NULL) { + ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); + if (ia6 != NULL) dstifp = ia6->ia_ifp; - ifa_free(&ia6->ia_ifa); - } /* Jumbo payload cannot contain a fragment header. */ if (ip6->ip6_plen == 0) { diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 1a08dad7de64..0f55d4ddee54 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1218,19 +1218,17 @@ ni6_input(struct mbuf *m, int off, struct prison *pr) goto bad; /* else it's a link-local multicast, fine */ } else { /* unicast or anycast */ - ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); if (ia6 == NULL) goto bad; /* XXX impossible */ if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) && !(V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK)) { - ifa_free(&ia6->ia_ifa); nd6log((LOG_DEBUG, "ni6_input: ignore node info to " "a temporary address in %s:%d", __FILE__, __LINE__)); goto bad; } - ifa_free(&ia6->ia_ifa); } /* validate query Subject field. */ @@ -2101,7 +2099,7 @@ icmp6_reflect(struct mbuf *m, size_t off) * destined to a duplicated address of ours. */ if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { - ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); if (ia != NULL && !(ia->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY))) { src6 = ia->ia_addr.sin6_addr; @@ -2113,8 +2111,6 @@ icmp6_reflect(struct mbuf *m, size_t off) } else hlim = V_ip6_defhlim; } - if (ia != NULL) - ifa_free(&ia->ia_ifa); } if (srcp == NULL) { diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 057c0ee91e02..4665a21c28fd 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1550,10 +1550,10 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignoreflags) /* * find the interface address corresponding to a given IPv6 address. - * ifaddr is returned referenced. + * ifaddr is returned referenced if @referenced flag is set. */ struct in6_ifaddr * -in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid) +in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid, bool referenced) { struct rm_priotracker in6_ifa_tracker; struct in6_ifaddr *ia; @@ -1564,7 +1564,8 @@ in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid) if (zoneid != 0 && zoneid != ia->ia_addr.sin6_scope_id) continue; - ifa_ref(&ia->ia_ifa); + if (referenced) + ifa_ref(&ia->ia_ifa); break; } } diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 1a07fb13b179..02d6a2b230b4 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -713,11 +713,9 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) /* * check that loopback address doesn't exist yet. */ - ia = in6ifa_ifwithaddr(&in6addr_loopback, 0); + ia = in6ifa_ifwithaddr(&in6addr_loopback, 0, false); if (ia == NULL) in6_ifattach_loopback(ifp); - else - ifa_free(&ia->ia_ifa); } /* diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 7a756030f01c..c0c64e7b1a3e 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -251,15 +251,11 @@ in6_selectsrc(uint32_t fibnum, struct sockaddr_in6 *dstsock, * ancillary data. */ if ((inp->inp_flags & INP_BINDANY) == 0) { - ia = in6ifa_ifwithaddr(&tmp, 0 /* XXX */); + ia = in6ifa_ifwithaddr(&tmp, 0 /* XXX */, false); if (ia == NULL || (ia->ia6_flags & (IN6_IFF_ANYCAST | - IN6_IFF_NOTREADY))) { - if (ia != NULL) - ifa_free(&ia->ia_ifa); + IN6_IFF_NOTREADY))) return (EADDRNOTAVAIL); - } bcopy(&ia->ia_addr.sin6_addr, srcp, sizeof(*srcp)); - ifa_free(&ia->ia_ifa); } else bcopy(&tmp, srcp, sizeof(*srcp)); pi->ipi6_addr = tmp; /* XXX: this overrides pi */ diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 5f4364c6fba0..1caa4511a2b1 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -899,7 +899,7 @@ void in6_setmaxmtu(void); int in6_if2idlen(struct ifnet *); struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, const struct in6_addr *); -struct in6_ifaddr *in6ifa_ifwithaddr(const struct in6_addr *, uint32_t); +struct in6_ifaddr *in6ifa_ifwithaddr(const struct in6_addr *, uint32_t, bool); struct in6_ifaddr *in6ifa_llaonifp(struct ifnet *); int in6_addr2zoneid(struct ifnet *, struct in6_addr *, u_int32_t *); int in6_matchlen(struct in6_addr *, struct in6_addr *); diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 8f500cb87bfe..80e5acc62548 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -803,7 +803,7 @@ passin: * XXX: For now we keep link-local IPv6 addresses with embedded * scope zone id, therefore we use zero zoneid here. */ - ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); if (ia != NULL) { if (ia->ia6_flags & IN6_IFF_NOTREADY) { char ip6bufs[INET6_ADDRSTRLEN]; @@ -813,13 +813,11 @@ passin: "ip6_input: packet to an unready address %s->%s\n", ip6_sprintf(ip6bufs, &ip6->ip6_src), ip6_sprintf(ip6bufd, &ip6->ip6_dst))); - ifa_free(&ia->ia_ifa); goto bad; } /* Count the packet in the ip address stats */ counter_u64_add(ia->ia_ifa.ifa_ipackets, 1); counter_u64_add(ia->ia_ifa.ifa_ibytes, m->m_pkthdr.len); - ifa_free(&ia->ia_ifa); ours = 1; goto hbhcheck; } diff --git a/sys/netinet6/send.c b/sys/netinet6/send.c index bc9880c82267..e993a3b50aec 100644 --- a/sys/netinet6/send.c +++ b/sys/netinet6/send.c @@ -116,6 +116,7 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) struct sockaddr_in6 dst; struct icmp6_hdr *icmp6; int icmp6len; + int error; /* * Receive incoming (SeND-protected) or outgoing traffic @@ -142,12 +143,14 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) ip6 = mtod(m, struct ip6_hdr *); icmp6 = (struct icmp6_hdr *)(ip6 + 1); + error = 0; /* * Output the packet as icmp6.c:icpm6_input() would do. * The mbuf is always consumed, so we do not have to * care about that. */ + NET_EPOCH_ENTER(et); switch (icmp6->icmp6_type) { case ND_NEIGHBOR_SOLICIT: nd6_ns_input(m, sizeof(struct ip6_hdr), icmp6len); @@ -166,9 +169,11 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) break; default: m_freem(m); - return (ENOSYS); + error = ENOSYS; } - return (0); + NET_EPOCH_EXIT(et); + + return (error); case SND_OUT: if (m->m_len < sizeof(struct ip6_hdr)) { @@ -196,7 +201,6 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) * XXX-BZ as we added data, what about fragmenting, * if now needed? */ - int error; error = ((*ifp->if_output)(ifp, m, (struct sockaddr *)&dst, NULL)); if (error) From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 305795791D6; Wed, 10 Mar 2021 22:27: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 4Dwmt94rTpz4ljg; Wed, 10 Mar 2021 22:27: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 6E5671979A; Wed, 10 Mar 2021 22: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 12AMRien032416; Wed, 10 Mar 2021 22: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 12AMRimd032415; Wed, 10 Mar 2021 22:27:44 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:44 GMT Message-Id: <202103102227.12AMRimd032415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d9bcd8e7a2dd - stable/13 - Add ifa_try_ref() to simplify ifa handling inside epoch. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d9bcd8e7a2dd77969f8ac940fe8ec5e90588e3ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:48 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d9bcd8e7a2dd77969f8ac940fe8ec5e90588e3ea commit d9bcd8e7a2dd77969f8ac940fe8ec5e90588e3ea Author: Alexander V. Chernikov AuthorDate: 2021-02-16 20:12:58 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:47:54 +0000 Add ifa_try_ref() to simplify ifa handling inside epoch. More and more code migrates from lock-based protection to the NET_EPOCH umbrella. It requires some logic changes, including, notably, refcount handling. When we have an `ifa` pointer and we're running inside epoch we're guaranteed that this pointer will not be freed. However, the following case can still happen: * in thread 1 we drop to 0 refcount for ifa and schedule its deletion. * in thread 2 we use this ifa and reference it * destroy callout kicks in * unhappy user reports bug To address it, new `ifa_try_ref()` function is added, allowing to return failure when we try to reference `ifa` with 0 refcount. Additionally, existing `ifa_ref()` is enforced with `KASSERT` to provide cleaner error in such scenarious. Reviewed By: rstone, donner Differential Revision: https://reviews.freebsd.org/D28639 (cherry picked from commit 600eade2fb4faacfcd408a01140ef15f85f0c817) --- sys/net/if.c | 12 +++++++++++- sys/net/if_var.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/net/if.c b/sys/net/if.c index c85cfab19bf6..948be6876b65 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1857,8 +1857,18 @@ fail: void ifa_ref(struct ifaddr *ifa) { + u_int old; - refcount_acquire(&ifa->ifa_refcnt); + old = refcount_acquire(&ifa->ifa_refcnt); + KASSERT(old > 0, ("%s: ifa %p has 0 refs", __func__, ifa)); +} + +int +ifa_try_ref(struct ifaddr *ifa) +{ + + NET_EPOCH_ASSERT(); + return (refcount_acquire_if_not_zero(&ifa->ifa_refcnt)); } static void diff --git a/sys/net/if_var.h b/sys/net/if_var.h index beb9596895ee..bb364fd10974 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -575,6 +575,7 @@ struct ifaddr { struct ifaddr * ifa_alloc(size_t size, int flags); void ifa_free(struct ifaddr *ifa); void ifa_ref(struct ifaddr *ifa); +int ifa_try_ref(struct ifaddr *ifa); /* * Multicast address structure. This is analogous to the ifaddr From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C4465792C3; Wed, 10 Mar 2021 22:27: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 4DwmtC3Wrrz4m0t; Wed, 10 Mar 2021 22:27: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 9C2C21979B; Wed, 10 Mar 2021 22:27: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 12AMRjQC032438; Wed, 10 Mar 2021 22:27:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMRju9032437; Wed, 10 Mar 2021 22:27:45 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:45 GMT Message-Id: <202103102227.12AMRju9032437@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: e1bdecd9f60a - stable/13 - Fix dst/netmask handling in routing socket code. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e1bdecd9f60a80604a351e38cab7cfc56e308c66 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:50 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=e1bdecd9f60a80604a351e38cab7cfc56e308c66 commit e1bdecd9f60a80604a351e38cab7cfc56e308c66 Author: Alexander V. Chernikov AuthorDate: 2021-02-16 20:30:04 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:48:06 +0000 Fix dst/netmask handling in routing socket code. Traditionally routing socket code did almost zero checks on the input message except for the most basic size checks. This resulted in the unclear KPI boundary for the routing system code (`rtrequest*` and now `rib_action()`) w.r.t message validness. Multiple potential problems and nuances exists: * Host bits in RTAX_DST sockaddr. Existing applications do send prefixes with hostbits uncleared. Even `route(8)` does this, as they hope the kernel would do the job of fixing it. Code inside `rib_action()` needs to handle it on its own (see `rt_maskedcopy()` ugly hack). * There are multiple way of adding the host route: it can be DST without netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be set correspondingly. Currently, these 2 options create 2 DIFFERENT routes in the kernel. * no sockaddr length/content checking for the "secondary" fields exists: nothing stops rtsock application to send sockaddr_in with length of 25 (instead of 16). Kernel will accept it, install to RIB as is and propagate to all rtsock consumers, potentially triggering bugs in their code. Same goes for sin_port, sin_zero, etc. The goal of this change is to make rtsock verify all sockaddr and prefix consistency. Said differently, `rib_action()` or internals should NOT require to change any of the sockaddrs supplied by `rt_addrinfo` structure due to incorrectness. To be more specific, this change implements the following: * sockaddr cleanup/validation check is added immediately after getting sockaddrs from rtm. * Per-family dst/netmask checks clears host bits in dst and zeros all dst/netmask "secondary" fields. * The same netmask checking code converts /32(/128) netmasks to "host" route case (NULL netmask, RTF_HOST), removing the dualism. * Instead of allowing ANY "known" sockaddr families (0<.. Reviewed By: donner Differential Revision: https://reviews.freebsd.org/D28668 (cherry picked from commit 2fe5a79425c79f7b828acd91da66d97230925fc8) --- sys/net/rtsock.c | 201 +++++++++++++++++++++++++++++++++- tests/sys/net/routing/rtsock_common.h | 4 - 2 files changed, 195 insertions(+), 10 deletions(-) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 7beb6ff347fe..5181ef273385 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -70,6 +70,7 @@ #include #include #ifdef INET6 +#include #include #include #endif @@ -173,6 +174,7 @@ static int rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *plen); static int rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo); +static int cleanup_xaddrs(struct rt_addrinfo *info); static int sysctl_dumpentry(struct rtentry *rt, void *vw); static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, uint32_t weight, struct walkarg *w); @@ -588,11 +590,9 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fibnum, struct rt_addrinfo * return (EINVAL); info->rti_flags = rtm->rtm_flags; - if (info->rti_info[RTAX_DST] == NULL || - info->rti_info[RTAX_DST]->sa_family >= AF_MAX || - (info->rti_info[RTAX_GATEWAY] != NULL && - info->rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) - return (EINVAL); + error = cleanup_xaddrs(info); + if (error != 0) + return (error); saf = info->rti_info[RTAX_DST]->sa_family; /* * Verify that the caller has the appropriate privilege; RTM_GET @@ -691,7 +691,14 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, RIB_RLOCK(rnh); - if (info->rti_info[RTAX_NETMASK] == NULL) { + /* + * By (implicit) convention host route (one without netmask) + * means longest-prefix-match request and the route with netmask + * means exact-match lookup. + * As cleanup_xaddrs() cleans up info flags&addrs for the /32,/128 + * prefixes, use original data to check for the netmask presence. + */ + if ((rtm->rtm_addrs & RTA_NETMASK) == 0) { /* * Provide longest prefix match for * address lookup (no mask). @@ -1228,6 +1235,188 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo) return (0); } +static inline void +fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) +{ + + const struct sockaddr_in nsin = { + .sin_family = AF_INET, + .sin_len = sizeof(struct sockaddr_in), + .sin_addr = addr, + }; + *sin = nsin; +} + +static inline void +fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr *addr6, + uint32_t scopeid) +{ + + const struct sockaddr_in6 nsin6 = { + .sin6_family = AF_INET6, + .sin6_len = sizeof(struct sockaddr_in6), + .sin6_addr = *addr6, + .sin6_scope_id = scopeid, + }; + *sin6 = nsin6; +} + +static int +cleanup_xaddrs_gateway(struct rt_addrinfo *info) +{ + struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; + + switch (gw->sa_family) { +#ifdef INET + case AF_INET: + { + struct sockaddr_in *gw_sin = (struct sockaddr_in *)gw; + if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { + printf("gw sin_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); + } + break; +#endif +#ifdef INET6 + case AF_INET6: + { + struct sockaddr_in6 *gw_sin6 = (struct sockaddr_in6 *)gw; + if (gw_sin6->sin6_len < sizeof(struct sockaddr_in6)) { + printf("gw sin6_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet6(gw_sin6, &gw_sin6->sin6_addr, 0); + break; + } +#endif + case AF_LINK: + { + struct sockaddr_dl_short *gw_sdl; + + gw_sdl = (struct sockaddr_dl_short *)gw; + if (gw_sdl->sdl_len < sizeof(struct sockaddr_dl_short)) { + printf("gw sdl_len too small\n"); + return (EINVAL); + } + + const struct sockaddr_dl_short sdl = { + .sdl_family = AF_LINK, + .sdl_len = sizeof(struct sockaddr_dl_short), + .sdl_index = gw_sdl->sdl_index, + }; + *gw_sdl = sdl; + break; + } + } + + return (0); +} + +static int +cleanup_xaddrs_inet(struct rt_addrinfo *info) +{ + struct sockaddr_in *dst_sa, *mask_sa; + + /* Check & fixup dst/netmask combination first */ + dst_sa = (struct sockaddr_in *)info->rti_info[RTAX_DST]; + mask_sa = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; + + struct in_addr mask = { + .s_addr = mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST, + }; + struct in_addr dst = { + .s_addr = htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s_addr)) + }; + + if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { + printf("dst sin_len too small\n"); + return (EINVAL); + } + if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { + printf("mask sin_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet(dst_sa, dst); + + if (mask.s_addr != INADDR_BROADCAST) + fill_sockaddr_inet(mask_sa, mask); + else { + info->rti_info[RTAX_NETMASK] = NULL; + info->rti_flags |= RTF_HOST; + info->rti_addrs &= ~RTA_NETMASK; + } + + /* Check gateway */ + if (info->rti_info[RTAX_GATEWAY] != NULL) + return (cleanup_xaddrs_gateway(info)); + + return (0); +} + +static int +cleanup_xaddrs_inet6(struct rt_addrinfo *info) +{ + struct sockaddr_in6 *dst_sa, *mask_sa; + struct in6_addr mask; + + /* Check & fixup dst/netmask combination first */ + dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; + mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]; + + mask = mask_sa ? mask_sa->sin6_addr : in6mask128; + IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); + + if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { + printf("dst sin6_len too small\n"); + return (EINVAL); + } + if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) { + printf("mask sin6_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); + + if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) + fill_sockaddr_inet6(mask_sa, &mask, 0); + else { + info->rti_info[RTAX_NETMASK] = NULL; + info->rti_flags |= RTF_HOST; + info->rti_addrs &= ~RTA_NETMASK; + } + + /* Check gateway */ + if (info->rti_info[RTAX_GATEWAY] != NULL) + return (cleanup_xaddrs_gateway(info)); + + return (0); +} + +static int +cleanup_xaddrs(struct rt_addrinfo *info) +{ + int error = EAFNOSUPPORT; + + if (info->rti_info[RTAX_DST] == NULL) + return (EINVAL); + + switch (info->rti_info[RTAX_DST]->sa_family) { +#ifdef INET + case AF_INET: + error = cleanup_xaddrs_inet(info); + break; +#endif +#ifdef INET6 + case AF_INET6: + error = cleanup_xaddrs_inet6(info); + break; +#endif + } + + return (error); +} + /* * Fill in @dmask with valid netmask leaving original @smask * intact. Mostly used with radix netmasks. diff --git a/tests/sys/net/routing/rtsock_common.h b/tests/sys/net/routing/rtsock_common.h index 7da88e0eb512..71476d2b5f3c 100644 --- a/tests/sys/net/routing/rtsock_common.h +++ b/tests/sys/net/routing/rtsock_common.h @@ -826,10 +826,6 @@ _validate_message_sockaddrs(char *buffer, int rtm_len, size_t offset, int rtm_ad } sa = (struct sockaddr *)((char *)sa + SA_SIZE(sa)); } - - RTSOCK_ATF_REQUIRE_MSG((struct rt_msghdr *)buffer, parsed_len == rtm_len, - "message len != parsed len: expected %d parsed %d", - rtm_len, (int)parsed_len); } /* From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BA1A57936F; Wed, 10 Mar 2021 22:27: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 4DwmtG3K3Pz4m3P; Wed, 10 Mar 2021 22:27: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 BCA891933F; Wed, 10 Mar 2021 22:27: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 12AMRkot032460; Wed, 10 Mar 2021 22:27:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMRkIx032459; Wed, 10 Mar 2021 22:27:46 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:46 GMT Message-Id: <202103102227.12AMRkIx032459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 6c3f613b6e65 - stable/13 - Fix NOINET6 build broken by 2fe5a79425c7. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6c3f613b6e65d78ee7a836895f5569ee1ac604e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:55 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=6c3f613b6e65d78ee7a836895f5569ee1ac604e2 commit 6c3f613b6e65d78ee7a836895f5569ee1ac604e2 Author: Alexander V. Chernikov AuthorDate: 2021-02-16 21:49:48 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:48:14 +0000 Fix NOINET6 build broken by 2fe5a79425c7. Reported by: mjg (cherry picked from commit a4513bace0e0c38d38b0c49c1daea60f2741d781) --- sys/net/rtsock.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 5181ef273385..011f07803bfa 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1235,6 +1235,7 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo) return (0); } +#ifdef INET static inline void fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) { @@ -1246,7 +1247,9 @@ fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) }; *sin = nsin; } +#endif +#ifdef INET6 static inline void fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr *addr6, uint32_t scopeid) @@ -1260,6 +1263,7 @@ fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr *addr6, }; *sin6 = nsin6; } +#endif static int cleanup_xaddrs_gateway(struct rt_addrinfo *info) @@ -1314,6 +1318,7 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) return (0); } +#ifdef INET static int cleanup_xaddrs_inet(struct rt_addrinfo *info) { @@ -1354,7 +1359,9 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info) return (0); } +#endif +#ifdef INET6 static int cleanup_xaddrs_inet6(struct rt_addrinfo *info) { @@ -1392,6 +1399,7 @@ cleanup_xaddrs_inet6(struct rt_addrinfo *info) return (0); } +#endif static int cleanup_xaddrs(struct rt_addrinfo *info) From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2766E5792C6; Wed, 10 Mar 2021 22:27: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 4DwmtG3JlVz4m9g; Wed, 10 Mar 2021 22:27: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 E497D1979C; Wed, 10 Mar 2021 22:27: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 12AMRmiZ032500; Wed, 10 Mar 2021 22:27:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMRmG8032499; Wed, 10 Mar 2021 22:27:48 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:48 GMT Message-Id: <202103102227.12AMRmG8032499@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 5b64694c8a55 - stable/13 - Fix setting static entries for arp/ndp. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5b64694c8a5576d3fa77822da214b7bc49e5cdec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:55 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=5b64694c8a5576d3fa77822da214b7bc49e5cdec commit 5b64694c8a5576d3fa77822da214b7bc49e5cdec Author: Alexander V. Chernikov AuthorDate: 2021-02-20 18:21:52 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:48:30 +0000 Fix setting static entries for arp/ndp. rtsock message validation changes committed in 2fe5a79425c7 did not take llinfo messages into account. Add a special validation case for RTA_GATEWAY llinfo messages. (cherry picked from commit e5b394f2d0d94f190c9da2346fd22d7c6fb14730) --- sys/net/if_llatbl.c | 1 + sys/net/rtsock.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 97a8e3e9ccc1..7225869a07d0 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -693,6 +693,7 @@ lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinfo *info) if (dl == NULL || dl->sdl_family != AF_LINK) return (EINVAL); + /* XXX: should be ntohs() */ ifp = ifnet_byindex(dl->sdl_index); if (ifp == NULL) { log(LOG_INFO, "%s: invalid ifp (sdl_index %d)\n", diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 939e628f0f62..09d31f8f8076 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1265,11 +1265,37 @@ fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr *addr6, } #endif +/* + * Checks if gateway is suitable for lltable operations. + * Lltable code requires AF_LINK gateway with ifindex + * and mac address specified. + * Returns 0 on success. + */ +static int +cleanup_xaddrs_lladdr(struct rt_addrinfo *info) +{ + struct sockaddr_dl *sdl = (struct sockaddr_dl *)info->rti_info[RTAX_GATEWAY]; + + if (sdl->sdl_family != AF_LINK) + return (EINVAL); + + if (sdl->sdl_index == 0) + return (EINVAL); + + if (offsetof(struct sockaddr_dl, sdl_data) + sdl->sdl_nlen + sdl->sdl_alen > sdl->sdl_len) + return (EINVAL); + + return (0); +} + static int cleanup_xaddrs_gateway(struct rt_addrinfo *info) { struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; + if (info->rti_flags & RTF_LLDATA) + return (cleanup_xaddrs_lladdr(info)); + switch (gw->sa_family) { #ifdef INET case AF_INET: From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B17F57936E; Wed, 10 Mar 2021 22:27: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 4DwmtG3KkGz4lpT; Wed, 10 Mar 2021 22:27: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 BC9F119535; Wed, 10 Mar 2021 22:27: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 12AMRlH3032478; Wed, 10 Mar 2021 22:27:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMRlAS032477; Wed, 10 Mar 2021 22:27:47 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:47 GMT Message-Id: <202103102227.12AMRlAS032477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 22f24233ba2a - stable/13 - Fix arp/ndp deletion broken by 2fe5a79425c7. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 22f24233ba2a5e7163908507d955eefe76051822 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:56 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=22f24233ba2a5e7163908507d955eefe76051822 commit 22f24233ba2a5e7163908507d955eefe76051822 Author: Alexander V. Chernikov AuthorDate: 2021-02-19 21:09:17 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:48:24 +0000 Fix arp/ndp deletion broken by 2fe5a79425c7. Changes in the 2fe5a79425c7 moved dst sockaddr masking from the routing control plane to the rtsock code. It broke arp/ndp deletion. It turns out, arp/ndp perform RTM_GET request first to get an interface index necessary for the deletion. Then they simply stamp the reply with RTF_LLDATA and set the command to RTM_DELETE. As a result, kernel receives request with non-empty RTA_NETMASK and clears RTA_DST host bits before passing the message to the lla code. De facto, the only needed bits are RTA_DST, RTA_GATEWAY and the subset of rtm_flags. With that in mind, fix the interace by clearing RTA_NETMASK for every messages with RTF_LLDATA. While here, cleanup arp/ndp code a bit. Reviewed by: gnn Differential Revision: https://reviews.freebsd.org/D28804 (cherry picked from commit f9e1cd6c99200846b324a8b65f7f31ded74013bd) --- sys/net/rtsock.c | 31 +++++++++++++++++++++---------- usr.sbin/arp/arp.c | 9 --------- usr.sbin/ndp/ndp.c | 10 ---------- 3 files changed, 21 insertions(+), 29 deletions(-) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 011f07803bfa..939e628f0f62 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1318,6 +1318,14 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) return (0); } +static void +remove_netmask(struct rt_addrinfo *info) +{ + info->rti_info[RTAX_NETMASK] = NULL; + info->rti_flags |= RTF_HOST; + info->rti_addrs &= ~RTA_NETMASK; +} + #ifdef INET static int cleanup_xaddrs_inet(struct rt_addrinfo *info) @@ -1347,11 +1355,8 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info) if (mask.s_addr != INADDR_BROADCAST) fill_sockaddr_inet(mask_sa, mask); - else { - info->rti_info[RTAX_NETMASK] = NULL; - info->rti_flags |= RTF_HOST; - info->rti_addrs &= ~RTA_NETMASK; - } + else + remove_netmask(info); /* Check gateway */ if (info->rti_info[RTAX_GATEWAY] != NULL) @@ -1387,11 +1392,8 @@ cleanup_xaddrs_inet6(struct rt_addrinfo *info) if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) fill_sockaddr_inet6(mask_sa, &mask, 0); - else { - info->rti_info[RTAX_NETMASK] = NULL; - info->rti_flags |= RTF_HOST; - info->rti_addrs &= ~RTA_NETMASK; - } + else + remove_netmask(info); /* Check gateway */ if (info->rti_info[RTAX_GATEWAY] != NULL) @@ -1409,6 +1411,15 @@ cleanup_xaddrs(struct rt_addrinfo *info) if (info->rti_info[RTAX_DST] == NULL) return (EINVAL); + if (info->rti_flags & RTF_LLDATA) { + /* + * arp(8)/ndp(8) sends RTA_NETMASK for the associated + * prefix along with the actual address in RTA_DST. + * Remove netmask to avoid unnecessary address masking. + */ + remove_netmask(info); + } + switch (info->rti_info[RTAX_DST]->sa_family) { #ifdef INET case AF_INET: diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 07e07f1f2da9..08698c7bc299 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -717,7 +717,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) static int seq; int rlen; int l; - struct sockaddr_in so_mask, *som = &so_mask; static int s = -1; static pid_t pid; @@ -735,9 +734,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) xo_err(1, "socket"); pid = getpid(); } - bzero(&so_mask, sizeof(so_mask)); - so_mask.sin_len = 8; - so_mask.sin_addr.s_addr = 0xffffffff; errno = 0; /* @@ -758,10 +754,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) rtm->rtm_rmx.rmx_expire = expire_time; rtm->rtm_inits = RTV_EXPIRE; rtm->rtm_flags |= (RTF_HOST | RTF_STATIC | RTF_LLDATA); - if (doing_proxy) { - rtm->rtm_addrs |= RTA_NETMASK; - rtm->rtm_flags &= ~RTF_HOST; - } /* FALLTHROUGH */ case RTM_GET: rtm->rtm_addrs |= RTA_DST; @@ -776,7 +768,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) NEXTADDR(RTA_DST, dst); NEXTADDR(RTA_GATEWAY, sdl); - NEXTADDR(RTA_NETMASK, som); rtm->rtm_msglen = cp - (char *)&m_rtmsg; doit: diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index aa40e2775a59..ce21e34417c3 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -860,12 +860,6 @@ rtmsg(int cmd) rtm->rtm_inits = RTV_EXPIRE; } rtm->rtm_flags |= (RTF_HOST | RTF_STATIC | RTF_LLDATA); -#if 0 /* we don't support ipv6addr/128 type proxying */ - if (rtm->rtm_flags & RTF_ANNOUNCE) { - rtm->rtm_flags &= ~RTF_HOST; - rtm->rtm_addrs |= RTA_NETMASK; - } -#endif /* FALLTHROUGH */ case RTM_GET: rtm->rtm_addrs |= RTA_DST; @@ -873,10 +867,6 @@ rtmsg(int cmd) NEXTADDR(RTA_DST, sin_m); NEXTADDR(RTA_GATEWAY, sdl_m); -#if 0 /* we don't support ipv6addr/128 type proxying */ - memset(&so_mask.sin6_addr, 0xff, sizeof(so_mask.sin6_addr)); - NEXTADDR(RTA_NETMASK, so_mask); -#endif rtm->rtm_msglen = cp - (char *)&m_rtmsg; doit: From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCC2F5793CB; Wed, 10 Mar 2021 22:27: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 4DwmtH4WJSz4m5D; Wed, 10 Mar 2021 22:27: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 2A7EF194B6; Wed, 10 Mar 2021 22:27: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 12AMRpdn032542; Wed, 10 Mar 2021 22:27:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMRppE032541; Wed, 10 Mar 2021 22:27:51 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:51 GMT Message-Id: <202103102227.12AMRppE032541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 9cd7f222d5c9 - stable/13 - Enforce net epoch in in6_selectsrc(). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9cd7f222d5c9d03371b8941fb9150007dfdd1638 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:58 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=9cd7f222d5c9d03371b8941fb9150007dfdd1638 commit 9cd7f222d5c9d03371b8941fb9150007dfdd1638 Author: Alexander V. Chernikov AuthorDate: 2021-02-13 14:32:10 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:57:59 +0000 Enforce net epoch in in6_selectsrc(). in6_selectsrc() may call fib6_lookup() in some cases, which requires epoch. Wrap in6_selectsrc* calls into epoch inside its users. Mark it as requiring epoch by adding NET_EPOCH_ASSERT(). Differential Revision: https://reviews.freebsd.org/D28647 (cherry picked from commit 605284b894748d23136b30a202689493d8f8af52) --- sys/fs/nfsclient/nfs_clport.c | 3 +++ sys/netinet6/icmp6.c | 3 +++ sys/netinet6/in6_pcb.c | 3 +++ sys/netinet6/in6_src.c | 1 + sys/netinet6/nd6_nbr.c | 4 ++++ sys/netinet6/raw_ip6.c | 5 +++++ sys/netinet6/send.c | 3 +++ 7 files changed, 22 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 9c0ac5c4364e..81a0e05c3234 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1006,15 +1006,18 @@ nfscl_getmyip(struct nfsmount *nmp, struct in6_addr *paddr, int *isinet6p) #endif #ifdef INET6 if (nmp->nm_nam->sa_family == AF_INET6) { + struct epoch_tracker et; struct sockaddr_in6 *sin6; int error; sin6 = (struct sockaddr_in6 *)nmp->nm_nam; + NET_EPOCH_ENTER(et); CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred)); error = in6_selectsrc_addr(fibnum, &sin6->sin6_addr, sin6->sin6_scope_id, NULL, paddr, NULL); CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); if (error != 0) return (NULL); diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 0f55d4ddee54..e17f82a54951 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -260,6 +260,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) { struct ip6_hdr *oip6, *nip6; struct icmp6_hdr *icmp6; + struct epoch_tracker et; u_int preplen; int off; int nxt; @@ -379,7 +380,9 @@ icmp6_error(struct mbuf *m, int type, int code, int param) icmp6->icmp6_pptr = htonl((u_int32_t)param); ICMP6STAT_INC(icp6s_outhist[type]); + NET_EPOCH_ENTER(et); icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */ + NET_EPOCH_EXIT(et); return; diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 567a7918f159..5fce9fcafa33 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -352,6 +352,7 @@ in6_pcbladdr(struct inpcb *inp, struct sockaddr *nam, int error = 0; int scope_ambiguous = 0; struct in6_addr in6a; + struct epoch_tracker et; INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); /* XXXRW: why? */ @@ -379,8 +380,10 @@ in6_pcbladdr(struct inpcb *inp, struct sockaddr *nam, if ((error = prison_remote_ip6(inp->inp_cred, &sin6->sin6_addr)) != 0) return (error); + NET_EPOCH_ENTER(et); error = in6_selectsrc_socket(sin6, inp->in6p_outputopts, inp, inp->inp_cred, scope_ambiguous, &in6a, NULL); + NET_EPOCH_EXIT(et); if (error) return (error); diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index c0c64e7b1a3e..7f623709de13 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -191,6 +191,7 @@ in6_selectsrc(uint32_t fibnum, struct sockaddr_in6 *dstsock, int error; struct ip6_moptions *mopts; + NET_EPOCH_ASSERT(); KASSERT(srcp != NULL, ("%s: srcp is NULL", __func__)); dst = dstsock->sin6_addr; /* make a copy for local operation */ diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index ab55c4dfc697..42e901bdd2a4 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -413,6 +413,8 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6, int maxlen; caddr_t mac; + NET_EPOCH_ASSERT(); + if (IN6_IS_ADDR_MULTICAST(taddr6)) return; @@ -947,6 +949,8 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0, struct in6_addr daddr6, dst6, src6; uint32_t scopeid; + NET_EPOCH_ASSERT(); + int icmp6len, maxlen, error; caddr_t mac = NULL; diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index aea99add4391..8d71c40455a1 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -478,8 +478,10 @@ rip6_output(struct mbuf *m, struct socket *so, ...) /* * Source address selection. */ + NET_EPOCH_ENTER(et); error = in6_selectsrc_socket(dstsock, optp, inp, so->so_cred, scope_ambiguous, &in6a, &hlim); + NET_EPOCH_EXIT(et); if (error) goto bad; @@ -795,6 +797,7 @@ rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) struct inpcb *inp; struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; struct in6_addr in6a; + struct epoch_tracker et; int error = 0, scope_ambiguous = 0; inp = sotoinpcb(so); @@ -823,8 +826,10 @@ rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) INP_INFO_WLOCK(&V_ripcbinfo); INP_WLOCK(inp); /* Source address selection. XXX: need pcblookup? */ + NET_EPOCH_ENTER(et); error = in6_selectsrc_socket(addr, inp->in6p_outputopts, inp, so->so_cred, scope_ambiguous, &in6a, NULL); + NET_EPOCH_EXIT(et); if (error) { INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_ripcbinfo); diff --git a/sys/netinet6/send.c b/sys/netinet6/send.c index e993a3b50aec..642529cc6beb 100644 --- a/sys/netinet6/send.c +++ b/sys/netinet6/send.c @@ -115,6 +115,7 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) struct ip6_hdr *ip6; struct sockaddr_in6 dst; struct icmp6_hdr *icmp6; + struct epoch_tracker et; int icmp6len; int error; @@ -153,7 +154,9 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) NET_EPOCH_ENTER(et); switch (icmp6->icmp6_type) { case ND_NEIGHBOR_SOLICIT: + NET_EPOCH_ENTER(et); nd6_ns_input(m, sizeof(struct ip6_hdr), icmp6len); + NET_EPOCH_EXIT(et); break; case ND_NEIGHBOR_ADVERT: nd6_na_input(m, sizeof(struct ip6_hdr), icmp6len); From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:27:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C9B15792C7; Wed, 10 Mar 2021 22:27: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 4DwmtG3HY4z4lmN; Wed, 10 Mar 2021 22:27: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 1567D19536; Wed, 10 Mar 2021 22:27: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 12AMRndw032524; Wed, 10 Mar 2021 22:27:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMRn7Z032523; Wed, 10 Mar 2021 22:27:49 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:27:49 GMT Message-Id: <202103102227.12AMRn7Z032523@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 8a25d3f6ce34 - stable/13 - Fix dpdk/ldradix fib lookup algorithm preference calculation. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8a25d3f6ce34b80fef5fd6a324da724c56ad94ed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:27:56 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=8a25d3f6ce34b80fef5fd6a324da724c56ad94ed commit 8a25d3f6ce34b80fef5fd6a324da724c56ad94ed Author: Alexander V. Chernikov AuthorDate: 2021-03-07 22:05:34 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-10 21:50:19 +0000 Fix dpdk/ldradix fib lookup algorithm preference calculation. The current preference number were copied from IPv4 code, assuming 500k routes to be the full-view. Adjust with the current reality (100k full-view). Reported by: Marek Zarychta (cherry picked from commit d5be41beb7c44119730791d92782d8e77174d312) --- sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c | 4 ++-- sys/netinet6/in6_fib_algo.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c b/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c index 250e3e1bde4a..17d35c16346d 100644 --- a/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c +++ b/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c @@ -129,8 +129,8 @@ rte6_get_pref(const struct rib_rtable_info *rinfo) return (1); else if (rinfo->num_prefixes < 1000) return (rinfo->num_prefixes / 10); - else if (rinfo->num_prefixes < 500000) - return (100 + rinfo->num_prefixes / 3334); + else if (rinfo->num_prefixes < 100000) + return (100 + rinfo->num_prefixes / 667); else return (250); } diff --git a/sys/netinet6/in6_fib_algo.c b/sys/netinet6/in6_fib_algo.c index c9df9387af37..04d194273168 100644 --- a/sys/netinet6/in6_fib_algo.c +++ b/sys/netinet6/in6_fib_algo.c @@ -118,8 +118,8 @@ lradix6_get_pref(const struct rib_rtable_info *rinfo) if (rinfo->num_prefixes < 10) return (255); - else if (rinfo->num_prefixes < 100000) - return (255 - rinfo->num_prefixes / 394); + else if (rinfo->num_prefixes < 10000) + return (255 - rinfo->num_prefixes / 40); else return (1); } From owner-dev-commits-src-all@freebsd.org Wed Mar 10 22:35:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 148D4579E43; Wed, 10 Mar 2021 22:35: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 4Dwn3603XNz4npR; Wed, 10 Mar 2021 22:35: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 E8E4A19743; Wed, 10 Mar 2021 22:35: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 12AMZT3K045955; Wed, 10 Mar 2021 22:35:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12AMZTfK045954; Wed, 10 Mar 2021 22:35:29 GMT (envelope-from git) Date: Wed, 10 Mar 2021 22:35:29 GMT Message-Id: <202103102235.12AMZTfK045954@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: 15565e0a2177 - main - kern.mk: fix -Wno-error style to fix build with Clang 12 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: 15565e0a2177f53b086609fecd48991c52dad5eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 22:35:30 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=15565e0a2177f53b086609fecd48991c52dad5eb commit 15565e0a2177f53b086609fecd48991c52dad5eb Author: Greg V AuthorDate: 2021-03-10 22:17:09 +0000 Commit: Ed Maste CommitDate: 2021-03-10 22:34:35 +0000 kern.mk: fix -Wno-error style to fix build with Clang 12 Clang 12 no longer supports -Wno-error-..., only the -Wno-error=... style (which is already used everywhere else in the tree). Differential Revision: https://reviews.freebsd.org/D29157 --- sys/conf/kern.mk | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index b0a26cd1680c..35e873783cf0 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -17,21 +17,21 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ # kernel where fixing them is more trouble than it is worth, or where there is # a false positive. .if ${COMPILER_TYPE} == "clang" -NO_WCONSTANT_CONVERSION= -Wno-error-constant-conversion +NO_WCONSTANT_CONVERSION= -Wno-error=constant-conversion NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow NO_WSELF_ASSIGN= -Wno-self-assign -NO_WUNNEEDED_INTERNAL_DECL= -Wno-error-unneeded-internal-declaration -NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized -NO_WCAST_QUAL= -Wno-error-cast-qual +NO_WUNNEEDED_INTERNAL_DECL= -Wno-error=unneeded-internal-declaration +NO_WSOMETIMES_UNINITIALIZED= -Wno-error=sometimes-uninitialized +NO_WCAST_QUAL= -Wno-error=cast-qual NO_WTAUTOLOGICAL_POINTER_COMPARE= -Wno-tautological-pointer-compare # Several other warnings which might be useful in some cases, but not severe # enough to error out the whole kernel build. Display them anyway, so there is # some incentive to fix them eventually. -CWARNEXTRA?= -Wno-error-tautological-compare -Wno-error-empty-body \ - -Wno-error-parentheses-equality -Wno-error-unused-function \ - -Wno-error-pointer-sign -CWARNEXTRA+= -Wno-error-shift-negative-value +CWARNEXTRA?= -Wno-error=tautological-compare -Wno-error=empty-body \ + -Wno-error=parentheses-equality -Wno-error=unused-function \ + -Wno-error=pointer-sign +CWARNEXTRA+= -Wno-error=shift-negative-value CWARNEXTRA+= -Wno-address-of-packed-member .if ${COMPILER_VERSION} >= 100000 NO_WMISLEADING_INDENTATION= -Wno-misleading-indentation From owner-dev-commits-src-all@freebsd.org Thu Mar 11 01:14:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BCD657DB63; Thu, 11 Mar 2021 01:14: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 4DwrZR6xyTz3F1j; Thu, 11 Mar 2021 01:14: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 E14D91BA8F; Thu, 11 Mar 2021 01:14: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 12B1ENjd056224; Thu, 11 Mar 2021 01:14:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B1ENdd056223; Thu, 11 Mar 2021 01:14:23 GMT (envelope-from git) Date: Thu, 11 Mar 2021 01:14:23 GMT Message-Id: <202103110114.12B1ENdd056223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: c637a66be46c - releng/13.0 - ixl(4): Fix VLAN HW filtering MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: c637a66be46cca2bef968202af5a4970586908d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 01:14:24 -0000 The branch releng/13.0 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=c637a66be46cca2bef968202af5a4970586908d0 commit c637a66be46cca2bef968202af5a4970586908d0 Author: Krzysztof Galazka AuthorDate: 2021-02-03 23:22:55 +0000 Commit: Eric Joyner CommitDate: 2021-03-11 01:06:15 +0000 ixl(4): Fix VLAN HW filtering X700 family of controllers has limited number of available VLAN HW filters. Driver did not handle properly a case when user assigned more VLANs to the interface which had all filters already in use. Fix that by disabling HW filtering when it is impossible to create filters for all requested VLANs. Keep track of registered VLANs using bitstring to be able to re-enable HW filtering when number of requested VLANs drops below the limit. Also switch all allocations to use M_IXL malloc type to ease detecting memory leaks in the driver. Reviewed by: erj Tested by: gowtham.kumar.ks@intel.com Approved by: re (gjb) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28137 (cherry picked from commit 7d4dceec103039e2b2fa90793ceeb71a8d6684aa) (cherry picked from commit 7e166d608eecf0188bbb7edf6b3d9abffe1dfc6b) --- sys/dev/ixl/i40e_osdep.c | 4 +- sys/dev/ixl/iavf.h | 7 + sys/dev/ixl/iavf_vc.c | 20 +- sys/dev/ixl/if_iavf.c | 20 +- sys/dev/ixl/if_ixl.c | 81 ++++--- sys/dev/ixl/ixl.h | 49 ++-- sys/dev/ixl/ixl_iw.c | 8 +- sys/dev/ixl/ixl_pf.h | 19 +- sys/dev/ixl/ixl_pf_iflib.c | 37 +-- sys/dev/ixl/ixl_pf_iov.c | 4 +- sys/dev/ixl/ixl_pf_main.c | 551 ++++++++++++++++++++++++++++++--------------- 11 files changed, 487 insertions(+), 313 deletions(-) diff --git a/sys/dev/ixl/i40e_osdep.c b/sys/dev/ixl/i40e_osdep.c index df6848dff3f2..20eb02c85d67 100644 --- a/sys/dev/ixl/i40e_osdep.c +++ b/sys/dev/ixl/i40e_osdep.c @@ -51,14 +51,14 @@ i40e_dmamap_cb(void *arg, bus_dma_segment_t * segs, int nseg, int error) i40e_status i40e_allocate_virt_mem(struct i40e_hw *hw, struct i40e_virt_mem *mem, u32 size) { - mem->va = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); + mem->va = malloc(size, M_IXL, M_NOWAIT | M_ZERO); return (mem->va == NULL); } i40e_status i40e_free_virt_mem(struct i40e_hw *hw, struct i40e_virt_mem *mem) { - free(mem->va, M_DEVBUF); + free(mem->va, M_IXL); mem->va = NULL; return (I40E_SUCCESS); diff --git a/sys/dev/ixl/iavf.h b/sys/dev/ixl/iavf.h index e2a546f450d4..9a7716c5e5a2 100644 --- a/sys/dev/ixl/iavf.h +++ b/sys/dev/ixl/iavf.h @@ -43,6 +43,13 @@ #define IAVF_MAX_QUEUES 16 #define IAVF_AQ_TIMEOUT (1 * hz) +/* MacVlan Flags */ +#define IAVF_FILTER_USED (u16)(1 << 0) +#define IAVF_FILTER_VLAN (u16)(1 << 1) +#define IAVF_FILTER_ADD (u16)(1 << 2) +#define IAVF_FILTER_DEL (u16)(1 << 3) +#define IAVF_FILTER_MC (u16)(1 << 4) + #define IAVF_FLAG_AQ_ENABLE_QUEUES (u32)(1 << 0) #define IAVF_FLAG_AQ_DISABLE_QUEUES (u32)(1 << 1) #define IAVF_FLAG_AQ_ADD_MAC_FILTER (u32)(1 << 2) diff --git a/sys/dev/ixl/iavf_vc.c b/sys/dev/ixl/iavf_vc.c index 2a77f390faaa..ed9cc8432438 100644 --- a/sys/dev/ixl/iavf_vc.c +++ b/sys/dev/ixl/iavf_vc.c @@ -456,7 +456,7 @@ iavf_add_vlans(struct iavf_sc *sc) /* Get count of VLAN filters to add */ SLIST_FOREACH(f, sc->vlan_filters, next) { - if (f->flags & IXL_FILTER_ADD) + if (f->flags & IAVF_FILTER_ADD) cnt++; } @@ -484,9 +484,9 @@ iavf_add_vlans(struct iavf_sc *sc) /* Scan the filter array */ SLIST_FOREACH_SAFE(f, sc->vlan_filters, next, ftmp) { - if (f->flags & IXL_FILTER_ADD) { + if (f->flags & IAVF_FILTER_ADD) { bcopy(&f->vlan, &v->vlan_id[i], sizeof(u16)); - f->flags = IXL_FILTER_USED; + f->flags = IAVF_FILTER_USED; i++; } if (i == cnt) @@ -514,7 +514,7 @@ iavf_del_vlans(struct iavf_sc *sc) /* Get count of VLAN filters to delete */ SLIST_FOREACH(f, sc->vlan_filters, next) { - if (f->flags & IXL_FILTER_DEL) + if (f->flags & IAVF_FILTER_DEL) cnt++; } @@ -542,7 +542,7 @@ iavf_del_vlans(struct iavf_sc *sc) /* Scan the filter array */ SLIST_FOREACH_SAFE(f, sc->vlan_filters, next, ftmp) { - if (f->flags & IXL_FILTER_DEL) { + if (f->flags & IAVF_FILTER_DEL) { bcopy(&f->vlan, &v->vlan_id[i], sizeof(u16)); i++; SLIST_REMOVE(sc->vlan_filters, f, iavf_vlan_filter, next); @@ -575,7 +575,7 @@ iavf_add_ether_filters(struct iavf_sc *sc) /* Get count of MAC addresses to add */ SLIST_FOREACH(f, sc->mac_filters, next) { - if (f->flags & IXL_FILTER_ADD) + if (f->flags & IAVF_FILTER_ADD) cnt++; } if (cnt == 0) { /* Should not happen... */ @@ -597,9 +597,9 @@ iavf_add_ether_filters(struct iavf_sc *sc) /* Scan the filter array */ SLIST_FOREACH(f, sc->mac_filters, next) { - if (f->flags & IXL_FILTER_ADD) { + if (f->flags & IAVF_FILTER_ADD) { bcopy(f->macaddr, a->list[j].addr, ETHER_ADDR_LEN); - f->flags &= ~IXL_FILTER_ADD; + f->flags &= ~IAVF_FILTER_ADD; j++; iavf_dbg_vc(sc, "ADD: " MAC_FORMAT "\n", @@ -633,7 +633,7 @@ iavf_del_ether_filters(struct iavf_sc *sc) /* Get count of MAC addresses to delete */ SLIST_FOREACH(f, sc->mac_filters, next) { - if (f->flags & IXL_FILTER_DEL) + if (f->flags & IAVF_FILTER_DEL) cnt++; } if (cnt == 0) { @@ -655,7 +655,7 @@ iavf_del_ether_filters(struct iavf_sc *sc) /* Scan the filter array */ SLIST_FOREACH_SAFE(f, sc->mac_filters, next, f_temp) { - if (f->flags & IXL_FILTER_DEL) { + if (f->flags & IAVF_FILTER_DEL) { bcopy(f->macaddr, d->list[j].addr, ETHER_ADDR_LEN); iavf_dbg_vc(sc, "DEL: " MAC_FORMAT "\n", MAC_FORMAT_ARGS(f->macaddr)); diff --git a/sys/dev/ixl/if_iavf.c b/sys/dev/ixl/if_iavf.c index 2079e2d7306b..394656d27a2f 100644 --- a/sys/dev/ixl/if_iavf.c +++ b/sys/dev/ixl/if_iavf.c @@ -663,7 +663,7 @@ iavf_if_init(if_ctx_t ctx) iavf_send_vc_msg(sc, IAVF_FLAG_AQ_DISABLE_QUEUES); bcopy(IF_LLADDR(ifp), tmpaddr, ETHER_ADDR_LEN); - if (!cmp_etheraddr(hw->mac.addr, tmpaddr) && + if (!ixl_ether_is_equal(hw->mac.addr, tmpaddr) && (i40e_validate_mac_addr(tmpaddr) == I40E_SUCCESS)) { error = iavf_del_mac_filter(sc, hw->mac.addr); if (error == 0) @@ -1233,7 +1233,7 @@ iavf_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int count __unused) struct iavf_sc *sc = arg; int error; - error = iavf_add_mac_filter(sc, (u8*)LLADDR(sdl), IXL_FILTER_MC); + error = iavf_add_mac_filter(sc, (u8*)LLADDR(sdl), IAVF_FILTER_MC); return (!error); } @@ -1404,7 +1404,7 @@ iavf_if_vlan_register(if_ctx_t ctx, u16 vtag) v = malloc(sizeof(struct iavf_vlan_filter), M_IAVF, M_WAITOK | M_ZERO); SLIST_INSERT_HEAD(sc->vlan_filters, v, next); v->vlan = vtag; - v->flags = IXL_FILTER_ADD; + v->flags = IAVF_FILTER_ADD; iavf_send_vc_msg(sc, IAVF_FLAG_AQ_ADD_VLAN_FILTER); } @@ -1422,7 +1422,7 @@ iavf_if_vlan_unregister(if_ctx_t ctx, u16 vtag) SLIST_FOREACH(v, sc->vlan_filters, next) { if (v->vlan == vtag) { - v->flags = IXL_FILTER_DEL; + v->flags = IAVF_FILTER_DEL; ++i; --vsi->num_vlans; } @@ -1624,7 +1624,7 @@ iavf_find_mac_filter(struct iavf_sc *sc, u8 *macaddr) bool match = FALSE; SLIST_FOREACH(f, sc->mac_filters, next) { - if (cmp_etheraddr(f->macaddr, macaddr)) { + if (ixl_ether_is_equal(f->macaddr, macaddr)) { match = TRUE; break; } @@ -1828,9 +1828,9 @@ iavf_init_multi(struct iavf_sc *sc) /* First clear any multicast filters */ SLIST_FOREACH(f, sc->mac_filters, next) { - if ((f->flags & IXL_FILTER_USED) - && (f->flags & IXL_FILTER_MC)) { - f->flags |= IXL_FILTER_DEL; + if ((f->flags & IAVF_FILTER_USED) + && (f->flags & IAVF_FILTER_MC)) { + f->flags |= IAVF_FILTER_DEL; mcnt++; } } @@ -2034,7 +2034,7 @@ iavf_add_mac_filter(struct iavf_sc *sc, u8 *macaddr, u16 flags) MAC_FORMAT_ARGS(macaddr)); bcopy(macaddr, f->macaddr, ETHER_ADDR_LEN); - f->flags |= (IXL_FILTER_ADD | IXL_FILTER_USED); + f->flags |= (IAVF_FILTER_ADD | IAVF_FILTER_USED); f->flags |= flags; return (0); } @@ -2051,7 +2051,7 @@ iavf_del_mac_filter(struct iavf_sc *sc, u8 *macaddr) if (f == NULL) return (ENOENT); - f->flags |= IXL_FILTER_DEL; + f->flags |= IAVF_FILTER_DEL; return (0); } diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 50eb448a1154..5a79b4403257 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -127,7 +127,6 @@ static void ixl_if_vflr_handle(if_ctx_t ctx); #endif /*** Other ***/ -static u_int ixl_mc_filter_apply(void *, struct sockaddr_dl *, u_int); static void ixl_save_pf_tunables(struct ixl_pf *); static int ixl_allocate_pci_resources(struct ixl_pf *); static void ixl_setup_ssctx(struct ixl_pf *pf); @@ -862,7 +861,7 @@ ixl_if_detach(if_ctx_t ctx) ixl_pf_qmgr_destroy(&pf->qmgr); ixl_free_pci_resources(pf); - ixl_free_mac_filters(vsi); + ixl_free_filters(&vsi->ftl); INIT_DBG_DEV(dev, "end"); return (0); } @@ -937,9 +936,9 @@ ixl_if_init(if_ctx_t ctx) /* Get the latest mac address... User might use a LAA */ bcopy(IF_LLADDR(vsi->ifp), tmpaddr, ETH_ALEN); - if (!cmp_etheraddr(hw->mac.addr, tmpaddr) && + if (!ixl_ether_is_equal(hw->mac.addr, tmpaddr) && (i40e_validate_mac_addr(tmpaddr) == I40E_SUCCESS)) { - ixl_del_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); + ixl_del_all_vlan_filters(vsi, hw->mac.addr); bcopy(tmpaddr, hw->mac.addr, ETH_ALEN); ret = i40e_aq_mac_address_write(hw, I40E_AQC_WRITE_TYPE_LAA_ONLY, @@ -948,7 +947,10 @@ ixl_if_init(if_ctx_t ctx) device_printf(dev, "LLA address change failed!!\n"); return; } - ixl_add_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); + /* + * New filters are configured by ixl_reconfigure_filters + * at the end of ixl_init_locked. + */ } iflib_set_mac(ctx, hw->mac.addr); @@ -1385,7 +1387,7 @@ ixl_if_update_admin_status(if_ctx_t ctx) struct i40e_hw *hw = &pf->hw; u16 pending; - if (pf->state & IXL_PF_STATE_ADAPTER_RESETTING) + if (IXL_PF_IS_RESETTING(pf)) ixl_handle_empr_reset(pf); /* @@ -1418,32 +1420,22 @@ ixl_if_multi_set(if_ctx_t ctx) struct ixl_pf *pf = iflib_get_softc(ctx); struct ixl_vsi *vsi = &pf->vsi; struct i40e_hw *hw = vsi->hw; - int mcnt, flags; - int del_mcnt; + int mcnt; IOCTL_DEBUGOUT("ixl_if_multi_set: begin"); - mcnt = min(if_llmaddr_count(iflib_get_ifp(ctx)), MAX_MULTICAST_ADDR); /* Delete filters for removed multicast addresses */ - del_mcnt = ixl_del_multi(vsi); - vsi->num_macs -= del_mcnt; + ixl_del_multi(vsi, false); + mcnt = min(if_llmaddr_count(iflib_get_ifp(ctx)), MAX_MULTICAST_ADDR); if (__predict_false(mcnt == MAX_MULTICAST_ADDR)) { i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid, TRUE, NULL); + ixl_del_multi(vsi, true); return; } - /* (re-)install filters for all mcast addresses */ - /* XXX: This bypasses filter count tracking code! */ - mcnt = if_foreach_llmaddr(iflib_get_ifp(ctx), ixl_mc_filter_apply, vsi); - if (mcnt > 0) { - vsi->num_macs += mcnt; - flags = (IXL_FILTER_ADD | IXL_FILTER_USED | IXL_FILTER_MC); - ixl_add_hw_filters(vsi, flags, mcnt); - } - ixl_dbg_filter(pf, "%s: filter mac total: %d\n", - __func__, vsi->num_macs); + ixl_add_multi(vsi); IOCTL_DEBUGOUT("ixl_if_multi_set: end"); } @@ -1661,12 +1653,35 @@ ixl_if_vlan_register(if_ctx_t ctx, u16 vtag) struct ixl_pf *pf = iflib_get_softc(ctx); struct ixl_vsi *vsi = &pf->vsi; struct i40e_hw *hw = vsi->hw; + if_t ifp = iflib_get_ifp(ctx); if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; + /* + * Keep track of registered VLANS to know what + * filters have to be configured when VLAN_HWFILTER + * capability is enabled. + */ ++vsi->num_vlans; - ixl_add_filter(vsi, hw->mac.addr, vtag); + bit_set(vsi->vlans_map, vtag); + + if ((if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) == 0) + return; + + if (vsi->num_vlans < IXL_MAX_VLAN_FILTERS) + ixl_add_filter(vsi, hw->mac.addr, vtag); + else if (vsi->num_vlans == IXL_MAX_VLAN_FILTERS) { + /* + * There is not enough HW resources to add filters + * for all registered VLANs. Re-configure filtering + * to allow reception of all expected traffic. + */ + device_printf(vsi->dev, + "Not enough HW filters for all VLANs. VLAN HW filtering disabled"); + ixl_del_all_vlan_filters(vsi, hw->mac.addr); + ixl_add_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); + } } static void @@ -1675,12 +1690,23 @@ ixl_if_vlan_unregister(if_ctx_t ctx, u16 vtag) struct ixl_pf *pf = iflib_get_softc(ctx); struct ixl_vsi *vsi = &pf->vsi; struct i40e_hw *hw = vsi->hw; + if_t ifp = iflib_get_ifp(ctx); if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; --vsi->num_vlans; - ixl_del_filter(vsi, hw->mac.addr, vtag); + bit_clear(vsi->vlans_map, vtag); + + if ((if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) == 0) + return; + + if (vsi->num_vlans < IXL_MAX_VLAN_FILTERS) + ixl_del_filter(vsi, hw->mac.addr, vtag); + else if (vsi->num_vlans == IXL_MAX_VLAN_FILTERS) { + ixl_del_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); + ixl_add_vlan_filters(vsi, hw->mac.addr); + } } static uint64_t @@ -1798,15 +1824,6 @@ ixl_if_needs_restart(if_ctx_t ctx __unused, enum iflib_restart_event event) } } -static u_int -ixl_mc_filter_apply(void *arg, struct sockaddr_dl *sdl, u_int count __unused) -{ - struct ixl_vsi *vsi = arg; - - ixl_add_mc_filter(vsi, (u8*)LLADDR(sdl)); - return (1); -} - /* * Sanity check and save off tunable values. */ diff --git a/sys/dev/ixl/ixl.h b/sys/dev/ixl/ixl.h index 65e92c470a6c..3eb0fa4f6b5a 100644 --- a/sys/dev/ixl/ixl.h +++ b/sys/dev/ixl/ixl.h @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -187,15 +188,15 @@ #define IXL_BULK_LATENCY 2 /* MacVlan Flags */ -#define IXL_FILTER_USED (u16)(1 << 0) -#define IXL_FILTER_VLAN (u16)(1 << 1) -#define IXL_FILTER_ADD (u16)(1 << 2) -#define IXL_FILTER_DEL (u16)(1 << 3) -#define IXL_FILTER_MC (u16)(1 << 4) +#define IXL_FILTER_VLAN (u16)(1 << 0) +#define IXL_FILTER_MC (u16)(1 << 1) /* used in the vlan field of the filter when not a vlan */ #define IXL_VLAN_ANY -1 +/* Maximum number of MAC/VLAN filters supported by HW */ +#define IXL_MAX_VLAN_FILTERS 256 + #define CSUM_OFFLOAD_IPV4 (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP) #define CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6|CSUM_UDP_IPV6|CSUM_SCTP_IPV6) #define CSUM_OFFLOAD (CSUM_OFFLOAD_IPV4|CSUM_OFFLOAD_IPV6|CSUM_TSO) @@ -303,16 +304,18 @@ /* For stats sysctl naming */ #define IXL_QUEUE_NAME_LEN 32 +MALLOC_DECLARE(M_IXL); + #define IXL_DEV_ERR(_dev, _format, ...) \ device_printf(_dev, "%s: " _format " (%s:%d)\n", __func__, ##__VA_ARGS__, __FILE__, __LINE__) /* ***************************************************************************** * vendor_info_array - * + * * This array contains the list of Subvendor/Subdevice IDs on which the driver * should load. - * + * ***************************************************************************** */ typedef struct _ixl_vendor_info_t { @@ -328,7 +331,7 @@ typedef struct _ixl_vendor_info_t { ** addresses, vlans, and mac filters all use it. */ struct ixl_mac_filter { - SLIST_ENTRY(ixl_mac_filter) next; + LIST_ENTRY(ixl_mac_filter) ftle; u8 macaddr[ETHER_ADDR_LEN]; s16 vlan; u16 flags; @@ -414,7 +417,7 @@ struct ixl_rx_queue { /* ** Virtual Station Interface */ -SLIST_HEAD(ixl_ftl_head, ixl_mac_filter); +LIST_HEAD(ixl_ftl_head, ixl_mac_filter); struct ixl_vsi { if_ctx_t ctx; if_softc_ctx_t shared; @@ -452,6 +455,8 @@ struct ixl_vsi { /* Contains readylist & stat counter id */ struct i40e_aqc_vsi_properties_data info; +#define IXL_VLANS_MAP_LEN EVL_VLID_MASK + 1 + bitstr_t bit_decl(vlans_map, IXL_VLANS_MAP_LEN); u16 num_vlans; /* Per-VSI stats from hardware */ @@ -478,32 +483,16 @@ struct ixl_vsi { struct sysctl_ctx_list sysctl_ctx; }; -/* -** Creates new filter with given MAC address and VLAN ID -*/ -static inline struct ixl_mac_filter * -ixl_new_filter(struct ixl_vsi *vsi, const u8 *macaddr, s16 vlan) -{ - struct ixl_mac_filter *f; - - /* create a new empty filter */ - f = malloc(sizeof(struct ixl_mac_filter), - M_DEVBUF, M_NOWAIT | M_ZERO); - if (f) { - SLIST_INSERT_HEAD(&vsi->ftl, f, next); - bcopy(macaddr, f->macaddr, ETHER_ADDR_LEN); - f->vlan = vlan; - f->flags |= (IXL_FILTER_ADD | IXL_FILTER_USED); - } - - return (f); -} +struct ixl_add_maddr_arg { + struct ixl_ftl_head to_add; + struct ixl_vsi *vsi; +}; /* ** Compare two ethernet addresses */ static inline bool -cmp_etheraddr(const u8 *ea1, const u8 *ea2) +ixl_ether_is_equal(const u8 *ea1, const u8 *ea2) { return (bcmp(ea1, ea2, ETHER_ADDR_LEN) == 0); } diff --git a/sys/dev/ixl/ixl_iw.c b/sys/dev/ixl/ixl_iw.c index 6557e9dca4b3..5e2d7cfcb30b 100644 --- a/sys/dev/ixl/ixl_iw.c +++ b/sys/dev/ixl/ixl_iw.c @@ -238,7 +238,7 @@ ixl_iw_pf_attach(struct ixl_pf *pf) } pf_entry = malloc(sizeof(struct ixl_iw_pf_entry), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_IXL, M_NOWAIT | M_ZERO); if (pf_entry == NULL) { device_printf(pf->dev, "%s: failed to allocate memory to attach new PF\n", @@ -289,7 +289,7 @@ ixl_iw_pf_detach(struct ixl_pf *pf) goto out; } LIST_REMOVE(pf_entry, node); - free(pf_entry, M_DEVBUF); + free(pf_entry, M_IXL); ixl_iw_ref_cnt--; out: @@ -414,7 +414,7 @@ ixl_iw_register(struct ixl_iw_ops *ops) taskqueue_start_threads(&ixl_iw.tq, 1, PI_NET, "ixl iw"); ixl_iw.ops = malloc(sizeof(struct ixl_iw_ops), - M_DEVBUF, M_NOWAIT | M_ZERO); + M_IXL, M_NOWAIT | M_ZERO); if (ixl_iw.ops == NULL) { printf("%s: failed to allocate memory\n", __func__); taskqueue_free(ixl_iw.tq); @@ -481,7 +481,7 @@ ixl_iw_unregister(void) taskqueue_drain(ixl_iw.tq, &pf_entry->iw_task); taskqueue_free(ixl_iw.tq); ixl_iw.tq = NULL; - free(ixl_iw.ops, M_DEVBUF); + free(ixl_iw.ops, M_IXL); ixl_iw.ops = NULL; return (0); diff --git a/sys/dev/ixl/ixl_pf.h b/sys/dev/ixl/ixl_pf.h index 0521ae5a4bc5..c3fbdc91d358 100644 --- a/sys/dev/ixl/ixl_pf.h +++ b/sys/dev/ixl/ixl_pf.h @@ -78,7 +78,7 @@ enum ixl_i2c_access_method_t { /* Used in struct ixl_pf's state field */ enum ixl_pf_state { IXL_PF_STATE_RECOVERY_MODE = (1 << 0), - IXL_PF_STATE_ADAPTER_RESETTING = (1 << 1), + IXL_PF_STATE_RESETTING = (1 << 1), IXL_PF_STATE_MDD_PENDING = (1 << 2), IXL_PF_STATE_PF_RESET_REQ = (1 << 3), IXL_PF_STATE_VF_RESET_REQ = (1 << 4), @@ -93,6 +93,8 @@ enum ixl_pf_state { #define IXL_PF_IN_RECOVERY_MODE(pf) \ ((atomic_load_acq_32(&pf->state) & IXL_PF_STATE_RECOVERY_MODE) != 0) +#define IXL_PF_IS_RESETTING(pf) \ + ((atomic_load_acq_32(&pf->state) & IXL_PF_STATE_RESETTING) != 0) struct ixl_vf { struct ixl_vsi vsi; @@ -258,8 +260,6 @@ struct ixl_pf { "\t1 - Enable (VEB)\n" \ "Enabling this will allow VFs in separate VMs to communicate over the hardware bridge." -MALLOC_DECLARE(M_IXL); - /*** Functions / Macros ***/ /* Adjust the level here to 10 or over to print stats messages */ #define I40E_VC_DEBUG(p, level, ...) \ @@ -367,6 +367,8 @@ void ixl_set_queue_tx_itr(struct ixl_tx_queue *); void ixl_add_filter(struct ixl_vsi *, const u8 *, s16 vlan); void ixl_del_filter(struct ixl_vsi *, const u8 *, s16 vlan); +void ixl_add_vlan_filters(struct ixl_vsi *, const u8 *); +void ixl_del_all_vlan_filters(struct ixl_vsi *, const u8 *); void ixl_reconfigure_filters(struct ixl_vsi *vsi); int ixl_disable_rings(struct ixl_pf *, struct ixl_vsi *, struct ixl_pf_qtag *); @@ -391,16 +393,15 @@ void ixl_enable_intr(struct ixl_vsi *); void ixl_disable_rings_intr(struct ixl_vsi *); void ixl_set_promisc(struct ixl_vsi *); void ixl_add_multi(struct ixl_vsi *); -int ixl_del_multi(struct ixl_vsi *); +void ixl_del_multi(struct ixl_vsi *, bool); void ixl_setup_vlan_filters(struct ixl_vsi *); void ixl_init_filters(struct ixl_vsi *); -void ixl_add_hw_filters(struct ixl_vsi *, int, int); -void ixl_del_hw_filters(struct ixl_vsi *, int); +void ixl_free_filters(struct ixl_ftl_head *); +void ixl_add_hw_filters(struct ixl_vsi *, struct ixl_ftl_head *, int); +void ixl_del_hw_filters(struct ixl_vsi *, struct ixl_ftl_head *, int); void ixl_del_default_hw_filters(struct ixl_vsi *); struct ixl_mac_filter * - ixl_find_filter(struct ixl_vsi *, const u8 *, s16); -void ixl_add_mc_filter(struct ixl_vsi *, u8 *); -void ixl_free_mac_filters(struct ixl_vsi *vsi); + ixl_find_filter(struct ixl_ftl_head *, const u8 *, s16); void ixl_update_vsi_stats(struct ixl_vsi *); void ixl_vsi_reset_stats(struct ixl_vsi *); diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 4351f65ee5ab..2b3d035fbcfe 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -185,7 +185,7 @@ ixl_msix_adminq(void *arg) } device_printf(dev, "Reset Requested! (%s)\n", reset_type); /* overload admin queue task to check reset progress */ - atomic_set_int(&pf->state, IXL_PF_STATE_ADAPTER_RESETTING); + atomic_set_int(&pf->state, IXL_PF_STATE_RESETTING); do_task = TRUE; } @@ -866,41 +866,6 @@ ixl_set_rss_hlut(struct ixl_pf *pf) } } -/* -** This routine updates vlan filters, called by init -** it scans the filter table and then updates the hw -** after a soft reset. -*/ -void -ixl_setup_vlan_filters(struct ixl_vsi *vsi) -{ - struct ixl_mac_filter *f; - int cnt = 0, flags; - - if (vsi->num_vlans == 0) - return; - /* - ** Scan the filter list for vlan entries, - ** mark them for addition and then call - ** for the AQ update. - */ - SLIST_FOREACH(f, &vsi->ftl, next) { - if (f->flags & IXL_FILTER_VLAN) { - f->flags |= - (IXL_FILTER_ADD | - IXL_FILTER_USED); - cnt++; - } - } - if (cnt == 0) { - printf("setup vlan: no filters found!\n"); - return; - } - flags = IXL_FILTER_VLAN; - flags |= (IXL_FILTER_ADD | IXL_FILTER_USED); - ixl_add_hw_filters(vsi, flags, cnt); -} - /* For PF VSI only */ int ixl_enable_rings(struct ixl_vsi *vsi) diff --git a/sys/dev/ixl/ixl_pf_iov.c b/sys/dev/ixl/ixl_pf_iov.c index 92e434eab9fc..c3cf90d1c4b5 100644 --- a/sys/dev/ixl/ixl_pf_iov.c +++ b/sys/dev/ixl/ixl_pf_iov.c @@ -1025,7 +1025,7 @@ ixl_vf_mac_valid(struct ixl_vf *vf, const uint8_t *addr) * is not its assigned MAC. */ if (!(vf->vf_flags & VF_FLAG_SET_MAC_CAP) && - !(ETHER_IS_MULTICAST(addr) || cmp_etheraddr(addr, vf->mac))) + !(ETHER_IS_MULTICAST(addr) || !ixl_ether_is_equal(addr, vf->mac))) return (EPERM); return (0); @@ -1717,7 +1717,7 @@ ixl_if_iov_uninit(if_ctx_t ctx) if (pf->vfs[i].vsi.seid != 0) i40e_aq_delete_element(hw, pf->vfs[i].vsi.seid, NULL); ixl_pf_qmgr_release(&pf->qmgr, &pf->vfs[i].qtag); - ixl_free_mac_filters(&pf->vfs[i].vsi); + ixl_free_filters(&pf->vfs[i].vsi.ftl); ixl_dbg_iov(pf, "VF %d: %d released\n", i, pf->vfs[i].qtag.num_allocated); ixl_dbg_iov(pf, "Unallocated total: %d\n", ixl_pf_qmgr_get_num_free(&pf->qmgr)); diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index eddd4dfaab0d..2714b1a0e6d8 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -326,7 +326,7 @@ ixl_get_hw_capabilities(struct ixl_pf *pf) len = 40 * sizeof(struct i40e_aqc_list_capabilities_element_resp); retry: if (!(buf = (struct i40e_aqc_list_capabilities_element_resp *) - malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO))) { + malloc(len, M_IXL, M_NOWAIT | M_ZERO))) { device_printf(dev, "Unable to allocate cap memory\n"); return (ENOMEM); } @@ -334,7 +334,7 @@ retry: /* This populates the hw struct */ status = i40e_aq_discover_capabilities(hw, buf, len, &needed, i40e_aqc_opc_list_func_capabilities, NULL); - free(buf, M_DEVBUF); + free(buf, M_IXL); if ((pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) && (again == TRUE)) { /* retry once with a larger buffer */ @@ -452,12 +452,67 @@ err_out: return (status); } +/* +** Creates new filter with given MAC address and VLAN ID +*/ +static struct ixl_mac_filter * +ixl_new_filter(struct ixl_ftl_head *headp, const u8 *macaddr, s16 vlan) +{ + struct ixl_mac_filter *f; + + /* create a new empty filter */ + f = malloc(sizeof(struct ixl_mac_filter), + M_IXL, M_NOWAIT | M_ZERO); + if (f) { + LIST_INSERT_HEAD(headp, f, ftle); + bcopy(macaddr, f->macaddr, ETHER_ADDR_LEN); + f->vlan = vlan; + } + + return (f); +} + +/** + * ixl_free_filters - Free all filters in given list + * headp - pointer to list head + * + * Frees memory used by each entry in the list. + * Does not remove filters from HW. + */ +void +ixl_free_filters(struct ixl_ftl_head *headp) +{ + struct ixl_mac_filter *f, *nf; + + f = LIST_FIRST(headp); + while (f != NULL) { + nf = LIST_NEXT(f, ftle); + free(f, M_IXL); + f = nf; + } + + LIST_INIT(headp); +} + static u_int ixl_add_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) { - struct ixl_vsi *vsi = arg; + struct ixl_add_maddr_arg *ama = arg; + struct ixl_vsi *vsi = ama->vsi; + const u8 *macaddr = (u8*)LLADDR(sdl); + struct ixl_mac_filter *f; - ixl_add_mc_filter(vsi, (u8*)LLADDR(sdl)); + /* Does one already exist */ + f = ixl_find_filter(&vsi->ftl, macaddr, IXL_VLAN_ANY); + if (f != NULL) + return (0); + + f = ixl_new_filter(&ama->to_add, macaddr, IXL_VLAN_ANY); + if (f == NULL) { + device_printf(vsi->dev, "WARNING: no filter available!!\n"); + return (0); + } + f->flags |= IXL_FILTER_MC; return (1); } @@ -473,28 +528,26 @@ ixl_add_multi(struct ixl_vsi *vsi) { struct ifnet *ifp = vsi->ifp; struct i40e_hw *hw = vsi->hw; - int mcnt = 0, flags; + int mcnt = 0; + struct ixl_add_maddr_arg cb_arg; IOCTL_DEBUGOUT("ixl_add_multi: begin"); - /* - ** First just get a count, to decide if we - ** we simply use multicast promiscuous. - */ mcnt = if_llmaddr_count(ifp); if (__predict_false(mcnt >= MAX_MULTICAST_ADDR)) { - /* delete existing MC filters */ - ixl_del_hw_filters(vsi, mcnt); i40e_aq_set_vsi_multicast_promiscuous(hw, vsi->seid, TRUE, NULL); + /* delete all existing MC filters */ + ixl_del_multi(vsi, true); return; } - mcnt = if_foreach_llmaddr(ifp, ixl_add_maddr, vsi); - if (mcnt > 0) { - flags = (IXL_FILTER_ADD | IXL_FILTER_USED | IXL_FILTER_MC); - ixl_add_hw_filters(vsi, flags, mcnt); - } + cb_arg.vsi = vsi; + LIST_INIT(&cb_arg.to_add); + + mcnt = if_foreach_llmaddr(ifp, ixl_add_maddr, &cb_arg); + if (mcnt > 0) + ixl_add_hw_filters(vsi, &cb_arg.to_add, mcnt); IOCTL_DEBUGOUT("ixl_add_multi: end"); } @@ -504,34 +557,36 @@ ixl_match_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) { struct ixl_mac_filter *f = arg; - if (cmp_etheraddr(f->macaddr, (u8 *)LLADDR(sdl))) + if (ixl_ether_is_equal(f->macaddr, (u8 *)LLADDR(sdl))) return (1); else return (0); } -int -ixl_del_multi(struct ixl_vsi *vsi) +void +ixl_del_multi(struct ixl_vsi *vsi, bool all) { + struct ixl_ftl_head to_del; struct ifnet *ifp = vsi->ifp; - struct ixl_mac_filter *f; + struct ixl_mac_filter *f, *fn; int mcnt = 0; IOCTL_DEBUGOUT("ixl_del_multi: begin"); + LIST_INIT(&to_del); /* Search for removed multicast addresses */ - SLIST_FOREACH(f, &vsi->ftl, next) - if ((f->flags & IXL_FILTER_USED) && - (f->flags & IXL_FILTER_MC) && - (if_foreach_llmaddr(ifp, ixl_match_maddr, f) == 0)) { - f->flags |= IXL_FILTER_DEL; - mcnt++; - } + LIST_FOREACH_SAFE(f, &vsi->ftl, ftle, fn) { + if ((f->flags & IXL_FILTER_MC) == 0 || + (!all && (if_foreach_llmaddr(ifp, ixl_match_maddr, f) == 0))) + continue; - if (mcnt > 0) - ixl_del_hw_filters(vsi, mcnt); + LIST_REMOVE(f, ftle); + LIST_INSERT_HEAD(&to_del, f, ftle); + mcnt++; + } - return (mcnt); + if (mcnt > 0) + ixl_del_hw_filters(vsi, &to_del, mcnt); } void @@ -738,20 +793,6 @@ ixl_switch_config(struct ixl_pf *pf) return (ret); } -void -ixl_free_mac_filters(struct ixl_vsi *vsi) -{ - struct ixl_mac_filter *f; - - while (!SLIST_EMPTY(&vsi->ftl)) { - f = SLIST_FIRST(&vsi->ftl); - SLIST_REMOVE_HEAD(&vsi->ftl, next); - free(f, M_DEVBUF); - } - - vsi->num_hw_filters = 0; -} - void ixl_vsi_add_sysctls(struct ixl_vsi * vsi, const char * sysctl_name, bool queues_sysctls) { @@ -1019,7 +1060,7 @@ ixl_init_filters(struct ixl_vsi *vsi) ixl_dbg_filter(pf, "%s: start\n", __func__); /* Initialize mac filter list for VSI */ - SLIST_INIT(&vsi->ftl); + LIST_INIT(&vsi->ftl); vsi->num_hw_filters = 0; /* Receive broadcast Ethernet frames */ @@ -1045,30 +1086,35 @@ ixl_init_filters(struct ixl_vsi *vsi) #endif } -/* -** This routine adds mulicast filters -*/ void -ixl_add_mc_filter(struct ixl_vsi *vsi, u8 *macaddr) +ixl_reconfigure_filters(struct ixl_vsi *vsi) { - struct ixl_mac_filter *f; + struct i40e_hw *hw = vsi->hw; + struct ixl_ftl_head tmp; + int cnt; - /* Does one already exist */ - f = ixl_find_filter(vsi, macaddr, IXL_VLAN_ANY); - if (f != NULL) - return; + /* + * The ixl_add_hw_filters function adds filters configured + * in HW to a list in VSI. Move all filters to a temporary + * list to avoid corrupting it by concatenating to itself. + */ + LIST_INIT(&tmp); + LIST_CONCAT(&tmp, &vsi->ftl, ixl_mac_filter, ftle); + cnt = vsi->num_hw_filters; + vsi->num_hw_filters = 0; - f = ixl_new_filter(vsi, macaddr, IXL_VLAN_ANY); - if (f != NULL) - f->flags |= IXL_FILTER_MC; - else - printf("WARNING: no filter available!!\n"); -} + ixl_add_hw_filters(vsi, &tmp, cnt); -void -ixl_reconfigure_filters(struct ixl_vsi *vsi) -{ - ixl_add_hw_filters(vsi, IXL_FILTER_USED, vsi->num_macs); + /* Filter could be removed if MAC address was changed */ + ixl_add_filter(vsi, hw->mac.addr, IXL_VLAN_ANY); + + if ((if_getcapenable(vsi->ifp) & IFCAP_VLAN_HWFILTER) == 0) + return; + /* + * VLAN HW filtering is enabled, make sure that filters + * for all registered VLAN tags are configured + */ + ixl_add_vlan_filters(vsi, hw->mac.addr); } /* @@ -1082,82 +1128,205 @@ ixl_add_filter(struct ixl_vsi *vsi, const u8 *macaddr, s16 vlan) struct ixl_mac_filter *f, *tmp; struct ixl_pf *pf; device_t dev; + struct ixl_ftl_head to_add; *** 553 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Mar 11 01:14:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A8C857DD59; Thu, 11 Mar 2021 01:14: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 4DwrZT0yXvz3F8V; Thu, 11 Mar 2021 01:14: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 0FEB61BA90; Thu, 11 Mar 2021 01:14: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 12B1EOSt056247; Thu, 11 Mar 2021 01:14:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B1EO7P056246; Thu, 11 Mar 2021 01:14:24 GMT (envelope-from git) Date: Thu, 11 Mar 2021 01:14:24 GMT Message-Id: <202103110114.12B1EO7P056246@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: adc22165c088 - releng/13.0 - ix(4): Report RX errors as sum of all RX error counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: adc22165c08851f70e87f324ad55dd624b11a409 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 01:14:25 -0000 The branch releng/13.0 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=adc22165c08851f70e87f324ad55dd624b11a409 commit adc22165c08851f70e87f324ad55dd624b11a409 Author: Piotr Pietruszewski AuthorDate: 2021-03-03 01:21:58 +0000 Commit: Eric Joyner CommitDate: 2021-03-11 01:07:03 +0000 ix(4): Report RX errors as sum of all RX error counters HW keeps track of RX errors using several counters, each for specific type of errors. Report RX errors to OS as sum of all those counters: CRC errors, illegal bytes, checksum, length, undersize, fragment, oversize and jabber errors. Also, add new "rx_errs" sysctl in the dev.ix.N.mac_stats tree. This is to provide an another way to display the sum of RX errors. Signed-off-by: Piotr Pietruszewski Reviewed By: erj Tested By: gowtham.kumar.ks@intel.com Approved by: re (gjb) Sponsored By: Intel Corporation Differential Revision: https://reviews.freebsd.org/D27191 (cherry picked from commit afb1aa4e6df245d38fd2ba683fa521d5dabe8392) (cherry picked from commit 8fa11f89225695c185a8a92c7530e270e77552f8) --- sys/dev/ixgbe/if_ix.c | 19 ++++++++++++++++++- sys/dev/ixgbe/ixgbe.h | 12 ++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 7eb32077f8b0..9f3674cdab5d 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -1531,7 +1531,22 @@ ixgbe_update_stats_counters(struct adapter *adapter) IXGBE_SET_OMCASTS(adapter, stats->mptc); IXGBE_SET_COLLISIONS(adapter, 0); IXGBE_SET_IQDROPS(adapter, total_missed_rx); - IXGBE_SET_IERRORS(adapter, stats->crcerrs + stats->rlec); + + /* + * Aggregate following types of errors as RX errors: + * - CRC error count, + * - illegal byte error count, + * - checksum error count, + * - missed packets count, + * - length error count, + * - undersized packets count, + * - fragmented packets count, + * - oversized packets count, + * - jabber count. + */ + IXGBE_SET_IERRORS(adapter, stats->crcerrs + stats->illerrc + stats->xec + + stats->mpc[0] + stats->rlec + stats->ruc + stats->rfc + stats->roc + + stats->rjc); } /* ixgbe_update_stats_counters */ /************************************************************************ @@ -1621,6 +1636,8 @@ ixgbe_add_hw_stats(struct adapter *adapter) CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "MAC Statistics"); stat_list = SYSCTL_CHILDREN(stat_node); + SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "rx_errs", + CTLFLAG_RD, &adapter->ierrors, IXGBE_SYSCTL_DESC_RX_ERRS); SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "crc_errs", CTLFLAG_RD, &stats->crcerrs, "CRC Errors"); SYSCTL_ADD_UQUAD(ctx, stat_list, OID_AUTO, "ill_errs", diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 1502c7fb866e..30dd1d5368fb 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -536,6 +536,18 @@ struct adapter { "\t2 - tx pause\n" \ "\t3 - tx and rx pause" +#define IXGBE_SYSCTL_DESC_RX_ERRS \ + "\nSum of the following RX errors counters:\n" \ + " * CRC errors,\n" \ + " * illegal byte error count,\n" \ + " * checksum error count,\n" \ + " * missed packet count,\n" \ + " * length error count,\n" \ + " * undersized packets count,\n" \ + " * fragmented packets count,\n" \ + " * oversized packets count,\n" \ + " * jabber count." + /* Workaround to make 8.0 buildable */ #if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504 static __inline int From owner-dev-commits-src-all@freebsd.org Thu Mar 11 01:14:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8444457DF37; Thu, 11 Mar 2021 01:14: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 4DwrZV2zlFz3F1v; Thu, 11 Mar 2021 01:14: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 33D141BA45; Thu, 11 Mar 2021 01:14: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 12B1EQ9w056267; Thu, 11 Mar 2021 01:14:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B1EQ4P056266; Thu, 11 Mar 2021 01:14:26 GMT (envelope-from git) Date: Thu, 11 Mar 2021 01:14:26 GMT Message-Id: <202103110114.12B1EQ4P056266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 995755b959a6 - releng/13.0 - ixl(4): Report RX errors as sum of all RX error counters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 995755b959a657bf86fbc4535abd3076ba981171 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 01:14:26 -0000 The branch releng/13.0 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=995755b959a657bf86fbc4535abd3076ba981171 commit 995755b959a657bf86fbc4535abd3076ba981171 Author: Krzysztof Galazka AuthorDate: 2021-03-03 01:33:11 +0000 Commit: Eric Joyner CommitDate: 2021-03-11 01:07:13 +0000 ixl(4): Report RX errors as sum of all RX error counters HW keeps track of RX errors using several counters, each for specific type of errors. Report RX errors to OS as sum of all those counters: CRC errors, illegal bytes, checksum, length, undersize, fragment, oversize and jabber errors. There is no HW counter for frames with invalid L3/L4 checksums so add a SW one. Also add a "rx_errors" sysctl with a copy of netstat IERRORS counter value to make it easier accessible from scripts. Reviewed By: erj Tested By: gowtham.kumar.ks@intel.com Approved by: re (gjb) Sponsored By: Intel Corporation Differential Revision: https://reviews.freebsd.org/D27639 (cherry picked from commit 9f99061ef9c95b171fc92d34026222bb5e052337) (cherry picked from commit b149f7c23d13e73b92c2bf8c3691e3e1ebd833c1) --- sys/dev/ixl/ixl.h | 1 + sys/dev/ixl/ixl_pf_main.c | 15 +++++++++++++-- sys/dev/ixl/ixl_txrx.c | 16 +++++++++------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/sys/dev/ixl/ixl.h b/sys/dev/ixl/ixl.h index 3eb0fa4f6b5a..9828760e4ea6 100644 --- a/sys/dev/ixl/ixl.h +++ b/sys/dev/ixl/ixl.h @@ -390,6 +390,7 @@ struct rx_ring { u64 rx_packets; u64 rx_bytes; u64 desc_errs; + u64 csum_errs; }; /* diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 2714b1a0e6d8..070ddaef522e 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -808,6 +808,11 @@ ixl_vsi_add_sysctls(struct ixl_vsi * vsi, const char * sysctl_name, bool queues_ vsi_list = SYSCTL_CHILDREN(vsi->vsi_node); ixl_add_sysctls_eth_stats(&vsi->sysctl_ctx, vsi_list, &vsi->eth_stats); + /* Copy of netstat RX errors counter for validation purposes */ + SYSCTL_ADD_UQUAD(&vsi->sysctl_ctx, vsi_list, OID_AUTO, "rx_errors", + CTLFLAG_RD, &vsi->ierrors, + "RX packet errors"); + if (queues_sysctls) ixl_vsi_add_queues_stats(vsi, &vsi->sysctl_ctx); } @@ -2183,7 +2188,7 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) struct ixl_pf *pf; struct ifnet *ifp; struct i40e_eth_stats *es; - u64 tx_discards; + u64 tx_discards, csum_errs; struct i40e_hw_port_stats *nsd; @@ -2196,6 +2201,11 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) tx_discards = es->tx_discards + nsd->tx_dropped_link_down; + csum_errs = 0; + for (int i = 0; i < vsi->num_rx_queues; i++) + csum_errs += vsi->rx_queues[i].rxr.csum_errs; + nsd->checksum_error = csum_errs; + /* Update ifnet stats */ IXL_SET_IPACKETS(vsi, es->rx_unicast + es->rx_multicast + @@ -2209,7 +2219,8 @@ ixl_update_vsi_stats(struct ixl_vsi *vsi) IXL_SET_OMCASTS(vsi, es->tx_multicast); IXL_SET_IERRORS(vsi, nsd->crc_errors + nsd->illegal_bytes + - nsd->rx_undersize + nsd->rx_oversize + nsd->rx_fragments + + nsd->checksum_error + nsd->rx_length_errors + + nsd->rx_undersize + nsd->rx_fragments + nsd->rx_oversize + nsd->rx_jabber); IXL_SET_OERRORS(vsi, es->tx_errors); IXL_SET_IQDROPS(vsi, es->rx_discards + nsd->eth.rx_discards); diff --git a/sys/dev/ixl/ixl_txrx.c b/sys/dev/ixl/ixl_txrx.c index e589bb8392cd..bdd3cb8725f8 100644 --- a/sys/dev/ixl/ixl_txrx.c +++ b/sys/dev/ixl/ixl_txrx.c @@ -51,7 +51,7 @@ #endif /* Local Prototypes */ -static void ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype); +static u8 ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype); static int ixl_isc_txd_encap(void *arg, if_pkt_info_t pi); static void ixl_isc_txd_flush(void *arg, uint16_t txqid, qidx_t pidx); @@ -720,7 +720,7 @@ ixl_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) rxr->rx_packets++; if ((if_getcapenable(vsi->ifp) & IFCAP_RXCSUM) != 0) - ixl_rx_checksum(ri, status, error, ptype); + rxr->csum_errs += ixl_rx_checksum(ri, status, error, ptype); ri->iri_flowid = le32toh(cur->wb.qword0.hi_dword.rss); ri->iri_rsstype = ixl_ptype_to_hash(ptype); ri->iri_vtag = vtag; @@ -737,7 +737,7 @@ ixl_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) * doesn't spend time verifying the checksum. * *********************************************************************/ -static void +static u8 ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) { struct i40e_rx_ptype_decoded decoded; @@ -746,7 +746,7 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) /* No L3 or L4 checksum was calculated */ if (!(status & (1 << I40E_RX_DESC_STATUS_L3L4P_SHIFT))) - return; + return (0); decoded = decode_rx_desc_ptype(ptype); @@ -756,7 +756,7 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) if (status & (1 << I40E_RX_DESC_STATUS_IPV6EXADD_SHIFT)) { ri->iri_csum_flags = 0; - return; + return (1); } } @@ -764,17 +764,19 @@ ixl_rx_checksum(if_rxd_info_t ri, u32 status, u32 error, u8 ptype) /* IPv4 checksum error */ if (error & (1 << I40E_RX_DESC_ERROR_IPE_SHIFT)) - return; + return (1); ri->iri_csum_flags |= CSUM_L3_VALID; ri->iri_csum_flags |= CSUM_L4_CALC; /* L4 checksum error */ if (error & (1 << I40E_RX_DESC_ERROR_L4E_SHIFT)) - return; + return (1); ri->iri_csum_flags |= CSUM_L4_VALID; ri->iri_csum_data |= htons(0xffff); + + return (0); } /* Set Report Status queue fields to 0 */ From owner-dev-commits-src-all@freebsd.org Thu Mar 11 01:14:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1208E57DDC8; Thu, 11 Mar 2021 01:14: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 4DwrZW4Ztvz3F65; Thu, 11 Mar 2021 01:14: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 3F3111BA46; Thu, 11 Mar 2021 01:14: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 12B1ERiY056287; Thu, 11 Mar 2021 01:14:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B1ERYm056286; Thu, 11 Mar 2021 01:14:27 GMT (envelope-from git) Date: Thu, 11 Mar 2021 01:14:27 GMT Message-Id: <202103110114.12B1ERYm056286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: f9c8aed24422 - releng/13.0 - ixl(4): Add ability to control link state on ifconfig down MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: f9c8aed24422926c48ca6a591097c2a5b03fdf1f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 01:14:28 -0000 The branch releng/13.0 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=f9c8aed24422926c48ca6a591097c2a5b03fdf1f commit f9c8aed24422926c48ca6a591097c2a5b03fdf1f Author: Krzysztof Galazka AuthorDate: 2021-03-03 01:38:51 +0000 Commit: Eric Joyner CommitDate: 2021-03-11 01:07:26 +0000 ixl(4): Add ability to control link state on ifconfig down Add sysctl link_active_on_if_down, which allows user to control if interface is kept in active state when it is brought down with ifconfig. Set it to enabled by default to preserve backwards compatibility. Reviewed by: erj Tested by: gowtham.kumar.ks@intel.com Approved by: re (gjb) Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D28028 (cherry picked from commit 21802a127d83e8a8c721d69b697e7ddb223d7797) (cherry picked from commit 2b94bda05a6d43e89c4a785c0f1cd569a41cb200) --- sys/dev/ixl/if_ixl.c | 18 +++++++ sys/dev/ixl/ixl_pf.h | 7 +++ sys/dev/ixl/ixl_pf_iflib.c | 2 + sys/dev/ixl/ixl_pf_main.c | 128 ++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 154 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index 5a79b4403257..13050198d174 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -770,6 +770,12 @@ ixl_if_attach_post(if_ctx_t ctx) ixl_update_stats_counters(pf); ixl_add_hw_stats(pf); + /* + * Driver may have been reloaded. Ensure that the link state + * is consistent with current settings. + */ + ixl_set_link(pf, (pf->state & IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) != 0); + hw->phy.get_link_info = true; i40e_get_link_status(hw, &pf->link_up); ixl_update_link_status(pf); @@ -961,6 +967,8 @@ ixl_if_init(if_ctx_t ctx) return; } + ixl_set_link(pf, true); + /* Reconfigure multicast filters in HW */ ixl_if_multi_set(ctx); @@ -1003,6 +1011,7 @@ void ixl_if_stop(if_ctx_t ctx) { struct ixl_pf *pf = iflib_get_softc(ctx); + struct ifnet *ifp = iflib_get_ifp(ctx); struct ixl_vsi *vsi = &pf->vsi; INIT_DEBUGOUT("ixl_if_stop: begin\n"); @@ -1019,6 +1028,15 @@ ixl_if_stop(if_ctx_t ctx) ixl_disable_rings_intr(vsi); ixl_disable_rings(pf, vsi, &pf->qtag); + + /* + * Don't set link state if only reconfiguring + * e.g. on MTU change. + */ + if ((if_getflags(ifp) & IFF_UP) == 0 && + (atomic_load_acq_32(&pf->state) & + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) == 0) + ixl_set_link(pf, false); } static int diff --git a/sys/dev/ixl/ixl_pf.h b/sys/dev/ixl/ixl_pf.h index c3fbdc91d358..83c764bc617c 100644 --- a/sys/dev/ixl/ixl_pf.h +++ b/sys/dev/ixl/ixl_pf.h @@ -88,6 +88,7 @@ enum ixl_pf_state { IXL_PF_STATE_EMP_RESET_REQ = (1 << 8), IXL_PF_STATE_FW_LLDP_DISABLED = (1 << 9), IXL_PF_STATE_EEE_ENABLED = (1 << 10), + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN = (1 << 11), }; #define IXL_PF_IN_RECOVERY_MODE(pf) \ @@ -229,6 +230,11 @@ struct ixl_pf { "\t0 - disable\n" \ "\t1 - enable\n" +#define IXL_SYSCTL_HELP_SET_LINK_ACTIVE \ +"\nKeep link active after setting interface down:\n" \ +"\t0 - disable\n" \ +"\t1 - enable\n" + #define IXL_SYSCTL_HELP_READ_I2C \ "\nRead a byte from I2C bus\n" \ "Input: 32-bit value\n" \ @@ -351,6 +357,7 @@ void ixl_pf_reset_stats(struct ixl_pf *); void ixl_get_bus_info(struct ixl_pf *pf); int ixl_aq_get_link_status(struct ixl_pf *, struct i40e_aqc_get_link_status *); +void ixl_set_link(struct ixl_pf *, bool); int ixl_handle_nvmupd_cmd(struct ixl_pf *, struct ifdrv *); int ixl_handle_i2c_eeprom_read_cmd(struct ixl_pf *, struct ifreq *ifr); diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 2b3d035fbcfe..23d9f30299a9 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -413,6 +413,8 @@ ixl_link_event(struct ixl_pf *pf, struct i40e_arq_event_info *e) /* Print out message if an unqualified module is found */ if ((status->link_info & I40E_AQ_MEDIA_AVAILABLE) && (pf->advertised_speed) && + (atomic_load_32(&pf->state) & + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN) != 0 && (!(status->an_info & I40E_AQ_QUALIFIED_MODULE)) && (!(status->link_info & I40E_AQ_LINK_UP))) device_printf(dev, "Link failed because " diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index 070ddaef522e..b546701608f1 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -62,6 +62,7 @@ static int ixl_sysctl_pf_tx_itr(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_pf_rx_itr(SYSCTL_HANDLER_ARGS); static int ixl_sysctl_eee_enable(SYSCTL_HANDLER_ARGS); +static int ixl_sysctl_set_link_active(SYSCTL_HANDLER_ARGS); /* Debug Sysctls */ static int ixl_sysctl_link_status(SYSCTL_HANDLER_ARGS); @@ -385,6 +386,9 @@ retry: break; } + /* Keep link active by default */ + atomic_set_32(&pf->state, IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + /* Print a subset of the capability information. */ device_printf(dev, "PF-ID[%d]: VFs %d, MSI-X %d, VF MSI-X %d, QPs %d, %s\n", @@ -2499,6 +2503,12 @@ ixl_add_device_sysctls(struct ixl_pf *pf) CTLFLAG_RD | CTLFLAG_MPSAFE, &pf->stats.rx_lpi_count, "RX LPI count"); + SYSCTL_ADD_PROC(ctx, ctx_list, OID_AUTO, + "link_active_on_if_down", + CTLTYPE_INT | CTLFLAG_RWTUN, + pf, 0, ixl_sysctl_set_link_active, "I", + IXL_SYSCTL_HELP_SET_LINK_ACTIVE); + /* Add sysctls meant to print debug information, but don't list them * in "sysctl -a" output. */ debug_node = SYSCTL_ADD_NODE(ctx, ctx_list, @@ -2519,6 +2529,11 @@ ixl_add_device_sysctls(struct ixl_pf *pf) CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, pf, 0, ixl_sysctl_link_status, "A", IXL_SYSCTL_HELP_LINK_STATUS); + SYSCTL_ADD_PROC(ctx, debug_list, + OID_AUTO, "phy_abilities_init", + CTLTYPE_STRING | CTLFLAG_RD, + pf, 1, ixl_sysctl_phy_abilities, "A", "Initial PHY Abilities"); + SYSCTL_ADD_PROC(ctx, debug_list, OID_AUTO, "phy_abilities", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, @@ -3107,6 +3122,95 @@ ixl_find_i2c_interface(struct ixl_pf *pf) return (-1); } +void +ixl_set_link(struct ixl_pf *pf, bool enable) +{ + struct i40e_hw *hw = &pf->hw; + device_t dev = pf->dev; + struct i40e_aq_get_phy_abilities_resp abilities; + struct i40e_aq_set_phy_config config; + enum i40e_status_code aq_error = 0; + u32 phy_type, phy_type_ext; + + /* Get initial capability information */ + aq_error = i40e_aq_get_phy_capabilities(hw, + FALSE, TRUE, &abilities, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error getting phy capabilities %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } + + phy_type = abilities.phy_type; + phy_type_ext = abilities.phy_type_ext; + + /* Get current capability information */ + aq_error = i40e_aq_get_phy_capabilities(hw, + FALSE, FALSE, &abilities, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error getting phy capabilities %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } + + /* Prepare new config */ + memset(&config, 0, sizeof(config)); + config.link_speed = abilities.link_speed; + config.abilities = abilities.abilities; + config.eee_capability = abilities.eee_capability; + config.eeer = abilities.eeer_val; + config.low_power_ctrl = abilities.d3_lpan; + config.fec_config = abilities.fec_cfg_curr_mod_ext_info + & I40E_AQ_PHY_FEC_CONFIG_MASK; + config.phy_type = 0; + config.phy_type_ext = 0; + + if (enable) { + config.phy_type = phy_type; + config.phy_type_ext = phy_type_ext; + + config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX); + + switch (pf->fc) { + case I40E_FC_FULL: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_RX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_TX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; + break; + default: + break; + } + } + + aq_error = i40e_aq_set_phy_config(hw, &config, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error setting new phy config %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } + + aq_error = i40e_aq_set_link_restart_an(hw, enable, NULL); + if (aq_error) { + device_printf(dev, + "%s: Error set link config %d," + " aq error: %d\n", __func__, aq_error, + hw->aq.asq_last_status); + return; + } +} + static char * ixl_phy_type_string(u32 bit_pos, bool ext) { @@ -3265,7 +3369,7 @@ ixl_sysctl_phy_abilities(SYSCTL_HANDLER_ARGS) } status = i40e_aq_get_phy_capabilities(hw, - FALSE, FALSE, &abilities, NULL); + FALSE, arg2 != 0, &abilities, NULL); if (status) { device_printf(dev, "%s: i40e_aq_get_phy_capabilities() status %s, aq error %s\n", @@ -4447,6 +4551,28 @@ ixl_sysctl_eee_enable(SYSCTL_HANDLER_ARGS) return (0); } +static int +ixl_sysctl_set_link_active(SYSCTL_HANDLER_ARGS) +{ + struct ixl_pf *pf = (struct ixl_pf *)arg1; + int error, state; + + state = !!(atomic_load_acq_32(&pf->state) & + IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + + error = sysctl_handle_int(oidp, &state, 0, req); + if ((error) || (req->newptr == NULL)) + return (error); + + if (state == 0) + atomic_clear_32(&pf->state, IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + else + atomic_set_32(&pf->state, IXL_PF_STATE_LINK_ACTIVE_ON_DOWN); + + return (0); +} + + int ixl_attach_get_link_status(struct ixl_pf *pf) { From owner-dev-commits-src-all@freebsd.org Thu Mar 11 01:14:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEAE657DFA8; Thu, 11 Mar 2021 01:14: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 4DwrZY2hH9z3FFf; Thu, 11 Mar 2021 01:14: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 69F231B865; Thu, 11 Mar 2021 01:14: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 12B1ESmd056309; Thu, 11 Mar 2021 01:14:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B1ESw6056308; Thu, 11 Mar 2021 01:14:28 GMT (envelope-from git) Date: Thu, 11 Mar 2021 01:14:28 GMT Message-Id: <202103110114.12B1ESw6056308@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 6db19df195ef - releng/13.0 - ice_ddp: Update package file to 1.3.19.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 6db19df195ef73656d2bcb46b3795594dbb48550 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 01:14:33 -0000 The branch releng/13.0 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=6db19df195ef73656d2bcb46b3795594dbb48550 commit 6db19df195ef73656d2bcb46b3795594dbb48550 Author: Eric Joyner AuthorDate: 2021-02-23 01:43:54 +0000 Commit: Eric Joyner CommitDate: 2021-03-11 01:07:35 +0000 ice_ddp: Update package file to 1.3.19.0 This package is intended to be used with ice(4) version 0.28.1-k. That update will happen in a forthcoming commit. Signed-off-by: Eric Joyner Approved by: re (gjb) Sponsored by: Intel Corporation (cherry picked from commit a7ac518bff64d48cf262c60c4dc57eef34e74a07) (cherry picked from commit a02640c79e0a97b925f49302763da9aa201c4a20) --- sys/conf/files.amd64 | 6 +++--- sys/conf/files.arm64 | 6 +++--- sys/contrib/dev/ice/LICENSE | 2 +- .../dev/ice/{ice-1.3.16.0.pkg => ice-1.3.19.0.pkg} | Bin 659716 -> 614660 bytes sys/modules/ice_ddp/Makefile | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index ddd4e07b365c..cd7029daf06d 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -190,7 +190,7 @@ dev/ice/ice_sriov.c optional ice pci \ dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031000 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ @@ -199,8 +199,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.16.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.16.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.19.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.19.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" dev/ioat/ioat.c optional ioat pci diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index f7003b1048c8..e289d635eda5 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -353,7 +353,7 @@ dev/ice/ice_sriov.c optional ice pci \ dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ - compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031000 -mice_ddp -c${.TARGET}" \ + compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" ice_ddp.fwo optional ice_ddp \ @@ -362,8 +362,8 @@ ice_ddp.fwo optional ice_ddp \ no-implicit-rule \ clean "ice_ddp.fwo" ice_ddp.fw optional ice_ddp \ - dependency "$S/contrib/dev/ice/ice-1.3.16.0.pkg" \ - compile-with "${CP} $S/contrib/dev/ice/ice-1.3.16.0.pkg ice_ddp.fw" \ + dependency "$S/contrib/dev/ice/ice-1.3.19.0.pkg" \ + compile-with "${CP} $S/contrib/dev/ice/ice-1.3.19.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ clean "ice_ddp.fw" dev/iicbus/sy8106a.c optional sy8106a fdt diff --git a/sys/contrib/dev/ice/LICENSE b/sys/contrib/dev/ice/LICENSE index 7daf627fc7a0..7faadfc55aac 100644 --- a/sys/contrib/dev/ice/LICENSE +++ b/sys/contrib/dev/ice/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2006-2018, Intel Corporation. +Copyright (c) 2006-2021, Intel Corporation. All rights reserved. Redistribution. Redistribution and use in binary form, without diff --git a/sys/contrib/dev/ice/ice-1.3.16.0.pkg b/sys/contrib/dev/ice/ice-1.3.19.0.pkg similarity index 79% rename from sys/contrib/dev/ice/ice-1.3.16.0.pkg rename to sys/contrib/dev/ice/ice-1.3.19.0.pkg index ec5caecb3a72..32e2603bc131 100644 Binary files a/sys/contrib/dev/ice/ice-1.3.16.0.pkg and b/sys/contrib/dev/ice/ice-1.3.19.0.pkg differ diff --git a/sys/modules/ice_ddp/Makefile b/sys/modules/ice_ddp/Makefile index e6f45ae3820b..38337a106368 100644 --- a/sys/modules/ice_ddp/Makefile +++ b/sys/modules/ice_ddp/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ KMOD= ice_ddp -FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.16.0.pkg:ice_ddp:0x01031000 +FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.19.0.pkg:ice_ddp:0x01031300 .include From owner-dev-commits-src-all@freebsd.org Thu Mar 11 01:14:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E19A757DECD; Thu, 11 Mar 2021 01:14: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 4DwrZZ5pdBz3F8m; Thu, 11 Mar 2021 01:14: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 810231BA91; Thu, 11 Mar 2021 01:14: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 12B1ETad056330; Thu, 11 Mar 2021 01:14:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B1ETpB056328; Thu, 11 Mar 2021 01:14:29 GMT (envelope-from git) Date: Thu, 11 Mar 2021 01:14:29 GMT Message-Id: <202103110114.12B1ETpB056328@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eric Joyner Subject: git: 3af5680fe222 - releng/13.0 - ice(4): Update to version 0.28.1-k MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 3af5680fe222633cb74f4f01b0d59a97750943f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 01:14:34 -0000 The branch releng/13.0 has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=3af5680fe222633cb74f4f01b0d59a97750943f6 commit 3af5680fe222633cb74f4f01b0d59a97750943f6 Author: Eric Joyner AuthorDate: 2021-02-23 01:45:09 +0000 Commit: Eric Joyner CommitDate: 2021-03-11 01:07:53 +0000 ice(4): Update to version 0.28.1-k This updates the driver to align with the version included in the "Intel Ethernet Adapter Complete Driver Pack", version 25.6. There are no major functional changes; this mostly contains bug fixes and changes to prepare for new features. This version of the driver uses the previously committed ice_ddp package 1.3.19.0. Signed-off-by: Eric Joyner Tested by: jeffrey.e.pieper@intel.com Approved by: re (gjb) Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D28640 (cherry picked from commit d08b8680e12ad692736c84238dcf45c70c228914) (cherry picked from commit 1da549169de0b30f0ba92fdb4e74897c837d618d) --- sys/conf/files.amd64 | 2 + sys/conf/files.arm64 | 8 +- sys/dev/ice/ice_adminq_cmd.h | 107 ++-- sys/dev/ice/ice_alloc.h | 2 +- sys/dev/ice/ice_bitops.h | 4 +- sys/dev/ice/ice_common.c | 135 ++--- sys/dev/ice/ice_common.h | 17 +- sys/dev/ice/ice_common_sysctls.h | 2 +- sys/dev/ice/ice_common_txrx.h | 2 +- sys/dev/ice/ice_controlq.c | 2 +- sys/dev/ice/ice_controlq.h | 6 +- sys/dev/ice/ice_dcb.c | 40 +- sys/dev/ice/ice_dcb.h | 2 +- sys/dev/ice/ice_devids.h | 2 +- sys/dev/ice/ice_drv_info.h | 27 +- sys/dev/ice/ice_features.h | 2 +- sys/dev/ice/ice_flex_pipe.c | 57 +- sys/dev/ice/ice_flex_pipe.h | 2 +- sys/dev/ice/ice_flex_type.h | 11 +- sys/dev/ice/ice_flow.c | 243 +++++---- sys/dev/ice/ice_flow.h | 36 +- sys/dev/ice/ice_hw_autogen.h | 2 +- sys/dev/ice/ice_iflib.h | 2 +- sys/dev/ice/ice_iflib_recovery_txrx.c | 2 +- sys/dev/ice/ice_iflib_sysctls.h | 2 +- sys/dev/ice/ice_iflib_txrx.c | 2 +- sys/dev/ice/ice_lan_tx_rx.h | 2 +- sys/dev/ice/ice_lib.c | 56 +- sys/dev/ice/ice_lib.h | 2 +- sys/dev/ice/ice_nvm.c | 954 +++++++++++++++++++++++++++++----- sys/dev/ice/ice_nvm.h | 24 +- sys/dev/ice/ice_opts.h | 2 +- sys/dev/ice/ice_osdep.c | 2 +- sys/dev/ice/ice_osdep.h | 2 +- sys/dev/ice/ice_protocol_type.h | 27 +- sys/dev/ice/ice_resmgr.c | 2 +- sys/dev/ice/ice_resmgr.h | 2 +- sys/dev/ice/ice_rss.h | 2 +- sys/dev/ice/ice_sbq_cmd.h | 2 +- sys/dev/ice/ice_sched.c | 562 ++++++++++++-------- sys/dev/ice/ice_sched.h | 31 +- sys/dev/ice/ice_sriov.c | 407 ++++++++++++++- sys/dev/ice/ice_sriov.h | 23 +- sys/dev/ice/ice_status.h | 2 +- sys/dev/ice/ice_strings.c | 2 +- sys/dev/ice/ice_switch.c | 70 ++- sys/dev/ice/ice_switch.h | 4 +- sys/dev/ice/ice_type.h | 266 ++++++++-- sys/dev/ice/ice_vlan_mode.c | 72 +++ sys/dev/ice/ice_vlan_mode.h | 60 +++ sys/dev/ice/if_ice_iflib.c | 2 +- sys/dev/ice/virtchnl.h | 287 +++++++++- sys/dev/ice/virtchnl_inline_ipsec.h | 16 +- sys/modules/ice/Makefile | 2 +- 54 files changed, 2884 insertions(+), 720 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index cd7029daf06d..1b56254dc892 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -189,6 +189,8 @@ dev/ice/ice_sriov.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" +dev/ice/ice_vlan_mode.c optional ice pci \ + compile-with "${NORMAL_C} -I$S/dev/ice" ice_ddp.c optional ice_ddp \ compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index e289d635eda5..ec895b867982 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -352,16 +352,18 @@ dev/ice/ice_sriov.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" dev/ice/ice_switch.c optional ice pci \ compile-with "${NORMAL_C} -I$S/dev/ice" -ice_ddp.c optional ice_ddp \ +dev/ice/ice_vlan_mode.c optional ice pci \ + compile-with "${NORMAL_C} -I$S/dev/ice" +ice_ddp.c optional ice_ddp \ compile-with "${AWK} -f $S/tools/fw_stub.awk ice_ddp.fw:ice_ddp:0x01031300 -mice_ddp -c${.TARGET}" \ no-ctfconvert no-implicit-rule before-depend local \ clean "ice_ddp.c" -ice_ddp.fwo optional ice_ddp \ +ice_ddp.fwo optional ice_ddp \ dependency "ice_ddp.fw" \ compile-with "${NORMAL_FWO}" \ no-implicit-rule \ clean "ice_ddp.fwo" -ice_ddp.fw optional ice_ddp \ +ice_ddp.fw optional ice_ddp \ dependency "$S/contrib/dev/ice/ice-1.3.19.0.pkg" \ compile-with "${CP} $S/contrib/dev/ice/ice-1.3.19.0.pkg ice_ddp.fw" \ no-obj no-implicit-rule \ diff --git a/sys/dev/ice/ice_adminq_cmd.h b/sys/dev/ice/ice_adminq_cmd.h index 8d8c025fdd37..9179b0ce1226 100644 --- a/sys/dev/ice/ice_adminq_cmd.h +++ b/sys/dev/ice/ice_adminq_cmd.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -166,6 +166,7 @@ struct ice_aqc_list_caps_elem { #define ICE_AQC_CAPS_LOGI_TO_PHYSI_PORT_MAP 0x0073 #define ICE_AQC_CAPS_SKU 0x0074 #define ICE_AQC_CAPS_PORT_MAP 0x0075 +#define ICE_AQC_CAPS_PCIE_RESET_AVOIDANCE 0x0076 #define ICE_AQC_CAPS_NVM_MGMT 0x0080 u8 major_ver; @@ -1449,6 +1450,7 @@ struct ice_aqc_get_link_status_data { #define ICE_AQ_LINK_ACT_PORT_OPT_INVAL BIT(2) #define ICE_AQ_LINK_FEAT_ID_OR_CONFIG_ID_INVAL BIT(3) #define ICE_AQ_LINK_TOPO_CRITICAL_SDP_ERR BIT(4) +#define ICE_AQ_LINK_MODULE_POWER_UNSUPPORTED BIT(5) u8 link_info; #define ICE_AQ_LINK_UP BIT(0) /* Link Status */ #define ICE_AQ_LINK_FAULT BIT(1) @@ -1496,7 +1498,7 @@ struct ice_aqc_get_link_status_data { #define ICE_AQ_CFG_PACING_TYPE_FIXED ICE_AQ_CFG_PACING_TYPE_M /* External Device Power Ability */ u8 power_desc; -#define ICE_AQ_PWR_CLASS_M 0x3 +#define ICE_AQ_PWR_CLASS_M 0x3F #define ICE_AQ_LINK_PWR_BASET_LOW_HIGH 0 #define ICE_AQ_LINK_PWR_BASET_HIGH 1 #define ICE_AQ_LINK_PWR_QSFP_CLASS_1 0 @@ -1860,7 +1862,9 @@ struct ice_aqc_mdio { #define ICE_AQC_MDIO_DEV_M (0x1F << ICE_AQC_MDIO_DEV_S) #define ICE_AQC_MDIO_CLAUSE_22 BIT(5) #define ICE_AQC_MDIO_CLAUSE_45 BIT(6) - u8 rsvd; + u8 mdio_bus_address; +#define ICE_AQC_MDIO_BUS_ADDR_S 0 +#define ICE_AQC_MDIO_BUS_ADDR_M (0x1F << ICE_AQC_MDIO_BUS_ADDR_S) __le16 offset; __le16 data; /* Input in write cmd, output in read cmd. */ u8 rsvd1[4]; @@ -2001,6 +2005,22 @@ struct ice_aqc_sff_eeprom { __le32 addr_low; }; +/* SW Set GPIO command (indirect 0x6EF) + * SW Get GPIO command (indirect 0x6F0) + */ +struct ice_aqc_sw_gpio { + __le16 gpio_ctrl_handle; +#define ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_S 0 +#define ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_M (0x3FF << ICE_AQC_SW_GPIO_CONTROLLER_HANDLE_S) + u8 gpio_num; +#define ICE_AQC_SW_GPIO_NUMBER_S 0 +#define ICE_AQC_SW_GPIO_NUMBER_M (0x1F << ICE_AQC_SW_GPIO_NUMBER_S) + u8 gpio_params; +#define ICE_AQC_SW_GPIO_PARAMS_DIRECTION BIT(1) +#define ICE_AQC_SW_GPIO_PARAMS_VALUE BIT(0) + u8 rsvd[12]; +}; + /* NVM Read command (indirect 0x0701) * NVM Erase commands (direct 0x0702) * NVM Write commands (indirect 0x0703) @@ -2027,6 +2047,9 @@ struct ice_aqc_nvm { #define ICE_AQC_NVM_REVERT_LAST_ACTIV BIT(6) /* Write Activate only */ #define ICE_AQC_NVM_ACTIV_SEL_MASK MAKEMASK(0x7, 3) #define ICE_AQC_NVM_FLASH_ONLY BIT(7) +#define ICE_AQC_NVM_POR_FLAG 0 /* Used by NVM Write completion on ARQ */ +#define ICE_AQC_NVM_PERST_FLAG 1 +#define ICE_AQC_NVM_EMPR_FLAG 2 __le16 module_typeid; __le16 length; #define ICE_AQC_NVM_ERASE_LEN 0xFFFF @@ -2056,32 +2079,22 @@ struct ice_aqc_nvm { #define ICE_AQC_NVM_LLDP_STATUS_M_LEN 4 /* In Bits */ #define ICE_AQC_NVM_LLDP_STATUS_RD_LEN 4 /* In Bytes */ -/* The result of netlist NVM read comes in a TLV format. The actual data - * (netlist header) starts from word offset 1 (byte 2). The FW strips - * out the type field from the TLV header so all the netlist fields - * should adjust their offset value by 1 word (2 bytes) in order to map - * their correct location. +#define ICE_AQC_NVM_MINSREV_MOD_ID 0x130 + +/* Used for reading and writing MinSRev using 0x0701 and 0x0703. Note that the + * type field is excluded from the section when reading and writing from + * a module using the module_typeid field with these AQ commands. */ -#define ICE_AQC_NVM_LINK_TOPO_NETLIST_MOD_ID 0x11B -#define ICE_AQC_NVM_LINK_TOPO_NETLIST_LEN_OFFSET 1 -#define ICE_AQC_NVM_LINK_TOPO_NETLIST_LEN 2 /* In bytes */ -#define ICE_AQC_NVM_NETLIST_NODE_COUNT_OFFSET 2 -#define ICE_AQC_NVM_NETLIST_NODE_COUNT_LEN 2 /* In bytes */ -#define ICE_AQC_NVM_NETLIST_NODE_COUNT_M MAKEMASK(0x3FF, 0) -#define ICE_AQC_NVM_NETLIST_ID_BLK_START_OFFSET 5 -#define ICE_AQC_NVM_NETLIST_ID_BLK_LEN 0x30 /* In words */ - -/* netlist ID block field offsets (word offsets) */ -#define ICE_AQC_NVM_NETLIST_ID_BLK_MAJOR_VER_LOW 2 -#define ICE_AQC_NVM_NETLIST_ID_BLK_MAJOR_VER_HIGH 3 -#define ICE_AQC_NVM_NETLIST_ID_BLK_MINOR_VER_LOW 4 -#define ICE_AQC_NVM_NETLIST_ID_BLK_MINOR_VER_HIGH 5 -#define ICE_AQC_NVM_NETLIST_ID_BLK_TYPE_LOW 6 -#define ICE_AQC_NVM_NETLIST_ID_BLK_TYPE_HIGH 7 -#define ICE_AQC_NVM_NETLIST_ID_BLK_REV_LOW 8 -#define ICE_AQC_NVM_NETLIST_ID_BLK_REV_HIGH 9 -#define ICE_AQC_NVM_NETLIST_ID_BLK_SHA_HASH 0xA -#define ICE_AQC_NVM_NETLIST_ID_BLK_CUST_VER 0x2F +struct ice_aqc_nvm_minsrev { + __le16 length; + __le16 validity; +#define ICE_AQC_NVM_MINSREV_NVM_VALID BIT(0) +#define ICE_AQC_NVM_MINSREV_OROM_VALID BIT(1) + __le16 nvm_minsrev_l; + __le16 nvm_minsrev_h; + __le16 orom_minsrev_l; + __le16 orom_minsrev_h; +}; /* Used for 0x0704 as well as for 0x0705 commands */ struct ice_aqc_nvm_cfg { @@ -2114,7 +2127,7 @@ struct ice_aqc_nvm_checksum { u8 rsvd2[12]; }; -/** +/* * Send to PF command (indirect 0x0801) ID is only used by PF * * Send to VF command (indirect 0x0802) ID is only used by PF @@ -2541,6 +2554,7 @@ struct ice_pkg_ver { }; #define ICE_PKG_NAME_SIZE 32 +#define ICE_SEG_ID_SIZE 28 #define ICE_SEG_NAME_SIZE 28 struct ice_aqc_get_pkg_info { @@ -2589,6 +2603,35 @@ struct ice_aqc_set_health_status_config { u8 reserved[15]; }; +#define ICE_AQC_HEALTH_STATUS_ERR_UNKNOWN_MOD_STRICT 0x101 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_TYPE 0x102 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_QUAL 0x103 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_COMM 0x104 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_CONFLICT 0x105 +#define ICE_AQC_HEALTH_STATUS_ERR_MOD_NOT_PRESENT 0x106 +#define ICE_AQC_HEALTH_STATUS_INFO_MOD_UNDERUTILIZED 0x107 +#define ICE_AQC_HEALTH_STATUS_ERR_UNKNOWN_MOD_LENIENT 0x108 +#define ICE_AQC_HEALTH_STATUS_ERR_INVALID_LINK_CFG 0x10B +#define ICE_AQC_HEALTH_STATUS_ERR_PORT_ACCESS 0x10C +#define ICE_AQC_HEALTH_STATUS_ERR_PORT_UNREACHABLE 0x10D +#define ICE_AQC_HEALTH_STATUS_INFO_PORT_SPEED_MOD_LIMITED 0x10F +#define ICE_AQC_HEALTH_STATUS_ERR_PARALLEL_FAULT 0x110 +#define ICE_AQC_HEALTH_STATUS_INFO_PORT_SPEED_PHY_LIMITED 0x111 +#define ICE_AQC_HEALTH_STATUS_ERR_NETLIST_TOPO 0x112 +#define ICE_AQC_HEALTH_STATUS_ERR_NETLIST 0x113 +#define ICE_AQC_HEALTH_STATUS_ERR_TOPO_CONFLICT 0x114 +#define ICE_AQC_HEALTH_STATUS_ERR_LINK_HW_ACCESS 0x115 +#define ICE_AQC_HEALTH_STATUS_ERR_LINK_RUNTIME 0x116 +#define ICE_AQC_HEALTH_STATUS_ERR_DNL_INIT 0x117 +#define ICE_AQC_HEALTH_STATUS_INFO_RECOVERY 0x500 +#define ICE_AQC_HEALTH_STATUS_ERR_FLASH_ACCESS 0x501 +#define ICE_AQC_HEALTH_STATUS_ERR_NVM_AUTH 0x502 +#define ICE_AQC_HEALTH_STATUS_ERR_OROM_AUTH 0x503 +#define ICE_AQC_HEALTH_STATUS_ERR_DDP_AUTH 0x504 +#define ICE_AQC_HEALTH_STATUS_ERR_NVM_COMPAT 0x505 +#define ICE_AQC_HEALTH_STATUS_ERR_OROM_COMPAT 0x506 +#define ICE_AQC_HEALTH_STATUS_ERR_DCB_MIB 0x509 + /* Get Health Status codes (indirect 0xFF21) */ struct ice_aqc_get_supported_health_status_codes { __le16 health_code_count; @@ -2630,8 +2673,8 @@ struct ice_aqc_clear_health_status { * @opcode: AQ command opcode * @datalen: length in bytes of indirect/external data buffer * @retval: return value from firmware - * @cookie_h: opaque data high-half - * @cookie_l: opaque data low-half + * @cookie_high: opaque data high-half + * @cookie_low: opaque data low-half * @params: command-specific parameters * * Descriptor format for commands the driver posts on the Admin Transmit Queue @@ -2920,6 +2963,8 @@ enum ice_adminq_opc { ice_aqc_opc_set_gpio = 0x06EC, ice_aqc_opc_get_gpio = 0x06ED, ice_aqc_opc_sff_eeprom = 0x06EE, + ice_aqc_opc_sw_set_gpio = 0x06EF, + ice_aqc_opc_sw_get_gpio = 0x06F0, /* NVM commands */ ice_aqc_opc_nvm_read = 0x0701, diff --git a/sys/dev/ice/ice_alloc.h b/sys/dev/ice/ice_alloc.h index 1d9b9169eb02..b281958be793 100644 --- a/sys/dev/ice/ice_alloc.h +++ b/sys/dev/ice/ice_alloc.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_bitops.h b/sys/dev/ice/ice_bitops.h index 7c8cf6cb90f5..a7f729060b78 100644 --- a/sys/dev/ice/ice_bitops.h +++ b/sys/dev/ice/ice_bitops.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -423,7 +423,7 @@ ice_bitmap_set(ice_bitmap_t *dst, u16 pos, u16 num_bits) { u16 i; - for (i = pos; i < num_bits; i++) + for (i = pos; i < pos + num_bits; i++) ice_set_bit(i, dst); } diff --git a/sys/dev/ice/ice_common.c b/sys/dev/ice/ice_common.c index 20689f4893d4..5e2e4340c75c 100644 --- a/sys/dev/ice/ice_common.c +++ b/sys/dev/ice/ice_common.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -265,7 +265,7 @@ ice_aq_get_link_topo_handle(struct ice_port_info *pi, u8 node_type, return ice_aq_send_cmd(pi->hw, &desc, NULL, 0, cd); } -/* +/** * ice_is_media_cage_present * @pi: port information structure * @@ -704,13 +704,14 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw) void ice_print_rollback_msg(struct ice_hw *hw) { char nvm_str[ICE_NVM_VER_LEN] = { 0 }; - struct ice_nvm_info *nvm = &hw->nvm; struct ice_orom_info *orom; + struct ice_nvm_info *nvm; - orom = &nvm->orom; + orom = &hw->flash.orom; + nvm = &hw->flash.nvm; SNPRINTF(nvm_str, sizeof(nvm_str), "%x.%02x 0x%x %d.%d.%d", - nvm->major_ver, nvm->minor_ver, nvm->eetrack, orom->major, + nvm->major, nvm->minor, nvm->eetrack, orom->major, orom->build, orom->patch); ice_warn(hw, "Firmware rollback mode detected. Current version is NVM: %s, FW: %d.%d. Device may exhibit limited functionality. Refer to the Intel(R) Ethernet Adapters and Devices User Guide for details on firmware rollback mode\n", @@ -805,8 +806,7 @@ enum ice_status ice_init_hw(struct ice_hw *hw) ICE_AQC_REPORT_TOPO_CAP, pcaps, NULL); ice_free(hw, pcaps); if (status) - ice_debug(hw, ICE_DBG_PHY, "%s: Get PHY capabilities failed, continuing anyway\n", - __func__); + ice_debug(hw, ICE_DBG_PHY, "Get PHY capabilities failed, continuing anyway\n"); /* Initialize port_info struct with link information */ status = ice_aq_get_link_info(hw->port_info, false, NULL, NULL); @@ -850,6 +850,9 @@ enum ice_status ice_init_hw(struct ice_hw *hw) if (status) goto err_unroll_fltr_mgmt_struct; ice_init_lock(&hw->tnl_lock); + + ice_init_vlan_mode_ops(hw); + return ICE_SUCCESS; err_unroll_fltr_mgmt_struct: @@ -1701,7 +1704,7 @@ ice_aq_alloc_free_res(struct ice_hw *hw, u16 num_entries, if (!buf) return ICE_ERR_PARAM; - if (buf_size < (num_entries * sizeof(buf->elem[0]))) + if (buf_size < FLEX_ARRAY_SIZE(buf, elem, num_entries)) return ICE_ERR_PARAM; ice_fill_dflt_direct_cmd_desc(&desc, opc); @@ -1982,6 +1985,16 @@ ice_parse_common_caps(struct ice_hw *hw, struct ice_hw_common_caps *caps, case ICE_AQC_CAPS_NVM_VER: break; case ICE_AQC_CAPS_NVM_MGMT: + caps->sec_rev_disabled = + (number & ICE_NVM_MGMT_SEC_REV_DISABLED) ? + true : false; + ice_debug(hw, ICE_DBG_INIT, "%s: sec_rev_disabled = %d\n", prefix, + caps->sec_rev_disabled); + caps->update_disabled = + (number & ICE_NVM_MGMT_UPDATE_DISABLED) ? + true : false; + ice_debug(hw, ICE_DBG_INIT, "%s: update_disabled = %d\n", prefix, + caps->update_disabled); caps->nvm_unified_update = (number & ICE_NVM_MGMT_UNIFIED_UPD_SUPPORT) ? true : false; @@ -2389,26 +2402,25 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) { struct ice_hw_func_caps *func_caps = &hw->func_caps; struct ice_hw_dev_caps *dev_caps = &hw->dev_caps; - u32 valid_func, rxq_first_id, txq_first_id; - u32 msix_vector_first_id, max_mtu; + struct ice_hw_common_caps cached_caps; u32 num_funcs; /* cache some func_caps values that should be restored after memset */ - valid_func = func_caps->common_cap.valid_functions; - txq_first_id = func_caps->common_cap.txq_first_id; - rxq_first_id = func_caps->common_cap.rxq_first_id; - msix_vector_first_id = func_caps->common_cap.msix_vector_first_id; - max_mtu = func_caps->common_cap.max_mtu; + cached_caps = func_caps->common_cap; /* unset func capabilities */ memset(func_caps, 0, sizeof(*func_caps)); +#define ICE_RESTORE_FUNC_CAP(name) \ + func_caps->common_cap.name = cached_caps.name + /* restore cached values */ - func_caps->common_cap.valid_functions = valid_func; - func_caps->common_cap.txq_first_id = txq_first_id; - func_caps->common_cap.rxq_first_id = rxq_first_id; - func_caps->common_cap.msix_vector_first_id = msix_vector_first_id; - func_caps->common_cap.max_mtu = max_mtu; + ICE_RESTORE_FUNC_CAP(valid_functions); + ICE_RESTORE_FUNC_CAP(txq_first_id); + ICE_RESTORE_FUNC_CAP(rxq_first_id); + ICE_RESTORE_FUNC_CAP(msix_vector_first_id); + ICE_RESTORE_FUNC_CAP(max_mtu); + ICE_RESTORE_FUNC_CAP(nvm_unified_update); /* one Tx and one Rx queue in safe mode */ func_caps->common_cap.num_rxq = 1; @@ -2419,22 +2431,22 @@ void ice_set_safe_mode_caps(struct ice_hw *hw) func_caps->guar_num_vsi = 1; /* cache some dev_caps values that should be restored after memset */ - valid_func = dev_caps->common_cap.valid_functions; - txq_first_id = dev_caps->common_cap.txq_first_id; - rxq_first_id = dev_caps->common_cap.rxq_first_id; - msix_vector_first_id = dev_caps->common_cap.msix_vector_first_id; - max_mtu = dev_caps->common_cap.max_mtu; + cached_caps = dev_caps->common_cap; num_funcs = dev_caps->num_funcs; /* unset dev capabilities */ memset(dev_caps, 0, sizeof(*dev_caps)); +#define ICE_RESTORE_DEV_CAP(name) \ + dev_caps->common_cap.name = cached_caps.name + /* restore cached values */ - dev_caps->common_cap.valid_functions = valid_func; - dev_caps->common_cap.txq_first_id = txq_first_id; - dev_caps->common_cap.rxq_first_id = rxq_first_id; - dev_caps->common_cap.msix_vector_first_id = msix_vector_first_id; - dev_caps->common_cap.max_mtu = max_mtu; + ICE_RESTORE_DEV_CAP(valid_functions); + ICE_RESTORE_DEV_CAP(txq_first_id); + ICE_RESTORE_DEV_CAP(rxq_first_id); + ICE_RESTORE_DEV_CAP(msix_vector_first_id); + ICE_RESTORE_DEV_CAP(max_mtu); + ICE_RESTORE_DEV_CAP(nvm_unified_update); dev_caps->num_funcs = num_funcs; /* one Tx and one Rx queue per function in safe mode */ @@ -2480,7 +2492,7 @@ ice_aq_manage_mac_write(struct ice_hw *hw, const u8 *mac_addr, u8 flags, ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_manage_mac_write); cmd->flags = flags; - ice_memcpy(cmd->mac_addr, mac_addr, ETH_ALEN, ICE_NONDMA_TO_DMA); + ice_memcpy(cmd->mac_addr, mac_addr, ETH_ALEN, ICE_NONDMA_TO_NONDMA); return ice_aq_send_cmd(hw, &desc, NULL, 0, cd); } @@ -2816,6 +2828,11 @@ enum ice_status ice_update_link_info(struct ice_port_info *pi) status = ice_aq_get_phy_caps(pi, false, ICE_AQC_REPORT_TOPO_CAP, pcaps, NULL); + if (status == ICE_SUCCESS) + ice_memcpy(li->module_type, &pcaps->module_type, + sizeof(li->module_type), + ICE_NONDMA_TO_NONDMA); + ice_free(hw, pcaps); } @@ -3379,7 +3396,7 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr, ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_sff_eeprom); cmd = &desc.params.read_write_sff_param; - desc.flags = CPU_TO_LE16(ICE_AQ_FLAG_RD | ICE_AQ_FLAG_BUF); + desc.flags = CPU_TO_LE16(ICE_AQ_FLAG_RD); cmd->lport_num = (u8)(lport & 0xff); cmd->lport_num_valid = (u8)((lport >> 8) & 0x01); cmd->i2c_bus_addr = CPU_TO_LE16(((bus_addr >> 1) & @@ -3399,23 +3416,33 @@ ice_aq_sff_eeprom(struct ice_hw *hw, u16 lport, u8 bus_addr, /** * __ice_aq_get_set_rss_lut * @hw: pointer to the hardware structure - * @vsi_id: VSI FW index - * @lut_type: LUT table type - * @lut: pointer to the LUT buffer provided by the caller - * @lut_size: size of the LUT buffer - * @glob_lut_idx: global LUT index + * @params: RSS LUT parameters * @set: set true to set the table, false to get the table * * Internal function to get (0x0B05) or set (0x0B03) RSS look up table */ static enum ice_status -__ice_aq_get_set_rss_lut(struct ice_hw *hw, u16 vsi_id, u8 lut_type, u8 *lut, - u16 lut_size, u8 glob_lut_idx, bool set) +__ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *params, bool set) { + u16 flags = 0, vsi_id, lut_type, lut_size, glob_lut_idx, vsi_handle; struct ice_aqc_get_set_rss_lut *cmd_resp; struct ice_aq_desc desc; enum ice_status status; - u16 flags = 0; + u8 *lut; + + if (!params) + return ICE_ERR_PARAM; + + vsi_handle = params->vsi_handle; + lut = params->lut; + + if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) + return ICE_ERR_PARAM; + + lut_size = params->lut_size; + lut_type = params->lut_type; + glob_lut_idx = params->global_lut_id; + vsi_id = ice_get_hw_vsi_num(hw, vsi_handle); cmd_resp = &desc.params.get_set_rss_lut; @@ -3492,43 +3519,27 @@ ice_aq_get_set_rss_lut_exit: /** * ice_aq_get_rss_lut * @hw: pointer to the hardware structure - * @vsi_handle: software VSI handle - * @lut_type: LUT table type - * @lut: pointer to the LUT buffer provided by the caller - * @lut_size: size of the LUT buffer + * @get_params: RSS LUT parameters used to specify which RSS LUT to get * * get the RSS lookup table, PF or VSI type */ enum ice_status -ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, - u8 *lut, u16 lut_size) +ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params) { - if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) - return ICE_ERR_PARAM; - - return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle), - lut_type, lut, lut_size, 0, false); + return __ice_aq_get_set_rss_lut(hw, get_params, false); } /** * ice_aq_set_rss_lut * @hw: pointer to the hardware structure - * @vsi_handle: software VSI handle - * @lut_type: LUT table type - * @lut: pointer to the LUT buffer provided by the caller - * @lut_size: size of the LUT buffer + * @set_params: RSS LUT parameters used to specify how to set the RSS LUT * * set the RSS lookup table, PF or VSI type */ enum ice_status -ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, - u8 *lut, u16 lut_size) +ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_params) { - if (!ice_is_vsi_valid(hw, vsi_handle) || !lut) - return ICE_ERR_PARAM; - - return __ice_aq_get_set_rss_lut(hw, ice_get_hw_vsi_num(hw, vsi_handle), - lut_type, lut, lut_size, 0, true); + return __ice_aq_get_set_rss_lut(hw, set_params, true); } /** diff --git a/sys/dev/ice/ice_common.h b/sys/dev/ice/ice_common.h index 84a39b7e9b8a..3a28816fb131 100644 --- a/sys/dev/ice/ice_common.h +++ b/sys/dev/ice/ice_common.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -117,11 +117,9 @@ ice_write_tx_drbell_q_ctx(struct ice_hw *hw, u32 tx_drbell_q_index); enum ice_status -ice_aq_get_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, u8 *lut, - u16 lut_size); +ice_aq_get_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *get_params); enum ice_status -ice_aq_set_rss_lut(struct ice_hw *hw, u16 vsi_handle, u8 lut_type, u8 *lut, - u16 lut_size); +ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_params); enum ice_status ice_aq_get_rss_key(struct ice_hw *hw, u16 vsi_handle, struct ice_aqc_get_set_rss_keys *keys); @@ -240,13 +238,6 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle, struct ice_sq_cd *cd); enum ice_status ice_replay_vsi(struct ice_hw *hw, u16 vsi_handle); void ice_replay_post(struct ice_hw *hw); -void ice_sched_replay_agg_vsi_preinit(struct ice_hw *hw); -void ice_sched_replay_agg(struct ice_hw *hw); -enum ice_status ice_sched_replay_tc_node_bw(struct ice_port_info *pi); -enum ice_status ice_replay_vsi_agg(struct ice_hw *hw, u16 vsi_handle); -enum ice_status ice_sched_replay_root_node_bw(struct ice_port_info *pi); -enum ice_status -ice_sched_replay_q_bw(struct ice_port_info *pi, struct ice_q_ctx *q_ctx); struct ice_q_ctx * ice_get_lan_q_ctx(struct ice_hw *hw, u16 vsi_handle, u8 tc, u16 q_handle); void @@ -277,7 +268,7 @@ enum ice_status ice_get_cur_lldp_persist_status(struct ice_hw *hw, u32 *lldp_status); enum ice_status ice_get_dflt_lldp_persist_status(struct ice_hw *hw, u32 *lldp_status); -enum ice_status ice_get_netlist_ver_info(struct ice_hw *hw); +enum ice_status ice_get_netlist_ver_info(struct ice_hw *hw, struct ice_netlist_info *netlist); enum ice_status ice_aq_set_lldp_mib(struct ice_hw *hw, u8 mib_type, void *buf, u16 buf_size, struct ice_sq_cd *cd); diff --git a/sys/dev/ice/ice_common_sysctls.h b/sys/dev/ice/ice_common_sysctls.h index 82ead3fcfecc..17c2fce72ee7 100644 --- a/sys/dev/ice/ice_common_sysctls.h +++ b/sys/dev/ice/ice_common_sysctls.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_common_txrx.h b/sys/dev/ice/ice_common_txrx.h index 8fb3d49288d8..d5e6182c2212 100644 --- a/sys/dev/ice/ice_common_txrx.h +++ b/sys/dev/ice/ice_common_txrx.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_controlq.c b/sys/dev/ice/ice_controlq.c index 3caab15e0e41..ee8d7f5c3e8f 100644 --- a/sys/dev/ice/ice_controlq.c +++ b/sys/dev/ice/ice_controlq.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_controlq.h b/sys/dev/ice/ice_controlq.h index 0da6b025fc8c..947f1d6d1767 100644 --- a/sys/dev/ice/ice_controlq.h +++ b/sys/dev/ice/ice_controlq.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,8 +60,8 @@ enum ice_ctl_q { ICE_CTL_Q_MAILBOX, }; -/* Control Queue timeout settings - max delay 250ms */ -#define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500 /* Count 2500 times */ +/* Control Queue timeout settings - max delay 1s */ +#define ICE_CTL_Q_SQ_CMD_TIMEOUT 10000 /* Count 10000 times */ #define ICE_CTL_Q_SQ_CMD_USEC 100 /* Check every 100usec */ #define ICE_CTL_Q_ADMIN_INIT_TIMEOUT 10 /* Count 10 times */ #define ICE_CTL_Q_ADMIN_INIT_MSEC 100 /* Check every 100msec */ diff --git a/sys/dev/ice/ice_dcb.c b/sys/dev/ice/ice_dcb.c index b6275c5d07e8..abe0237eb88f 100644 --- a/sys/dev/ice/ice_dcb.c +++ b/sys/dev/ice/ice_dcb.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -994,22 +994,27 @@ ice_aq_set_dcb_parameters(struct ice_hw *hw, bool dcb_enable, /** * ice_cee_to_dcb_cfg * @cee_cfg: pointer to CEE configuration struct - * @dcbcfg: DCB configuration struct + * @pi: port information structure * * Convert CEE configuration from firmware to DCB configuration */ static void ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, - struct ice_dcbx_cfg *dcbcfg) + struct ice_port_info *pi) { u32 status, tlv_status = LE32_TO_CPU(cee_cfg->tlv_status); u32 ice_aqc_cee_status_mask, ice_aqc_cee_status_shift; + u8 i, j, err, sync, oper, app_index, ice_app_sel_type; u16 app_prio = LE16_TO_CPU(cee_cfg->oper_app_prio); - u8 i, err, sync, oper, app_index, ice_app_sel_type; u16 ice_aqc_cee_app_mask, ice_aqc_cee_app_shift; + struct ice_dcbx_cfg *cmp_dcbcfg, *dcbcfg; u16 ice_app_prot_id_type; - /* CEE PG data to ETS config */ + dcbcfg = &pi->qos_cfg.local_dcbx_cfg; + dcbcfg->dcbx_mode = ICE_DCBX_MODE_CEE; + dcbcfg->tlv_status = tlv_status; + + /* CEE PG data */ dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc; /* Note that the FW creates the oper_prio_tc nibbles reversed @@ -1036,10 +1041,16 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, } } - /* CEE PFC data to ETS config */ + /* CEE PFC data */ dcbcfg->pfc.pfcena = cee_cfg->oper_pfc_en; dcbcfg->pfc.pfccap = ICE_MAX_TRAFFIC_CLASS; + /* CEE APP TLV data */ + if (dcbcfg->app_mode == ICE_DCBX_APPS_NON_WILLING) + cmp_dcbcfg = &pi->qos_cfg.desired_dcbx_cfg; + else + cmp_dcbcfg = &pi->qos_cfg.remote_dcbx_cfg; + app_index = 0; for (i = 0; i < 3; i++) { if (i == 0) { @@ -1058,6 +1069,18 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg, ice_aqc_cee_app_shift = ICE_AQC_CEE_APP_ISCSI_S; ice_app_sel_type = ICE_APP_SEL_TCPIP; ice_app_prot_id_type = ICE_APP_PROT_ID_ISCSI; + + for (j = 0; j < cmp_dcbcfg->numapps; j++) { + u16 prot_id = cmp_dcbcfg->app[j].prot_id; + u8 sel = cmp_dcbcfg->app[j].selector; + + if (sel == ICE_APP_SEL_TCPIP && + (prot_id == ICE_APP_PROT_ID_ISCSI || + prot_id == ICE_APP_PROT_ID_ISCSI_860)) { + ice_app_prot_id_type = prot_id; + break; + } + } } else { /* FIP APP */ ice_aqc_cee_status_mask = ICE_AQC_CEE_FIP_STATUS_M; @@ -1148,11 +1171,8 @@ enum ice_status ice_get_dcb_cfg(struct ice_port_info *pi) ret = ice_aq_get_cee_dcb_cfg(pi->hw, &cee_cfg, NULL); if (ret == ICE_SUCCESS) { /* CEE mode */ - dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; - dcbx_cfg->dcbx_mode = ICE_DCBX_MODE_CEE; - dcbx_cfg->tlv_status = LE32_TO_CPU(cee_cfg.tlv_status); - ice_cee_to_dcb_cfg(&cee_cfg, dcbx_cfg); ret = ice_get_ieee_or_cee_dcb_cfg(pi, ICE_DCBX_MODE_CEE); + ice_cee_to_dcb_cfg(&cee_cfg, pi); } else if (pi->hw->adminq.sq_last_status == ICE_AQ_RC_ENOENT) { /* CEE mode not enabled try querying IEEE data */ dcbx_cfg = &pi->qos_cfg.local_dcbx_cfg; diff --git a/sys/dev/ice/ice_dcb.h b/sys/dev/ice/ice_dcb.h index 88c49c89fbd2..85d6b399cf11 100644 --- a/sys/dev/ice/ice_dcb.h +++ b/sys/dev/ice/ice_dcb.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_devids.h b/sys/dev/ice/ice_devids.h index a110133823df..8611fc170816 100644 --- a/sys/dev/ice/ice_devids.h +++ b/sys/dev/ice/ice_devids.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_drv_info.h b/sys/dev/ice/ice_drv_info.h index 9ed3e3e2fb0e..340d53e4a671 100644 --- a/sys/dev/ice/ice_drv_info.h +++ b/sys/dev/ice/ice_drv_info.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,16 +63,16 @@ * @var ice_rc_version * @brief driver release candidate version number */ -const char ice_driver_version[] = "0.26.16-k"; +const char ice_driver_version[] = "0.28.1-k"; const uint8_t ice_major_version = 0; -const uint8_t ice_minor_version = 26; -const uint8_t ice_patch_version = 16; +const uint8_t ice_minor_version = 28; +const uint8_t ice_patch_version = 1; const uint8_t ice_rc_version = 0; #define PVIDV(vendor, devid, name) \ - PVID(vendor, devid, name " - 0.26.16-k") + PVID(vendor, devid, name " - 0.28.1-k") #define PVIDV_OEM(vendor, devid, svid, sdevid, revid, name) \ - PVID_OEM(vendor, devid, svid, sdevid, revid, name " - 0.26.16-k") + PVID_OEM(vendor, devid, svid, sdevid, revid, name " - 0.28.1-k") /** * @var ice_vendor_info_array @@ -113,20 +113,11 @@ static pci_vendor_info_t ice_vendor_info_array[] = { PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP, ICE_INTEL_VENDOR_ID, 0x0008, 0, "Intel(R) Ethernet Network Adapter E810-C-Q2 for OCP3.0"), + PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP, + ICE_INTEL_VENDOR_ID, 0x000D, 0, + "Intel(R) Ethernet Network Adapter E810-L-Q2 for OCP3.0"), PVIDV(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_QSFP, "Intel(R) Ethernet Controller E810-C for QSFP"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0001, 0, - "Intel(R) Ethernet Network Adapter E810-L-1"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0002, 0, - "Intel(R) Ethernet Network Adapter E810-L-2"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0003, 0, - "Intel(R) Ethernet Network Adapter E810-L-1"), - PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, - ICE_INTEL_VENDOR_ID, 0x0004, 0, - "Intel(R) Ethernet Network Adapter E810-L-2"), PVIDV_OEM(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_SFP, ICE_INTEL_VENDOR_ID, 0x0005, 0, "Intel(R) Ethernet Network Adapter E810-XXV-4"), diff --git a/sys/dev/ice/ice_features.h b/sys/dev/ice/ice_features.h index f5ea542d8626..dcb096509f73 100644 --- a/sys/dev/ice/ice_features.h +++ b/sys/dev/ice/ice_features.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ice/ice_flex_pipe.c b/sys/dev/ice/ice_flex_pipe.c index 6a02239eca5c..e8e4403a23fe 100644 --- a/sys/dev/ice/ice_flex_pipe.c +++ b/sys/dev/ice/ice_flex_pipe.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause */ -/* Copyright (c) 2020, Intel Corporation +/* Copyright (c) 2021, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1057,6 +1057,13 @@ ice_dwnld_cfg_bufs(struct ice_hw *hw, struct ice_buf *bufs, u32 count) break; } + if (!status) { + status = ice_set_vlan_mode(hw); + if (status) + ice_debug(hw, ICE_DBG_PKG, "Failed to set VLAN mode: err %d\n", + status); + } + ice_release_global_cfg_lock(hw); return status; @@ -1126,34 +1133,40 @@ ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg) static enum ice_status ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr) { - struct ice_global_metadata_seg *meta_seg; struct ice_generic_seg_hdr *seg_hdr; ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__); if (!pkg_hdr) return ICE_ERR_PARAM; - meta_seg = (struct ice_global_metadata_seg *) - ice_find_seg_in_pkg(hw, SEGMENT_TYPE_METADATA, pkg_hdr); - if (meta_seg) { - hw->pkg_ver = meta_seg->pkg_ver; - ice_memcpy(hw->pkg_name, meta_seg->pkg_name, - sizeof(hw->pkg_name), ICE_NONDMA_TO_NONDMA); + seg_hdr = (struct ice_generic_seg_hdr *) + ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr); + if (seg_hdr) { + struct ice_meta_sect *meta; + struct ice_pkg_enum state; + + ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM); + + /* Get package information from the Metadata Section */ + meta = (struct ice_meta_sect *) + ice_pkg_enum_section((struct ice_seg *)seg_hdr, &state, + ICE_SID_METADATA); + if (!meta) { + ice_debug(hw, ICE_DBG_INIT, "Did not find ice metadata section in package\n"); + return ICE_ERR_CFG; + } + + hw->pkg_ver = meta->ver; + ice_memcpy(hw->pkg_name, meta->name, sizeof(meta->name), + ICE_NONDMA_TO_NONDMA); ice_debug(hw, ICE_DBG_PKG, "Pkg: %d.%d.%d.%d, %s\n", - meta_seg->pkg_ver.major, meta_seg->pkg_ver.minor, - meta_seg->pkg_ver.update, meta_seg->pkg_ver.draft, - meta_seg->pkg_name); *** 4759 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Mar 11 08:25:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED96156DD60; Thu, 11 Mar 2021 08:25: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 4Dx28Q6S82z4V3P; Thu, 11 Mar 2021 08:25: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 D071B216E5; Thu, 11 Mar 2021 08:25: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 12B8PwOg025895; Thu, 11 Mar 2021 08:25:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B8Pw09025894; Thu, 11 Mar 2021 08:25:58 GMT (envelope-from git) Date: Thu, 11 Mar 2021 08:25:58 GMT Message-Id: <202103110825.12B8Pw09025894@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: dba80ca2cfb0 - releng/13.0 - Make in_localip_more() fib-aware. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: dba80ca2cfb0b0c1447269e8a6a3545f428c51e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 08:25:59 -0000 The branch releng/13.0 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=dba80ca2cfb0b0c1447269e8a6a3545f428c51e6 commit dba80ca2cfb0b0c1447269e8a6a3545f428c51e6 Author: Alexander V. Chernikov AuthorDate: 2021-02-16 20:00:46 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-11 08:23:07 +0000 Make in_localip_more() fib-aware. It fixes loopback route installation for the interfaces in the different fibs using the same prefix. Reviewed By: donner PR: 189088 Approved by: re(gjb) Differential Revision: https://reviews.freebsd.org/D28673 (cherry picked from commit f67641675958cb566b0ae50dc6942017d42393fe) --- sys/netinet/in.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index eb58c3453cfc..bcf071a81e0e 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -163,18 +163,23 @@ in_ifhasaddr(struct ifnet *ifp, struct in_addr in) * the supplied one but with same IP address value. */ static struct in_ifaddr * -in_localip_more(struct in_ifaddr *ia) +in_localip_more(struct in_ifaddr *original_ia) { struct rm_priotracker in_ifa_tracker; - in_addr_t in = IA_SIN(ia)->sin_addr.s_addr; - struct in_ifaddr *it; + in_addr_t original_addr = IA_SIN(original_ia)->sin_addr.s_addr; + uint32_t original_fib = original_ia->ia_ifa.ifa_ifp->if_fib; + struct in_ifaddr *ia; IN_IFADDR_RLOCK(&in_ifa_tracker); - LIST_FOREACH(it, INADDR_HASH(in), ia_hash) { - if (it != ia && IA_SIN(it)->sin_addr.s_addr == in) { - ifa_ref(&it->ia_ifa); + LIST_FOREACH(ia, INADDR_HASH(original_addr), ia_hash) { + in_addr_t addr = IA_SIN(ia)->sin_addr.s_addr; + uint32_t fib = ia->ia_ifa.ifa_ifp->if_fib; + if (!V_rt_add_addr_allfibs && (original_fib != fib)) + continue; + if ((original_ia != ia) && (original_addr == addr)) { + ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(&in_ifa_tracker); - return (it); + return (ia); } } IN_IFADDR_RUNLOCK(&in_ifa_tracker); @@ -1007,11 +1012,6 @@ in_scrubprefix(struct in_ifaddr *target, u_int flags) if (ia_need_loopback_route(target) && (flags & LLE_STATIC)) { struct in_ifaddr *eia; - /* - * XXXME: add fib-aware in_localip. - * We definitely don't want to switch between - * prefixes in different fibs. - */ eia = in_localip_more(target); if (eia != NULL) { From owner-dev-commits-src-all@freebsd.org Thu Mar 11 08:26:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C1C856DCE0; Thu, 11 Mar 2021 08:26: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 4Dx28S0JHjz4V1F; Thu, 11 Mar 2021 08:26: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 F16B6216E6; Thu, 11 Mar 2021 08:25: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 12B8Px0i025918; Thu, 11 Mar 2021 08:25:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B8PxR9025917; Thu, 11 Mar 2021 08:25:59 GMT (envelope-from git) Date: Thu, 11 Mar 2021 08:25:59 GMT Message-Id: <202103110825.12B8PxR9025917@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 19fdc2029768 - releng/13.0 - Fix dpdk/ldradix fib lookup algorithm preference calculation. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 19fdc202976854a973067edd5a3d0c1d13a03846 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 08:26:00 -0000 The branch releng/13.0 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=19fdc202976854a973067edd5a3d0c1d13a03846 commit 19fdc202976854a973067edd5a3d0c1d13a03846 Author: Alexander V. Chernikov AuthorDate: 2021-03-07 22:05:34 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-11 08:24:44 +0000 Fix dpdk/ldradix fib lookup algorithm preference calculation. The current preference number were copied from IPv4 code, assuming 500k routes to be the full-view. Adjust with the current reality (100k full-view). Reported by: Marek Zarychta Approved by: re(gjb) (cherry picked from commit 8a25d3f6ce34b80fef5fd6a324da724c56ad94ed) --- sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c | 4 ++-- sys/netinet6/in6_fib_algo.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c b/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c index 250e3e1bde4a..17d35c16346d 100644 --- a/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c +++ b/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c @@ -129,8 +129,8 @@ rte6_get_pref(const struct rib_rtable_info *rinfo) return (1); else if (rinfo->num_prefixes < 1000) return (rinfo->num_prefixes / 10); - else if (rinfo->num_prefixes < 500000) - return (100 + rinfo->num_prefixes / 3334); + else if (rinfo->num_prefixes < 100000) + return (100 + rinfo->num_prefixes / 667); else return (250); } diff --git a/sys/netinet6/in6_fib_algo.c b/sys/netinet6/in6_fib_algo.c index c9df9387af37..04d194273168 100644 --- a/sys/netinet6/in6_fib_algo.c +++ b/sys/netinet6/in6_fib_algo.c @@ -118,8 +118,8 @@ lradix6_get_pref(const struct rib_rtable_info *rinfo) if (rinfo->num_prefixes < 10) return (255); - else if (rinfo->num_prefixes < 100000) - return (255 - rinfo->num_prefixes / 394); + else if (rinfo->num_prefixes < 10000) + return (255 - rinfo->num_prefixes / 40); else return (1); } From owner-dev-commits-src-all@freebsd.org Thu Mar 11 08:26:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACD2C56DEDA; Thu, 11 Mar 2021 08:26: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 4Dx28T2YyRz4Tl0; Thu, 11 Mar 2021 08:26: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 2EEAB212EB; Thu, 11 Mar 2021 08:26: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 12B8Q16k025939; Thu, 11 Mar 2021 08:26:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B8Q1w0025937; Thu, 11 Mar 2021 08:26:01 GMT (envelope-from git) Date: Thu, 11 Mar 2021 08:26:01 GMT Message-Id: <202103110826.12B8Q1w0025937@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 2d227a6ec371 - releng/13.0 - Fix dst/netmask handling in routing socket code. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 2d227a6ec371b970c174c0e916af5abd83deded7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 08:26:02 -0000 The branch releng/13.0 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=2d227a6ec371b970c174c0e916af5abd83deded7 commit 2d227a6ec371b970c174c0e916af5abd83deded7 Author: Alexander V. Chernikov AuthorDate: 2021-02-16 20:30:04 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-11 08:25:01 +0000 Fix dst/netmask handling in routing socket code. Traditionally routing socket code did almost zero checks on the input message except for the most basic size checks. This resulted in the unclear KPI boundary for the routing system code (`rtrequest*` and now `rib_action()`) w.r.t message validness. Multiple potential problems and nuances exists: * Host bits in RTAX_DST sockaddr. Existing applications do send prefixes with hostbits uncleared. Even `route(8)` does this, as they hope the kernel would do the job of fixing it. Code inside `rib_action()` needs to handle it on its own (see `rt_maskedcopy()` ugly hack). * There are multiple way of adding the host route: it can be DST without netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be set correspondingly. Currently, these 2 options create 2 DIFFERENT routes in the kernel. * no sockaddr length/content checking for the "secondary" fields exists: nothing stops rtsock application to send sockaddr_in with length of 25 (instead of 16). Kernel will accept it, install to RIB as is and propagate to all rtsock consumers, potentially triggering bugs in their code. Same goes for sin_port, sin_zero, etc. The goal of this change is to make rtsock verify all sockaddr and prefix consistency. Said differently, `rib_action()` or internals should NOT require to change any of the sockaddrs supplied by `rt_addrinfo` structure due to incorrectness. To be more specific, this change implements the following: * sockaddr cleanup/validation check is added immediately after getting sockaddrs from rtm. * Per-family dst/netmask checks clears host bits in dst and zeros all dst/netmask "secondary" fields. * The same netmask checking code converts /32(/128) netmasks to "host" route case (NULL netmask, RTF_HOST), removing the dualism. * Instead of allowing ANY "known" sockaddr families (0<.. Reviewed By: donner Approved by: re(gjb) Differential Revision: https://reviews.freebsd.org/D28668 (cherry picked from commit e1bdecd9f60a80604a351e38cab7cfc56e308c66) --- sys/net/if_llatbl.c | 1 + sys/net/rtsock.c | 246 +++++++++++++++++++++++++++++++++- tests/sys/net/routing/rtsock_common.h | 4 - usr.sbin/arp/arp.c | 9 -- usr.sbin/ndp/ndp.c | 10 -- 5 files changed, 241 insertions(+), 29 deletions(-) diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 97a8e3e9ccc1..7225869a07d0 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -693,6 +693,7 @@ lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinfo *info) if (dl == NULL || dl->sdl_family != AF_LINK) return (EINVAL); + /* XXX: should be ntohs() */ ifp = ifnet_byindex(dl->sdl_index); if (ifp == NULL) { log(LOG_INFO, "%s: invalid ifp (sdl_index %d)\n", diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index ba1182d55439..d9294441b2bc 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -70,6 +70,7 @@ #include #include #ifdef INET6 +#include #include #include #endif @@ -173,6 +174,7 @@ static int rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *plen); static int rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo); +static int cleanup_xaddrs(struct rt_addrinfo *info); static int sysctl_dumpentry(struct rtentry *rt, void *vw); static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, uint32_t weight, struct walkarg *w); @@ -590,11 +592,9 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fibnum, struct rt_addrinfo * if (rtm->rtm_flags & RTF_RNH_LOCKED) return (EINVAL); info->rti_flags = rtm->rtm_flags; - if (info->rti_info[RTAX_DST] == NULL || - info->rti_info[RTAX_DST]->sa_family >= AF_MAX || - (info->rti_info[RTAX_GATEWAY] != NULL && - info->rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) - return (EINVAL); + error = cleanup_xaddrs(info); + if (error != 0) + return (error); saf = info->rti_info[RTAX_DST]->sa_family; /* * Verify that the caller has the appropriate privilege; RTM_GET @@ -693,7 +693,14 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, RIB_RLOCK(rnh); - if (info->rti_info[RTAX_NETMASK] == NULL) { + /* + * By (implicit) convention host route (one without netmask) + * means longest-prefix-match request and the route with netmask + * means exact-match lookup. + * As cleanup_xaddrs() cleans up info flags&addrs for the /32,/128 + * prefixes, use original data to check for the netmask presence. + */ + if ((rtm->rtm_addrs & RTA_NETMASK) == 0) { /* * Provide longest prefix match for * address lookup (no mask). @@ -1230,6 +1237,233 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo) return (0); } +#ifdef INET +static inline void +fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) +{ + + const struct sockaddr_in nsin = { + .sin_family = AF_INET, + .sin_len = sizeof(struct sockaddr_in), + .sin_addr = addr, + }; + *sin = nsin; +} +#endif + +#ifdef INET6 +static inline void +fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr *addr6, + uint32_t scopeid) +{ + + const struct sockaddr_in6 nsin6 = { + .sin6_family = AF_INET6, + .sin6_len = sizeof(struct sockaddr_in6), + .sin6_addr = *addr6, + .sin6_scope_id = scopeid, + }; + *sin6 = nsin6; +} +#endif + +/* + * Checks if gateway is suitable for lltable operations. + * Lltable code requires AF_LINK gateway with ifindex + * and mac address specified. + * Returns 0 on success. + */ +static int +cleanup_xaddrs_lladdr(struct rt_addrinfo *info) +{ + struct sockaddr_dl *sdl = (struct sockaddr_dl *)info->rti_info[RTAX_GATEWAY]; + + if (sdl->sdl_family != AF_LINK) + return (EINVAL); + + if (sdl->sdl_index == 0) + return (EINVAL); + + if (offsetof(struct sockaddr_dl, sdl_data) + sdl->sdl_nlen + sdl->sdl_alen > sdl->sdl_len) + return (EINVAL); + + return (0); +} + +static int +cleanup_xaddrs_gateway(struct rt_addrinfo *info) +{ + struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; + + if (info->rti_flags & RTF_LLDATA) + return (cleanup_xaddrs_lladdr(info)); + + switch (gw->sa_family) { +#ifdef INET + case AF_INET: + { + struct sockaddr_in *gw_sin = (struct sockaddr_in *)gw; + if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { + printf("gw sin_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); + } + break; +#endif +#ifdef INET6 + case AF_INET6: + { + struct sockaddr_in6 *gw_sin6 = (struct sockaddr_in6 *)gw; + if (gw_sin6->sin6_len < sizeof(struct sockaddr_in6)) { + printf("gw sin6_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet6(gw_sin6, &gw_sin6->sin6_addr, 0); + break; + } +#endif + case AF_LINK: + { + struct sockaddr_dl_short *gw_sdl; + + gw_sdl = (struct sockaddr_dl_short *)gw; + if (gw_sdl->sdl_len < sizeof(struct sockaddr_dl_short)) { + printf("gw sdl_len too small\n"); + return (EINVAL); + } + + const struct sockaddr_dl_short sdl = { + .sdl_family = AF_LINK, + .sdl_len = sizeof(struct sockaddr_dl_short), + .sdl_index = gw_sdl->sdl_index, + }; + *gw_sdl = sdl; + break; + } + } + + return (0); +} + +static void +remove_netmask(struct rt_addrinfo *info) +{ + info->rti_info[RTAX_NETMASK] = NULL; + info->rti_flags |= RTF_HOST; + info->rti_addrs &= ~RTA_NETMASK; +} + +#ifdef INET +static int +cleanup_xaddrs_inet(struct rt_addrinfo *info) +{ + struct sockaddr_in *dst_sa, *mask_sa; + + /* Check & fixup dst/netmask combination first */ + dst_sa = (struct sockaddr_in *)info->rti_info[RTAX_DST]; + mask_sa = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; + + struct in_addr mask = { + .s_addr = mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST, + }; + struct in_addr dst = { + .s_addr = htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s_addr)) + }; + + if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { + printf("dst sin_len too small\n"); + return (EINVAL); + } + if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { + printf("mask sin_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet(dst_sa, dst); + + if (mask.s_addr != INADDR_BROADCAST) + fill_sockaddr_inet(mask_sa, mask); + else + remove_netmask(info); + + /* Check gateway */ + if (info->rti_info[RTAX_GATEWAY] != NULL) + return (cleanup_xaddrs_gateway(info)); + + return (0); +} +#endif + +#ifdef INET6 +static int +cleanup_xaddrs_inet6(struct rt_addrinfo *info) +{ + struct sockaddr_in6 *dst_sa, *mask_sa; + struct in6_addr mask; + + /* Check & fixup dst/netmask combination first */ + dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; + mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]; + + mask = mask_sa ? mask_sa->sin6_addr : in6mask128; + IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); + + if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { + printf("dst sin6_len too small\n"); + return (EINVAL); + } + if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) { + printf("mask sin6_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); + + if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) + fill_sockaddr_inet6(mask_sa, &mask, 0); + else + remove_netmask(info); + + /* Check gateway */ + if (info->rti_info[RTAX_GATEWAY] != NULL) + return (cleanup_xaddrs_gateway(info)); + + return (0); +} +#endif + +static int +cleanup_xaddrs(struct rt_addrinfo *info) +{ + int error = EAFNOSUPPORT; + + if (info->rti_info[RTAX_DST] == NULL) + return (EINVAL); + + if (info->rti_flags & RTF_LLDATA) { + /* + * arp(8)/ndp(8) sends RTA_NETMASK for the associated + * prefix along with the actual address in RTA_DST. + * Remove netmask to avoid unnecessary address masking. + */ + remove_netmask(info); + } + + switch (info->rti_info[RTAX_DST]->sa_family) { +#ifdef INET + case AF_INET: + error = cleanup_xaddrs_inet(info); + break; +#endif +#ifdef INET6 + case AF_INET6: + error = cleanup_xaddrs_inet6(info); + break; +#endif + } + + return (error); +} + /* * Fill in @dmask with valid netmask leaving original @smask * intact. Mostly used with radix netmasks. diff --git a/tests/sys/net/routing/rtsock_common.h b/tests/sys/net/routing/rtsock_common.h index 7da88e0eb512..71476d2b5f3c 100644 --- a/tests/sys/net/routing/rtsock_common.h +++ b/tests/sys/net/routing/rtsock_common.h @@ -826,10 +826,6 @@ _validate_message_sockaddrs(char *buffer, int rtm_len, size_t offset, int rtm_ad } sa = (struct sockaddr *)((char *)sa + SA_SIZE(sa)); } - - RTSOCK_ATF_REQUIRE_MSG((struct rt_msghdr *)buffer, parsed_len == rtm_len, - "message len != parsed len: expected %d parsed %d", - rtm_len, (int)parsed_len); } /* diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 07e07f1f2da9..08698c7bc299 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -717,7 +717,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) static int seq; int rlen; int l; - struct sockaddr_in so_mask, *som = &so_mask; static int s = -1; static pid_t pid; @@ -735,9 +734,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) xo_err(1, "socket"); pid = getpid(); } - bzero(&so_mask, sizeof(so_mask)); - so_mask.sin_len = 8; - so_mask.sin_addr.s_addr = 0xffffffff; errno = 0; /* @@ -758,10 +754,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) rtm->rtm_rmx.rmx_expire = expire_time; rtm->rtm_inits = RTV_EXPIRE; rtm->rtm_flags |= (RTF_HOST | RTF_STATIC | RTF_LLDATA); - if (doing_proxy) { - rtm->rtm_addrs |= RTA_NETMASK; - rtm->rtm_flags &= ~RTF_HOST; - } /* FALLTHROUGH */ case RTM_GET: rtm->rtm_addrs |= RTA_DST; @@ -776,7 +768,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) NEXTADDR(RTA_DST, dst); NEXTADDR(RTA_GATEWAY, sdl); - NEXTADDR(RTA_NETMASK, som); rtm->rtm_msglen = cp - (char *)&m_rtmsg; doit: diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index aa40e2775a59..ce21e34417c3 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -860,12 +860,6 @@ rtmsg(int cmd) rtm->rtm_inits = RTV_EXPIRE; } rtm->rtm_flags |= (RTF_HOST | RTF_STATIC | RTF_LLDATA); -#if 0 /* we don't support ipv6addr/128 type proxying */ - if (rtm->rtm_flags & RTF_ANNOUNCE) { - rtm->rtm_flags &= ~RTF_HOST; - rtm->rtm_addrs |= RTA_NETMASK; - } -#endif /* FALLTHROUGH */ case RTM_GET: rtm->rtm_addrs |= RTA_DST; @@ -873,10 +867,6 @@ rtmsg(int cmd) NEXTADDR(RTA_DST, sin_m); NEXTADDR(RTA_GATEWAY, sdl_m); -#if 0 /* we don't support ipv6addr/128 type proxying */ - memset(&so_mask.sin6_addr, 0xff, sizeof(so_mask.sin6_addr)); - NEXTADDR(RTA_NETMASK, so_mask); -#endif rtm->rtm_msglen = cp - (char *)&m_rtmsg; doit: From owner-dev-commits-src-all@freebsd.org Thu Mar 11 08:36:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B37156E213; Thu, 11 Mar 2021 08:36: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 4Dx2NJ3yKvz4W0S; Thu, 11 Mar 2021 08:36: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 766EA2166C; Thu, 11 Mar 2021 08:36: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 12B8aGmO038970; Thu, 11 Mar 2021 08:36:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B8aGXA038969; Thu, 11 Mar 2021 08:36:16 GMT (envelope-from git) Date: Thu, 11 Mar 2021 08:36:16 GMT Message-Id: <202103110836.12B8aGXA038969@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 83cedad13972 - stable/13 - Fix 'in6_purgeaddr: err=65, destination address delete failed' message. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 83cedad139721c6c150be8c078417cfcb311ee78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 08:36:16 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=83cedad139721c6c150be8c078417cfcb311ee78 commit 83cedad139721c6c150be8c078417cfcb311ee78 Author: Alexander V. Chernikov AuthorDate: 2021-03-08 20:27:29 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-11 08:35:22 +0000 Fix 'in6_purgeaddr: err=65, destination address delete failed' message. P2P ifa may require 2 routes: one is the loopback route, another is the "prefix" route towards its destination. Current code marks loopback routes existence with IFA_RTSELF and "prefix" p2p routes with IFA_ROUTE. For historic reasons, we fill in ifa_dstaddr for loopback interfaces. To avoid installing the same route twice, we preemptively set IFA_RTSELF when adding "prefix" route for loopback. However, the teardown part doesn't have this hack, so we try to remove the same route twice. Fix this by checking if ifa_dstaddr is different from the ifa_addr and moving this logic into a separate function. Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D29121 (cherry picked from commit 7634919e15f1147b6f26d55354be375bc9b198db) --- sys/netinet6/in6.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 4665a21c28fd..02cb9df7da3a 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1294,13 +1294,27 @@ in6_handle_dstaddr_rtrequest(int cmd, struct in6_ifaddr *ia) return (error); } +static bool +ifa_is_p2p(struct in6_ifaddr *ia) +{ + int plen; + + plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ + + if ((plen == 128) && (ia->ia_dstaddr.sin6_family == AF_INET6) && + !IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, &ia->ia_dstaddr.sin6_addr)) + return (true); + + return (false); +} + void in6_purgeaddr(struct ifaddr *ifa) { struct ifnet *ifp = ifa->ifa_ifp; struct in6_ifaddr *ia = (struct in6_ifaddr *) ifa; struct in6_multi_mship *imm; - int plen, error; + int error; if (ifa->ifa_carp) (*carp_detach_p)(ifa, false); @@ -1328,10 +1342,7 @@ in6_purgeaddr(struct ifaddr *ifa) free(imm, M_IP6MADDR); } /* Check if we need to remove p2p route */ - plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ - if (ia->ia_dstaddr.sin6_family != AF_INET6) - plen = 0; - if ((ia->ia_flags & IFA_ROUTE) && plen == 128) { + if ((ia->ia_flags & IFA_ROUTE) && ifa_is_p2p(ia)) { error = in6_handle_dstaddr_rtrequest(RTM_DELETE, ia); if (error != 0) log(LOG_INFO, "%s: err=%d, destination address delete " @@ -1434,7 +1445,7 @@ static int in6_notify_ifa(struct ifnet *ifp, struct in6_ifaddr *ia, struct in6_aliasreq *ifra, int hostIsNew) { - int error = 0, plen, ifacount = 0; + int error = 0, ifacount = 0; struct ifaddr *ifa; struct sockaddr_in6 *pdst; char ip6buf[INET6_ADDRSTRLEN]; @@ -1487,14 +1498,7 @@ in6_notify_ifa(struct ifnet *ifp, struct in6_ifaddr *ia, * XXX: the logic below rejects assigning multiple addresses on a p2p * interface that share the same destination. */ - plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ - if (!(ia->ia_flags & IFA_ROUTE) && plen == 128 && - ia->ia_dstaddr.sin6_family == AF_INET6) { - /* - * Handle the case for ::1 . - */ - if (ifp->if_flags & IFF_LOOPBACK) - ia->ia_flags |= IFA_RTSELF; + if (!(ia->ia_flags & IFA_ROUTE) && ifa_is_p2p(ia)) { error = in6_handle_dstaddr_rtrequest(RTM_ADD, ia); if (error) goto done; From owner-dev-commits-src-all@freebsd.org Thu Mar 11 08:50:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C077456ED0C; Thu, 11 Mar 2021 08:50: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 4Dx2h853RSz4WMG; Thu, 11 Mar 2021 08:50: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 A070821D8E; Thu, 11 Mar 2021 08:50: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 12B8o0AJ053150; Thu, 11 Mar 2021 08:50:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B8o0rX053134; Thu, 11 Mar 2021 08:50:00 GMT (envelope-from git) Date: Thu, 11 Mar 2021 08:50:00 GMT Message-Id: <202103110850.12B8o0rX053134@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: cb603e3ea2d4 - releng/13.0 - backlight: Fix incr/decr with percent value of 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: cb603e3ea2d4f2fee8fa4e59bda7e27704b6899c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 08:50:00 -0000 The branch releng/13.0 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=cb603e3ea2d4f2fee8fa4e59bda7e27704b6899c commit cb603e3ea2d4f2fee8fa4e59bda7e27704b6899c Author: David Schlachter AuthorDate: 2021-03-03 07:57:35 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-11 08:49:03 +0000 backlight: Fix incr/decr with percent value of 0 This now does nothing instead of incr/decr by 10% MFC After: 3 days PR: 253736 Approved by: re (gjb) (cherry picked from commit 3b005d51bd0fe4d8d19fb2df4d470b6e8baebf16) (cherry picked from commit 9ba393f2ca0fd561c1fbf96f38eb014d7f883381) --- usr.bin/backlight/backlight.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.bin/backlight/backlight.c b/usr.bin/backlight/backlight.c index 1dae0cfe5c62..9cf7a0912e95 100644 --- a/usr.bin/backlight/backlight.c +++ b/usr.bin/backlight/backlight.c @@ -98,7 +98,7 @@ main(int argc, char *argv[]) BACKLIGHTGETSTATUS, BACKLIGHTUPDATESTATUS, BACKLIGHTGETINFO}; - long percent = 0; + long percent = -1; const char *percent_error; uint32_t i; bool setname; @@ -188,15 +188,20 @@ main(int argc, char *argv[]) } break; case BACKLIGHT_SET_BRIGHTNESS: + if (percent == -1) + usage(); props.brightness = percent; if (ioctl(fd, BACKLIGHTUPDATESTATUS, &props) == -1) errx(1, "Cannot update the backlight device"); break; case BACKLIGHT_INCR: case BACKLIGHT_DECR: + if (percent == 0) + /* Avoid any ioctl if we don't have anything to do */ + break; if (ioctl(fd, BACKLIGHTGETSTATUS, &props) == -1) errx(1, "Cannot query the backlight device"); - percent = percent == 0 ? 10 : percent; + percent = percent == -1 ? 10 : percent; percent = action == BACKLIGHT_INCR ? percent : -percent; props.brightness += percent; if ((int)props.brightness < 0) From owner-dev-commits-src-all@freebsd.org Thu Mar 11 08:50:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D069256EA5B; Thu, 11 Mar 2021 08:50: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 4Dx2h95ZQxz4WVB; Thu, 11 Mar 2021 08: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 B2E6221C4C; Thu, 11 Mar 2021 08: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 12B8o1pC053535; Thu, 11 Mar 2021 08: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 12B8o15Z053532; Thu, 11 Mar 2021 08:50:01 GMT (envelope-from git) Date: Thu, 11 Mar 2021 08:50:01 GMT Message-Id: <202103110850.12B8o15Z053532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: e9bdfe2dd4cf - releng/13.0 - backlight(8): Add note that with option it print the current brightness. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: e9bdfe2dd4cf06cbfbcb14c4bdc4d2ec1eed0ae8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 08:50:01 -0000 The branch releng/13.0 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=e9bdfe2dd4cf06cbfbcb14c4bdc4d2ec1eed0ae8 commit e9bdfe2dd4cf06cbfbcb14c4bdc4d2ec1eed0ae8 Author: Emmanuel Vadot AuthorDate: 2021-03-03 08:00:42 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-11 08:49:31 +0000 backlight(8): Add note that with option it print the current brightness. MFC after: 3 days PR: 253737 Approved by: re (gjb) (cherry picked from commit 1df30489a8f7083c98010c94d9ce522f9e8213dc) (cherry picked from commit f21c0366f532888bec164717a93964610ab6baf6) --- usr.bin/backlight/backlight.8 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.bin/backlight/backlight.8 b/usr.bin/backlight/backlight.8 index 8c3b634e152b..ce2d0e4b0325 100644 --- a/usr.bin/backlight/backlight.8 +++ b/usr.bin/backlight/backlight.8 @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 27, 2020 +.Dd March 03, 2021 .Dt BACKLIGHT 8 .Os .Sh NAME @@ -47,6 +47,9 @@ The .Nm utility can be used to configure brightness levels for registered backlights. .Pp +If call without any option it will print the current brightness level of the first +registered backlight. +.Pp The options are as follows: .Bl -tag -width "-f device" .It Fl f Ar device From owner-dev-commits-src-all@freebsd.org Thu Mar 11 08:58:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 291BE56F64C; Thu, 11 Mar 2021 08:58: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 4Dx2tQ0Msjz4Xg2; Thu, 11 Mar 2021 08:58: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 E958F21B3C; Thu, 11 Mar 2021 08:58: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 12B8wrxh065869; Thu, 11 Mar 2021 08:58:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B8wrkZ065868; Thu, 11 Mar 2021 08:58:53 GMT (envelope-from git) Date: Thu, 11 Mar 2021 08:58:53 GMT Message-Id: <202103110858.12B8wrkZ065868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 7d4a5de84d5e - main - share/man/man9/pwmbus.9 fix types in arguments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d4a5de84d5e54242edc06573522616869e0b37a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 08:58:54 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=7d4a5de84d5e54242edc06573522616869e0b37a commit 7d4a5de84d5e54242edc06573522616869e0b37a Author: Oskar Holmund AuthorDate: 2021-03-11 08:53:26 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-11 08:57:04 +0000 share/man/man9/pwmbus.9 fix types in arguments Fix the types of period and duty in share/man/man9/pwmbus.9 to match the one in sys/dev/pmw/pwmbus.c. Reviewed By: rpokala Differential Revision: https://reviews.freebsd.org/D29139 MFC after: 3 days --- share/man/man9/pwmbus.9 | 30 +++++++++++++++--------------- sys/dev/pwm/pwmbus_if.m | 14 +++++++------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/share/man/man9/pwmbus.9 b/share/man/man9/pwmbus.9 index a233d035dba9..858a27b9afe3 100644 --- a/share/man/man9/pwmbus.9 +++ b/share/man/man9/pwmbus.9 @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 21, 2019 +.Dd March 9, 2021 .Dt PWMBUS 9 .Os .Sh NAME @@ -40,19 +40,19 @@ .Cd "device pwm" .In "pwmbus_if.h" .Ft int -.Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" "uint64_t duty" +.Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "u_int channel" "u_int period" "u_int duty" .Ft int -.Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int channel" "int *nchannel" +.Fn PWMBUS_CHANNEL_COUNT "device_t bus" "u_int *nchannel" .Ft int -.Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable" +.Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "u_int channel" "bool enable" .Ft int -.Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty" +.Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "u_int channel" "u_int *period" "u_int *duty" .Ft int -.Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags" +.Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "u_int channel" "uint32_t *flags" .Ft int -.Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "int channel" "bool *enabled" +.Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "u_int channel" "bool *enabled" .Ft int -.Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags" +.Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "u_int channel" "uint32_t flags" .Sh DESCRIPTION The PWMBUS (Pulse-Width Modulation) interface allows a device driver to register to a global bus so other devices in the kernel can use them in a @@ -76,7 +76,7 @@ Consult the documentation for the underlying PWM hardware device driver for details on channels that share resources. .Sh INTERFACE .Bl -tag -width indent -.It Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" "uint64_t duty" +.It Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "u_int channel" "u_int period" "u_int duty" Configure the period and duty (in nanoseconds) in the PWM controller on the bus for the specified channel. Returns 0 on success or @@ -85,19 +85,19 @@ if the values are not supported by the controller or .Er EBUSY if the PWMBUS controller is in use and does not support changing the value on the fly. -.It Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int *nchannel" +.It Fn PWMBUS_CHANNEL_COUNT "device_t bus" "u_int *nchannel" Get the number of channels supported by the controller. -.It Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable" +.It Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "u_int channel" "bool enable" Enable the PWM channel. -.It Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" "uint64_t *duty" +.It Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "u_int channel" "u_int *period" "u_int *duty" Get the current configuration of the period and duty for the specified channel. -.It Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags" +.It Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "u_int channel" "uint32_t *flags" Get the current flags for the channel. If the driver or controller does not support this, a default method returns a flags value of zero. -.It Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "int channel" "bool *enable" +.It Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "u_int channel" "bool *enable" Test whether the PWM channel is enabled. -.It Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags" +.It Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "u_int channel" "uint32_t flags" Set the flags of the channel (such as inverted polarity). If the driver or controller does not support this a do-nothing default method is used. diff --git a/sys/dev/pwm/pwmbus_if.m b/sys/dev/pwm/pwmbus_if.m index 4e7b49bf405c..f81e92907847 100644 --- a/sys/dev/pwm/pwmbus_if.m +++ b/sys/dev/pwm/pwmbus_if.m @@ -33,14 +33,14 @@ INTERFACE pwmbus; CODE { static int - pwm_default_set_flags(device_t dev, u_int channel, uint32_t flags) + pwm_default_set_flags(device_t bus, u_int channel, uint32_t flags) { return (EOPNOTSUPP); } static int - pwm_default_get_flags(device_t dev, u_int channel, uint32_t *flags) + pwm_default_get_flags(device_t bus, u_int channel, uint32_t *flags) { *flags = 0; @@ -55,8 +55,8 @@ CODE { METHOD int channel_config { device_t bus; u_int channel; - unsigned int period; - unsigned int duty; + u_int period; + u_int duty; }; # @@ -66,8 +66,8 @@ METHOD int channel_config { METHOD int channel_get_config { device_t bus; u_int channel; - unsigned int *period; - unsigned int *duty; + u_int *period; + u_int *duty; }; # @@ -83,7 +83,7 @@ METHOD int channel_set_flags { # Get the flags # METHOD int channel_get_flags { - device_t dev; + device_t bus; u_int channel; uint32_t *flags; } DEFAULT pwm_default_get_flags; From owner-dev-commits-src-all@freebsd.org Thu Mar 11 08:58:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 353BF56F367; Thu, 11 Mar 2021 08:58: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 4Dx2tR12KZz4Xg3; Thu, 11 Mar 2021 08:58: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 166B821F8F; Thu, 11 Mar 2021 08:58: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 12B8wseO065892; Thu, 11 Mar 2021 08:58:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B8wsgJ065891; Thu, 11 Mar 2021 08:58:54 GMT (envelope-from git) Date: Thu, 11 Mar 2021 08:58:54 GMT Message-Id: <202103110858.12B8wsgJ065891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 17b14d8f7733 - main - usr.sbin/pwm/pwm add support for flags MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 17b14d8f7733d39397ae5fc104547e358f5f7ddf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 08:58:55 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=17b14d8f7733d39397ae5fc104547e358f5f7ddf commit 17b14d8f7733d39397ae5fc104547e358f5f7ddf Author: Oskar Holmund AuthorDate: 2021-03-11 08:55:23 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-11 08:57:56 +0000 usr.sbin/pwm/pwm add support for flags The pwm utility cant set the only flag defined (PWM_POLARITY_INVERTED) so this patch add the option -I (capital letter i) to send it to the drivers. None of existing PWM driver have implemented support for flags. But soon:ish I will put up an review of a pwm driver using TI OMAP DMTimer. Differential Revision: https://reviews.freebsd.org/D29137 MFC after: 2 weeks --- sys/dev/pwm/pwmc.c | 19 ++++++++++++++++--- usr.sbin/pwm/pwm.8 | 3 +++ usr.sbin/pwm/pwm.c | 19 +++++++++++++++---- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/sys/dev/pwm/pwmc.c b/sys/dev/pwm/pwmc.c index c49d1e894488..b2f12add3e2b 100644 --- a/sys/dev/pwm/pwmc.c +++ b/sys/dev/pwm/pwmc.c @@ -80,9 +80,16 @@ pwm_ioctl(struct cdev *dev, u_long cmd, caddr_t data, bcopy(data, &state, sizeof(state)); rv = PWMBUS_CHANNEL_CONFIG(bus, sc->chan, state.period, state.duty); - if (rv == 0) - rv = PWMBUS_CHANNEL_ENABLE(bus, sc->chan, - state.enable); + if (rv != 0) + return (rv); + + rv = PWMBUS_CHANNEL_SET_FLAGS(bus, + sc->chan, state.flags); + if (rv != 0 && rv != EOPNOTSUPP) + return (rv); + + rv = PWMBUS_CHANNEL_ENABLE(bus, sc->chan, + state.enable); break; case PWMGETSTATE: bcopy(data, &state, sizeof(state)); @@ -90,6 +97,12 @@ pwm_ioctl(struct cdev *dev, u_long cmd, caddr_t data, &state.period, &state.duty); if (rv != 0) return (rv); + + rv = PWMBUS_CHANNEL_GET_FLAGS(bus, sc->chan, + &state.flags); + if (rv != 0) + return (rv); + rv = PWMBUS_CHANNEL_IS_ENABLED(bus, sc->chan, &state.enable); if (rv != 0) diff --git a/usr.sbin/pwm/pwm.8 b/usr.sbin/pwm/pwm.8 index 37c1aa8fec49..94be5af7f703 100644 --- a/usr.sbin/pwm/pwm.8 +++ b/usr.sbin/pwm/pwm.8 @@ -35,6 +35,7 @@ .Nm .Op Fl f Ar device .Op Fl D | Fl E +.Op Fl I .Op Fl p Ar period .Op Fl d Ar duty .Sh DESCRIPTION @@ -82,6 +83,8 @@ during which the signal is asserted. Enable the PWM channel. .It Fl p Ar period Configure the period (in nanoseconds) of the PWM channel. +.It Fl I +Invert PWM signal polarity .El .Sh EXAMPLES .Bl -bullet diff --git a/usr.sbin/pwm/pwm.c b/usr.sbin/pwm/pwm.c index a69fe16fea22..441181917afd 100644 --- a/usr.sbin/pwm/pwm.c +++ b/usr.sbin/pwm/pwm.c @@ -48,6 +48,7 @@ #define PWM_SHOW_CONFIG 0x0004 #define PWM_PERIOD 0x0008 #define PWM_DUTY 0x0010 +#define PWM_INVERTED 0x0020 static char device_name[PATH_MAX] = "/dev/pwm/pwmc0.0"; @@ -66,7 +67,7 @@ usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, "\tpwm [-f dev] -C\n"); - fprintf(stderr, "\tpwm [-f dev] [-D | -E] [-p period] [-d duty[%%]]\n"); + fprintf(stderr, "\tpwm [-f dev] [-D | -E] [-I] [-p period] [-d duty[%%]]\n"); exit(1); } @@ -87,7 +88,7 @@ main(int argc, char *argv[]) fd = -1; period = duty = -1; - while ((ch = getopt(argc, argv, "f:EDCp:d:")) != -1) { + while ((ch = getopt(argc, argv, "f:EDCIp:d:")) != -1) { switch (ch) { case 'E': if (action & (PWM_DISABLE | PWM_SHOW_CONFIG)) @@ -104,6 +105,11 @@ main(int argc, char *argv[]) usage(); action = PWM_SHOW_CONFIG; break; + case 'I': + if (action & PWM_SHOW_CONFIG) + usage(); + action |= PWM_INVERTED; + break; case 'p': if (action & PWM_SHOW_CONFIG) usage(); @@ -172,10 +178,11 @@ main(int argc, char *argv[]) } if (action == PWM_SHOW_CONFIG) { - printf("period: %u\nduty: %u\nenabled:%d\n", + printf("period: %u\nduty: %u\nenabled:%d\ninverted:%d\n", state.period, state.duty, - state.enable); + state.enable, + state.flags & PWM_POLARITY_INVERTED); } else { if (action & PWM_ENABLE) state.enable = true; @@ -183,6 +190,10 @@ main(int argc, char *argv[]) state.enable = false; if (action & PWM_PERIOD) state.period = period; + if (action & PWM_INVERTED) + state.flags |= PWM_POLARITY_INVERTED; + else + state.flags &= ~PWM_POLARITY_INVERTED; if (action & PWM_DUTY) { if (*percent != '\0') state.duty = (uint64_t)state.period * duty / 100; From owner-dev-commits-src-all@freebsd.org Thu Mar 11 09:41:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84359570EFC; Thu, 11 Mar 2021 09:41: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 4Dx3qC3P2vz4bR9; Thu, 11 Mar 2021 09:41: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 6713922745; Thu, 11 Mar 2021 09:41: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 12B9fBhh029737; Thu, 11 Mar 2021 09:41:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12B9fBZS029736; Thu, 11 Mar 2021 09:41:11 GMT (envelope-from git) Date: Thu, 11 Mar 2021 09:41:11 GMT Message-Id: <202103110941.12B9fBZS029736@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 5e9dae8e149a - main - pf: Factor out pf_krule_free() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5e9dae8e149ae8848f52148b665f3a0d031ca40f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 09:41:11 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5e9dae8e149ae8848f52148b665f3a0d031ca40f commit 5e9dae8e149ae8848f52148b665f3a0d031ca40f Author: Kristof Provost AuthorDate: 2021-03-10 10:10:04 +0000 Commit: Kristof Provost CommitDate: 2021-03-11 09:39:43 +0000 pf: Factor out pf_krule_free() Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29194 --- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/pf_ioctl.c | 50 ++++++++++++++++++++--------------------------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 3f2075b8f0e2..31be6b7a833d 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1641,6 +1641,8 @@ void pf_remove_if_empty_kruleset(struct pf_kruleset *); struct pf_kruleset *pf_find_kruleset(const char *); struct pf_kruleset *pf_find_or_create_kruleset(const char *); void pf_rs_initialize(void); + +void pf_krule_free(struct pf_krule *); #endif /* The fingerprint functions can be linked into userland programs (tcpdump) */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c32a961f5a0b..5f9eb771d0e0 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -466,15 +466,8 @@ pf_free_rule(struct pf_krule *rule) pfi_kkif_unref(rule->kif); pf_kanchor_remove(rule); pf_empty_kpool(&rule->rpool.list); - counter_u64_free(rule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_free(rule->packets[i]); - counter_u64_free(rule->bytes[i]); - } - counter_u64_free(rule->states_cur); - counter_u64_free(rule->states_tot); - counter_u64_free(rule->src_nodes); - free(rule, M_PFRULE); + + pf_krule_free(rule); } static void @@ -1435,6 +1428,23 @@ pf_altq_get_nth_active(u_int32_t n) } #endif /* ALTQ */ +void +pf_krule_free(struct pf_krule *rule) +{ + if (rule == NULL) + return; + + counter_u64_free(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(rule->packets[i]); + counter_u64_free(rule->bytes[i]); + } + counter_u64_free(rule->states_cur); + counter_u64_free(rule->states_tot); + counter_u64_free(rule->src_nodes); + free(rule, M_PFRULE); +} + static void pf_kpooladdr_to_pooladdr(const struct pf_kpooladdr *kpool, struct pf_pooladdr *pool) @@ -1990,15 +2000,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td #undef ERROUT DIOCADDRULE_error: PF_RULES_WUNLOCK(); - counter_u64_free(rule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_free(rule->packets[i]); - counter_u64_free(rule->bytes[i]); - } - counter_u64_free(rule->states_cur); - counter_u64_free(rule->states_tot); - counter_u64_free(rule->src_nodes); - free(rule, M_PFRULE); + pf_krule_free(rule); if (kif) pf_kkif_free(kif); break; @@ -2297,17 +2299,7 @@ DIOCADDRULE_error: #undef ERROUT DIOCCHANGERULE_error: PF_RULES_WUNLOCK(); - if (newrule != NULL) { - counter_u64_free(newrule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_free(newrule->packets[i]); - counter_u64_free(newrule->bytes[i]); - } - counter_u64_free(newrule->states_cur); - counter_u64_free(newrule->states_tot); - counter_u64_free(newrule->src_nodes); - free(newrule, M_PFRULE); - } + pf_krule_free(newrule); if (kif != NULL) pf_kkif_free(kif); break; From owner-dev-commits-src-all@freebsd.org Thu Mar 11 09:41:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9410570FAC; Thu, 11 Mar 2021 09:41: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 4Dx3qD4RcPz4bLC; Thu, 11 Mar 2021 09: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 8B497226CD; Thu, 11 Mar 2021 09: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 12B9fCKO029759; Thu, 11 Mar 2021 09: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 12B9fC9Z029758; Thu, 11 Mar 2021 09:41:12 GMT (envelope-from git) Date: Thu, 11 Mar 2021 09:41:12 GMT Message-Id: <202103110941.12B9fC9Z029758@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 913e7dc3e0eb - main - pf: Remove redundant kif != NULL checks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 913e7dc3e0eb7df78ec0e7ecc7dd160a316a3ac6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 09:41:12 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=913e7dc3e0eb7df78ec0e7ecc7dd160a316a3ac6 commit 913e7dc3e0eb7df78ec0e7ecc7dd160a316a3ac6 Author: Kristof Provost AuthorDate: 2021-03-10 14:50:42 +0000 Commit: Kristof Provost CommitDate: 2021-03-11 09:39:43 +0000 pf: Remove redundant kif != NULL checks pf_kkif_free() already checks for NULL, so we don't have to check before we call it. Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29195 --- sys/netpfil/pf/pf_ioctl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 5f9eb771d0e0..977f0debacaa 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2001,8 +2001,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td DIOCADDRULE_error: PF_RULES_WUNLOCK(); pf_krule_free(rule); - if (kif) - pf_kkif_free(kif); + pf_kkif_free(kif); break; } @@ -2300,8 +2299,7 @@ DIOCADDRULE_error: DIOCCHANGERULE_error: PF_RULES_WUNLOCK(); pf_krule_free(newrule); - if (kif != NULL) - pf_kkif_free(kif); + pf_kkif_free(kif); break; } @@ -3144,8 +3142,7 @@ DIOCCHANGEADDR_error: free(newpa, M_PFRULE); } PF_RULES_WUNLOCK(); - if (kif != NULL) - pf_kkif_free(kif); + pf_kkif_free(kif); break; } From owner-dev-commits-src-all@freebsd.org Thu Mar 11 15:24:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00EF057950B; Thu, 11 Mar 2021 15:24: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 4DxCRc6Mp1z3C3K; Thu, 11 Mar 2021 15:24: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 CD82026F32; Thu, 11 Mar 2021 15:24: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 12BFOiP5079827; Thu, 11 Mar 2021 15:24:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BFOila079826; Thu, 11 Mar 2021 15:24:44 GMT (envelope-from git) Date: Thu, 11 Mar 2021 15:24:44 GMT Message-Id: <202103111524.12BFOila079826@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1645a4ae645f - main - usb: tiny formatting nit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1645a4ae645fa9b9e3571b7512caa92e73b20635 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 15:24:45 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1645a4ae645fa9b9e3571b7512caa92e73b20635 commit 1645a4ae645fa9b9e3571b7512caa92e73b20635 Author: Warner Losh AuthorDate: 2021-03-11 15:23:32 +0000 Commit: Warner Losh CommitDate: 2021-03-11 15:24:13 +0000 usb: tiny formatting nit Format 300 baud like all the others here. No functional change. --- sys/dev/usb/serial/umct.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/serial/umct.c b/sys/dev/usb/serial/umct.c index 43f28c307f6d..dd452d38a67b 100644 --- a/sys/dev/usb/serial/umct.c +++ b/sys/dev/usb/serial/umct.c @@ -478,7 +478,8 @@ static uint8_t umct_calc_baud(uint32_t baud) { switch (baud) { - case B300:return (0x1); + case B300: + return (0x1); case B600: return (0x2); case B1200: From owner-dev-commits-src-all@freebsd.org Thu Mar 11 15:37:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C19CE57954E; Thu, 11 Mar 2021 15:37: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 4DxCkp59f1z3DCS; Thu, 11 Mar 2021 15:37: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 A47A827492; Thu, 11 Mar 2021 15:37: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 12BFbsiA093086; Thu, 11 Mar 2021 15:37:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BFbsES093085; Thu, 11 Mar 2021 15:37:54 GMT (envelope-from git) Date: Thu, 11 Mar 2021 15:37:54 GMT Message-Id: <202103111537.12BFbsES093085@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: 968079f253c1 - main - vm_reserv: Fix list locking in vm_reserv_reclaim_contig() 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: 968079f253c11433d47bece4b41b46fcbf985903 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 15:37:54 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=968079f253c11433d47bece4b41b46fcbf985903 commit 968079f253c11433d47bece4b41b46fcbf985903 Author: Mark Johnston AuthorDate: 2021-03-11 15:34:28 +0000 Commit: Mark Johnston CommitDate: 2021-03-11 15:35:35 +0000 vm_reserv: Fix list locking in vm_reserv_reclaim_contig() The per-domain partpop queue is locked by the combination of the per-domain lock and individual reservation mutexes. vm_reserv_reclaim_contig() scans the queue looking for partially populated reservations that can be reclaimed in order to satisfy the caller's allocation. During the scan, we drop the per-domain lock. At this point, the rvn pointer may be invalidated. Take care to load rvn after re-acquiring the per-domain lock. While here, simplify the condition used to check whether a reservation was dequeued while the per-domain lock was dropped. Reviewed by: alc, kib Reported by: gallatin MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29203 --- sys/vm/vm_reserv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index e7f542a66fdb..a9602c3977df 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -1344,8 +1344,8 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, TAILQ_INSERT_AFTER(queue, rv, marker, partpopq); vm_reserv_domain_unlock(domain); vm_reserv_lock(rv); - if (!rv->inpartpopq || - TAILQ_NEXT(rv, partpopq) != marker) { + if (TAILQ_PREV(marker, vm_reserv_queue, partpopq) != + rv) { vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); rvn = TAILQ_NEXT(marker, partpopq); @@ -1363,8 +1363,9 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, vm_reserv_unlock(rv); return (true); } - vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); + rvn = TAILQ_NEXT(rv, partpopq); + vm_reserv_unlock(rv); } vm_reserv_domain_unlock(domain); vm_reserv_domain_scan_unlock(domain); From owner-dev-commits-src-all@freebsd.org Thu Mar 11 15:50:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72434579C62; Thu, 11 Mar 2021 15:50: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 4DxD1V2sQ9z3Dxl; Thu, 11 Mar 2021 15:50: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 551F8272E6; Thu, 11 Mar 2021 15:50: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 12BFocOX015083; Thu, 11 Mar 2021 15:50:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BFocYx015082; Thu, 11 Mar 2021 15:50:38 GMT (envelope-from git) Date: Thu, 11 Mar 2021 15:50:38 GMT Message-Id: <202103111550.12BFocYx015082@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e8ff5725e63d - stable/13 - qat.4: Fix some firmware module names 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e8ff5725e63d63e0473f3a394bc466a0a97222c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 15:50:38 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e8ff5725e63d63e0473f3a394bc466a0a97222c7 commit e8ff5725e63d63e0473f3a394bc466a0a97222c7 Author: Mark Johnston AuthorDate: 2021-03-03 14:07:53 +0000 Commit: Mark Johnston CommitDate: 2021-03-11 15:50:26 +0000 qat.4: Fix some firmware module names PR: 252984 (cherry picked from commit 3adf72a36b9b151eef57e3d83f71a3a9fbacb78d) --- share/man/man4/qat.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/qat.4 b/share/man/man4/qat.4 index 92ee85ac64eb..6aa8343aa309 100644 --- a/share/man/man4/qat.4 +++ b/share/man/man4/qat.4 @@ -47,9 +47,9 @@ module at boot time, place the following lines in qat_load="YES" qat_c2xxxfw_load="YES" qat_c3xxxfw_load="YES" -qat_c63xfw_load="YES" +qat_c62xfw_load="YES" qat_d15xxfw_load="YES" -qat_dh895xcc_load="YES" +qat_dh895xccfw_load="YES" .Ed .Sh DESCRIPTION The From owner-dev-commits-src-all@freebsd.org Thu Mar 11 15:50:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4065F579E24; Thu, 11 Mar 2021 15:50: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 4DxD1v0PQ7z3F6T; Thu, 11 Mar 2021 15:50: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 010A727823; Thu, 11 Mar 2021 15:50: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 12BFowrI016114; Thu, 11 Mar 2021 15:50:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BFowtT016112; Thu, 11 Mar 2021 15:50:58 GMT (envelope-from git) Date: Thu, 11 Mar 2021 15:50:58 GMT Message-Id: <202103111550.12BFowtT016112@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: dc0119c28194 - main - linsysfs: create /sys/bus/ and /sys/subsystem/ 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: dc0119c28194b537cfa2ad95ce2e62589da7ceb0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 15:50:59 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=dc0119c28194b537cfa2ad95ce2e62589da7ceb0 commit dc0119c28194b537cfa2ad95ce2e62589da7ceb0 Author: Edward Tomasz Napierala AuthorDate: 2021-03-08 20:55:44 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-11 15:50:51 +0000 linsysfs: create /sys/bus/ and /sys/subsystem/ This looks like a no-op, but it prevents udevadm(8) with failing loudly, which in turn unbreaks installation of libfprint-2-2, which in Focal is a dependency for make-4.2.1-1.2. One might wonder why installing a build utility involves messing with device handling... Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29133 --- sys/compat/linsysfs/linsysfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/compat/linsysfs/linsysfs.c b/sys/compat/linsysfs/linsysfs.c index 66cb36db9868..8d3be1507de9 100644 --- a/sys/compat/linsysfs/linsysfs.c +++ b/sys/compat/linsysfs/linsysfs.c @@ -633,6 +633,9 @@ linsysfs_init(PFS_INIT_ARGS) root = pi->pi_root; + /* /sys/bus/... */ + dir = pfs_create_dir(root, "bus", NULL, NULL, NULL, 0); + /* /sys/class/... */ class = pfs_create_dir(root, "class", NULL, NULL, NULL, 0); scsi = pfs_create_dir(class, "scsi_host", NULL, NULL, NULL, 0); @@ -679,6 +682,9 @@ linsysfs_init(PFS_INIT_ARGS) /* /sys/kernel/debug, mountpoint for lindebugfs. */ debug = pfs_create_dir(kernel, "debug", NULL, NULL, NULL, 0); + /* /sys/subsystem/... */ + dir = pfs_create_dir(root, "subsystem", NULL, NULL, NULL, 0); + return (0); } From owner-dev-commits-src-all@freebsd.org Thu Mar 11 15:51:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1158579E89; Thu, 11 Mar 2021 15:51: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 4DxD1z5w5bz3FG1; Thu, 11 Mar 2021 15:51: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 8EE9A27515; Thu, 11 Mar 2021 15:51: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 12BFp3qw016227; Thu, 11 Mar 2021 15:51:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BFp3tb016226; Thu, 11 Mar 2021 15:51:03 GMT (envelope-from git) Date: Thu, 11 Mar 2021 15:51:03 GMT Message-Id: <202103111551.12BFp3tb016226@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 623fe87b2176 - stable/12 - qat.4: Fix some firmware module names 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 623fe87b217685dea455a1740435d2a09aa11151 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 15:51:05 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=623fe87b217685dea455a1740435d2a09aa11151 commit 623fe87b217685dea455a1740435d2a09aa11151 Author: Mark Johnston AuthorDate: 2021-03-03 14:07:53 +0000 Commit: Mark Johnston CommitDate: 2021-03-11 15:50:51 +0000 qat.4: Fix some firmware module names PR: 252984 (cherry picked from commit 3adf72a36b9b151eef57e3d83f71a3a9fbacb78d) --- share/man/man4/qat.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/qat.4 b/share/man/man4/qat.4 index 9e9491f22aea..8954c8af327b 100644 --- a/share/man/man4/qat.4 +++ b/share/man/man4/qat.4 @@ -47,9 +47,9 @@ module at boot time, place the following lines in qat_load="YES" qat_c2xxxfw_load="YES" qat_c3xxxfw_load="YES" -qat_c63xfw_load="YES" +qat_c62xfw_load="YES" qat_d15xxfw_load="YES" -qat_dh895xcc_load="YES" +qat_dh895xccfw_load="YES" .Ed .Sh DESCRIPTION The From owner-dev-commits-src-all@freebsd.org Thu Mar 11 15:54:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48A2157AACC; Thu, 11 Mar 2021 15:54: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 4DxD5h1V5Lz3GPj; Thu, 11 Mar 2021 15:54: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 25EF626F78; Thu, 11 Mar 2021 15:54: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 12BFsGjp019168; Thu, 11 Mar 2021 15:54:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BFsGs7019167; Thu, 11 Mar 2021 15:54:16 GMT (envelope-from git) Date: Thu, 11 Mar 2021 15:54:16 GMT Message-Id: <202103111554.12BFsGs7019167@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 47495bf648a3 - stable/13 - wg: Avoid leaking mbufs when the input handshake queue is full 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 47495bf648a3394383eec64cbff4f3527e76f690 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 15:54:16 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=47495bf648a3394383eec64cbff4f3527e76f690 commit 47495bf648a3394383eec64cbff4f3527e76f690 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:05 +0000 Commit: Mark Johnston CommitDate: 2021-03-11 15:53:12 +0000 wg: Avoid leaking mbufs when the input handshake queue is full Reviewed by: grehan Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29011 (cherry picked from commit a11009dccb6a2e75de2b8f1b45a0896eda2e6d85) --- sys/dev/if_wg/module/if_wg_session.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index 084bc789039d..4164a531cc69 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -1907,6 +1907,7 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, if ((m = m_defrag(m0, M_NOWAIT)) == NULL) { DPRINTF(sc, "DEFRAG fail\n"); + m_freem(m0); return; } data = mtod(m, void *); @@ -1937,8 +1938,10 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, verify_endpoint(m); if (mbufq_enqueue(&sc->sc_handshake_queue, m) == 0) { GROUPTASK_ENQUEUE(&sc->sc_handshake); - } else + } else { DPRINTF(sc, "Dropping handshake packet\n"); + wg_m_freem(m); + } } else if (pktlen >= sizeof(struct wg_pkt_data) + NOISE_MAC_SIZE && pkttype == MESSAGE_DATA) { From owner-dev-commits-src-all@freebsd.org Thu Mar 11 16:43:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B8AB57B68B; Thu, 11 Mar 2021 16:43: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 4DxFBg34ngz3Jb7; Thu, 11 Mar 2021 16:43: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 5C2D827F57; Thu, 11 Mar 2021 16:43: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 12BGhd9n084903; Thu, 11 Mar 2021 16:43:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BGhdOI084902; Thu, 11 Mar 2021 16:43:39 GMT (envelope-from git) Date: Thu, 11 Mar 2021 16:43:39 GMT Message-Id: <202103111643.12BGhdOI084902@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 11d845713834 - releng/13.0 - wg: Avoid leaking mbufs when the input handshake queue is full 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 11d8457138346e9f474b789ed83ff061ea8caf75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 16:43:39 -0000 The branch releng/13.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=11d8457138346e9f474b789ed83ff061ea8caf75 commit 11d8457138346e9f474b789ed83ff061ea8caf75 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:05 +0000 Commit: Mark Johnston CommitDate: 2021-03-11 15:58:35 +0000 wg: Avoid leaking mbufs when the input handshake queue is full Approved by: re Reviewed by: grehan Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29011 (cherry picked from commit a11009dccb6a2e75de2b8f1b45a0896eda2e6d85) (cherry picked from commit 47495bf648a3394383eec64cbff4f3527e76f690) --- sys/dev/if_wg/module/if_wg_session.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index 084bc789039d..4164a531cc69 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -1907,6 +1907,7 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, if ((m = m_defrag(m0, M_NOWAIT)) == NULL) { DPRINTF(sc, "DEFRAG fail\n"); + m_freem(m0); return; } data = mtod(m, void *); @@ -1937,8 +1938,10 @@ wg_input(struct mbuf *m0, int offset, struct inpcb *inpcb, verify_endpoint(m); if (mbufq_enqueue(&sc->sc_handshake_queue, m) == 0) { GROUPTASK_ENQUEUE(&sc->sc_handshake); - } else + } else { DPRINTF(sc, "Dropping handshake packet\n"); + wg_m_freem(m); + } } else if (pktlen >= sizeof(struct wg_pkt_data) + NOISE_MAC_SIZE && pkttype == MESSAGE_DATA) { From owner-dev-commits-src-all@freebsd.org Thu Mar 11 16:45:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4631B57B7A1; Thu, 11 Mar 2021 16:45: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 4DxFDS1Y6dz3JnB; Thu, 11 Mar 2021 16:45: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 27EA5FD; Thu, 11 Mar 2021 16:45: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 12BGjCKW085211; Thu, 11 Mar 2021 16:45:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BGjCx0085210; Thu, 11 Mar 2021 16:45:12 GMT (envelope-from git) Date: Thu, 11 Mar 2021 16:45:12 GMT Message-Id: <202103111645.12BGjCx0085210@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e52368365db3 - main - config_intrhook: provide config_intrhook_drain MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e52368365db3c0a696b37bfc09d08b7093b41b57 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 16:45:12 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e52368365db3c0a696b37bfc09d08b7093b41b57 commit e52368365db3c0a696b37bfc09d08b7093b41b57 Author: Warner Losh AuthorDate: 2021-03-11 15:42:09 +0000 Commit: Warner Losh CommitDate: 2021-03-11 16:45:10 +0000 config_intrhook: provide config_intrhook_drain config_intrhook_drain will remove the hook from the list as config_intrhook_disestablish does if the hook hasn't been called. If it has, config_intrhook_drain will wait for the hook to be disestablished in the normal course (or expedited, it's up to the driver to decide how and when to call config_intrhook_disestablish). This is intended for removable devices that use config_intrhook and might be attached early in boot, but that may be removed before the kernel can call the config_intrhook or before it ends. To prevent all races, the detach routine will need to call config_intrhook_train. Sponsored by: Netflix, Inc Reviewed by: jhb, mav, gde (in D29006 for man page) Differential Revision: https://reviews.freebsd.org/D29005 --- share/man/man9/Makefile | 1 + share/man/man9/config_intrhook.9 | 21 ++++++++++++++++- sys/kern/subr_autoconf.c | 50 +++++++++++++++++++++++++++++++++++++--- sys/sys/kernel.h | 6 ++++- 4 files changed, 73 insertions(+), 5 deletions(-) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index fb010231d710..52a5d373a417 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -859,6 +859,7 @@ MLINKS+=condvar.9 cv_broadcast.9 \ condvar.9 cv_wait_unlock.9 \ condvar.9 cv_wmesg.9 MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \ + config_intrhook.9 config_intrhook_drain.9 \ config_intrhook.9 config_intrhook_establish.9 \ config_intrhook.9 config_intrhook_oneshot.9 MLINKS+=contigmalloc.9 contigmalloc_domainset.9 \ diff --git a/share/man/man9/config_intrhook.9 b/share/man/man9/config_intrhook.9 index 0414ad88218a..6892a089b00f 100644 --- a/share/man/man9/config_intrhook.9 +++ b/share/man/man9/config_intrhook.9 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 10, 2017 +.Dd March 8, 2021 .Dt CONFIG_INTRHOOK 9 .Os .Sh NAME @@ -40,6 +40,8 @@ but before root is mounted .Fn config_intrhook_establish "struct intr_config_hook *hook" .Ft void .Fn config_intrhook_disestablish "struct intr_config_hook *hook" +.Ft int +.Fn config_intrhook_drain "struct intr_config_hook *hook" .Ft void .Fn config_intrhook_oneshot "ich_func_t func" "void *arg" .Sh DESCRIPTION @@ -55,6 +57,23 @@ The function removes the entry from the hook queue. .Pp The +.Fn config_intrhook_drain +function removes the entry from the hook queue in a safe way. +If the hook is not currently active it removes +.Fa hook +from the hook queue and returns +.Vt ICHS_QUEUED . +If the hook is active, it waits for the hook to complete before returning +.Vt ICHS_RUNNING . +If the hook has previously completed, it returns +.Vt ICHS_DONE . +Because a +.Vt config_intrhook +is undefined prior to +.Fn config_intrhook_establish , +this function may only be called after that function has returned. +.Pp +The .Fn config_intrhook_oneshot function schedules a function to be run as described for .Fn config_intrhook_establish ; diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index 063396a8e139..f6039e34e29f 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -138,6 +138,7 @@ run_interrupt_driven_config_hooks() while (next_to_notify != NULL) { hook_entry = next_to_notify; next_to_notify = STAILQ_NEXT(hook_entry, ich_links); + hook_entry->ich_state = ICHS_RUNNING; mtx_unlock(&intr_config_hook_lock); (*hook_entry->ich_func)(hook_entry->ich_arg); mtx_lock(&intr_config_hook_lock); @@ -199,6 +200,7 @@ config_intrhook_establish(struct intr_config_hook *hook) STAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links); if (next_to_notify == NULL) next_to_notify = hook; + hook->ich_state = ICHS_QUEUED; mtx_unlock(&intr_config_hook_lock); if (cold == 0) /* @@ -226,12 +228,11 @@ config_intrhook_oneshot(ich_func_t func, void *arg) config_intrhook_establish(&ohook->och_hook); } -void -config_intrhook_disestablish(struct intr_config_hook *hook) +static void +config_intrhook_disestablish_locked(struct intr_config_hook *hook) { struct intr_config_hook *hook_entry; - mtx_lock(&intr_config_hook_lock); STAILQ_FOREACH(hook_entry, &intr_config_hook_list, ich_links) if (hook_entry == hook) break; @@ -245,8 +246,51 @@ config_intrhook_disestablish(struct intr_config_hook *hook) TSRELEASE("config hooks"); /* Wakeup anyone watching the list */ + hook->ich_state = ICHS_DONE; wakeup(&intr_config_hook_list); +} + +void +config_intrhook_disestablish(struct intr_config_hook *hook) +{ + mtx_lock(&intr_config_hook_lock); + config_intrhook_disestablish_locked(hook); + mtx_unlock(&intr_config_hook_lock); +} + +int +config_intrhook_drain(struct intr_config_hook *hook) +{ + mtx_lock(&intr_config_hook_lock); + + /* + * The config hook has completed, so just return. + */ + if (hook->ich_state == ICHS_DONE) { + mtx_unlock(&intr_config_hook_lock); + return (ICHS_DONE); + } + + /* + * The config hook hasn't started running, just call disestablish. + */ + if (hook->ich_state == ICHS_QUEUED) { + config_intrhook_disestablish_locked(hook); + mtx_unlock(&intr_config_hook_lock); + return (ICHS_QUEUED); + } + + /* + * The config hook is running, so wait for it to complete and return. + */ + while (hook->ich_state != ICHS_DONE) { + if (msleep(&intr_config_hook_list, &intr_config_hook_lock, + 0, "confhd", hz) == EWOULDBLOCK) { + // XXX do I whine? + } + } mtx_unlock(&intr_config_hook_lock); + return (ICHS_RUNNING); } #ifdef DDB diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index 89582ca5403d..e96eb52b52fd 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -467,13 +467,17 @@ typedef void (*ich_func_t)(void *_arg); struct intr_config_hook { STAILQ_ENTRY(intr_config_hook) ich_links; - uintptr_t ich_padding; + uintptr_t ich_state; +#define ICHS_QUEUED 0x1 +#define ICHS_RUNNING 0x2 +#define ICHS_DONE 0x3 ich_func_t ich_func; void *ich_arg; }; int config_intrhook_establish(struct intr_config_hook *hook); void config_intrhook_disestablish(struct intr_config_hook *hook); +int config_intrhook_drain(struct intr_config_hook *hook); void config_intrhook_oneshot(ich_func_t _func, void *_arg); #endif /* !_SYS_KERNEL_H_*/ From owner-dev-commits-src-all@freebsd.org Thu Mar 11 16:45:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7531B57B871; Thu, 11 Mar 2021 16:45: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 4DxFDT2q8Lz3Jqd; Thu, 11 Mar 2021 16:45: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 4A68BFE; Thu, 11 Mar 2021 16:45: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 12BGjDBU085232; Thu, 11 Mar 2021 16:45:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BGjDvh085231; Thu, 11 Mar 2021 16:45:13 GMT (envelope-from git) Date: Thu, 11 Mar 2021 16:45:13 GMT Message-Id: <202103111645.12BGjDvh085231@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 8423f5d4c127 - main - nvme: use config_intrhook_drain to avoid removable card races MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8423f5d4c127f18e7500bc455bc7b6b1691385ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 16:45:13 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8423f5d4c127f18e7500bc455bc7b6b1691385ef commit 8423f5d4c127f18e7500bc455bc7b6b1691385ef Author: Warner Losh AuthorDate: 2021-03-11 15:42:44 +0000 Commit: Warner Losh CommitDate: 2021-03-11 16:45:10 +0000 nvme: use config_intrhook_drain to avoid removable card races nvme drives are configured early in boot. However, a number of the configuration steps takes which take a while, so we defer those to a config intrhook that runs before the root filesystem is mounted. At the same time, the PCI hot plug wakes up and tests the status of the card. It may decide that the card has gone away and deletes the child. As part of that process nvme_detach is called. If this call happens after the config_intrhook starts to run, but before it is finished, there's a race where we can tear down the device's soft state while the config_intrhook is still using it. Use the new config_intrhook_drain to disestablish the hook. Either it will be removed w/o running, or the routine will wait for it to finish. This closes the race and allows safe hotplug at any time, even very early in boot. Sponsored by: Netflix, Inc Reviewed by: jhb, mav Differential Revision: https://reviews.freebsd.org/D29006 --- sys/dev/nvme/nvme.c | 5 +---- sys/dev/nvme/nvme_ctrlr.c | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c index 3c145c817f88..f36125ba247b 100644 --- a/sys/dev/nvme/nvme.c +++ b/sys/dev/nvme/nvme.c @@ -143,10 +143,7 @@ nvme_detach(device_t dev) { struct nvme_controller *ctrlr = DEVICE2SOFTC(dev); - if (ctrlr->config_hook.ich_arg != NULL) { - config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; - } + config_intrhook_drain(&ctrlr->config_hook); nvme_ctrlr_destruct(ctrlr, dev); return (0); diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 351c6839a6f6..9e45c0e2d19e 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1135,7 +1135,6 @@ nvme_ctrlr_start_config_hook(void *arg) fail: nvme_ctrlr_fail(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; return; } @@ -1154,7 +1153,6 @@ fail: nvme_sysctl_initialize_ctrlr(ctrlr); config_intrhook_disestablish(&ctrlr->config_hook); - ctrlr->config_hook.ich_arg = NULL; ctrlr->is_initialized = 1; nvme_notify_new_controller(ctrlr); From owner-dev-commits-src-all@freebsd.org Thu Mar 11 17:13:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CA4057C1A0; Thu, 11 Mar 2021 17:13:44 +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 4DxFsN2ftqz3Lmc; Thu, 11 Mar 2021 17:13:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id B5A7CE5A6; Thu, 11 Mar 2021 17:13:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . To: Hans Petter Selasky , Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> From: John Baldwin Message-ID: <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> Date: Thu, 11 Mar 2021 09:13:42 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 17:13:44 -0000 On 3/10/21 2:09 AM, Hans Petter Selasky wrote: > On 3/10/21 11:04 AM, Konstantin Belousov wrote: >> This probably hangs machine instead of panicing. In low memory condition, >> you do not handle interrupt, which probably mean that the source is not >> silenced, and after EOI the same interrupt will be generated again. > > Hi, > > This usually happens during boot. Another possibility is to panic() > there. I don't see so many options. Is there no way to pre-allocate this? That is, could we not have all ithreads invoke this during their initialization, and have the module handler for linuxkpi iterate over ithreads allocating one for each ithread during MOD_LOAD? I think there are few enough ithreads that allocating "extra" ones is probably ok. Alternatively, you could hook into the path when an interrupt is registered perhaps by passing some sort of INTR_LINUX flag or the like that causes kern_intr.c to allocate one for the associated ithread when the interrupt is registered. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Thu Mar 11 17:24:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E31C57C07E; Thu, 11 Mar 2021 17:24:03 +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 4DxG5H3Xj6z3MTK; Thu, 11 Mar 2021 17:24:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id DA889D86E; Thu, 11 Mar 2021 17:24:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: Mateusz Guzik , Kyle Evans Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103091117.129BHOZa042851@gitrepo.freebsd.org> From: John Baldwin Subject: Re: git: 1ae20f7c70ea - main - kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() Message-ID: <8e37c710-bd9d-6fe0-0263-4efeabfd9beb@FreeBSD.org> Date: Thu, 11 Mar 2021 09:23:58 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 17:24:03 -0000 On 3/10/21 3:57 AM, Mateusz Guzik wrote: > There is something very wrong going on here. > > Key thing to note is that malloc is ultimately a wrapper around > uma_zalloc. Whatever asserts you may want to add to malloc to catch > problems sooner, should also present in uma. > > uma has the following: > > if (flags & M_WAITOK) { > WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, > "uma_zalloc_debug: zone \"%s\"", zone->uz_name); > } This warns about holding locks, not about TD_NO_SLEEPING. Witness' role is to check lock orders and warn about invalid operations when holding certain locks. It does not currently verify anything about other inhibitions like TD_NO_SLEEPING. See, e.g. the list of assertions in userret() which includes a WITNESS_WARN in addition to several other checks (including TD_NO_SLEEPING). Arguably we should just move the TD_NO_SLEEPING check from malloc() to here along with the td_intr_nesting_level. Any case where you can't use malloc() with M_WAITOK you can't use uma with M_WAITOK either. > This code used to execute prior to this commit and fail to catch the > problems which got reported already. > > In other words: > - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK is incomplete in terms of > internals its internals > - the above should be in malloc, perhaps after being abstracted into a > an assert-helper > - fixing witness deficiency will probably find a slew of new problems > - this should remain as a warning (maybe rate-limited) for the foreseable future I don't know that we've had so many issues that we can't just fix them on HEAD right now vs having to make this a warning instead of keeping it as a panic. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Thu Mar 11 17:39:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 760AC57C559; Thu, 11 Mar 2021 17:39:08 +0000 (UTC) (envelope-from bdrewery@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 4DxGQh2fMFz3NVs; Thu, 11 Mar 2021 17:39:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1615484348; 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=hvpy29zrpEBk7JkeqnvMCTxdSrnsaJ21NlReM2R8SBE=; b=jCFap4bdmpWqUABJeFtlHPYTawzhUCbLkOZSgAAb2OWBaGdHHPGVJDMhp1jPgS+i9oCksZ HTBnMK1Qsvpx7pb+/MLaaFWWboe79xnsaKZQUc273iYcGWkQajjiGBoPwsjtSatUssTPWy N1zy82601a2AcHRACXS49zcOL71KtHH8k3VsaDvJGeVaVn8xSivlxoQvoBYa8cGSUYvfr7 vvC5jKCWFOoB1q+ktnkkgSM3VttHS3n6fPbSE7Pxg8TZCZpnCQhfWkNInMVUpYsTFPmUyF THRUSWwg1w0BihX8PeqYUFmJ5BZtawyJUX2mu7FmDLYbOTjSkmLNF5fHkSFkxw== Received: from mail.xzibition.com (unknown [127.0.1.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 did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 2EAA41EEF6; Thu, 11 Mar 2021 17:39:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 243C6188E7; Thu, 11 Mar 2021 17:39:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id XfOM5E2V7DgT; Thu, 11 Mar 2021 17:39:05 +0000 (UTC) To: John Baldwin , Mateusz Guzik , Kyle Evans DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com B81C3188DF Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103091117.129BHOZa042851@gitrepo.freebsd.org> <8e37c710-bd9d-6fe0-0263-4efeabfd9beb@FreeBSD.org> From: Bryan Drewery Organization: FreeBSD Subject: Re: git: 1ae20f7c70ea - main - kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() Message-ID: <9132135e-8653-4df8-984e-c00806e4e533@FreeBSD.org> Date: Thu, 11 Mar 2021 09:39:04 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <8e37c710-bd9d-6fe0-0263-4efeabfd9beb@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aVuFBlAJPYlT86BMcrZFhw1NvKwD0NTlj" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1615484348; 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=hvpy29zrpEBk7JkeqnvMCTxdSrnsaJ21NlReM2R8SBE=; b=acBlAkl5tZr3AQyx9bjqT+MhILV78eiL3qT5aMqXZeZ/qFUeTFNX5alY8BUTI1ERARGdT8 eO0idBS/wReCNvEFAU47Oex9jNeo7254ccENZiC/xvrGu/RyoVYhK36RjVkLYeEvUQO73U OdrAYRpPOJatvHkiJAsTdAZfqPGTc3DqqfFxZJJ5x9QCBGwb16OKdFiA38GF1lCpErSC6X k6lhG8QFEP3LlpCtf/53QvwS+z2W7G06b9ldYsYbPhwvZW1oXuhnGEqUHzNaPOx796JNoc StXEbcO/vmSc1p26GQxMSDIEpFxdqZzBtIWLVB58c4cOxqSpDiXwK6FSFDkUSA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1615484348; a=rsa-sha256; cv=none; b=VIjrP1b0LZf2yMpumtUjXDdzrpYsugEhOgFfY/AsmGG49HYo8cOkPsXHj2j9oKl8FWTi3F ce52XsEsfJTGLkGQFJ5EqV3AiO6zcsDWY4U10rqjtrn9RhKvTvufqQRAOEoStwQQ1tkgjO WHXltyVfLdBc7hHtrJ8oDviig2izOQRv2SeNR+63T7EqzaHNCTuXvM9dyyBGnAGt4itbEV sI3S2pcDBUs8mJn+yaOJs5z9p4uIlRt1cB0LWcuqCQPnC72eFTM2czFgVUeFanNjSJ9KuD QtjeibASmonvF8wTo4s3CFM3vw1EkRkRmVTxFhu+w7te5gZgb8NTEffBzHIXwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 17:39:08 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --aVuFBlAJPYlT86BMcrZFhw1NvKwD0NTlj Content-Type: multipart/mixed; boundary="o29koHnVcEqidntWU1GWZqJO9ROUgfbX6"; protected-headers="v1" From: Bryan Drewery To: John Baldwin , Mateusz Guzik , Kyle Evans Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Message-ID: <9132135e-8653-4df8-984e-c00806e4e533@FreeBSD.org> Subject: Re: git: 1ae20f7c70ea - main - kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() References: <202103091117.129BHOZa042851@gitrepo.freebsd.org> <8e37c710-bd9d-6fe0-0263-4efeabfd9beb@FreeBSD.org> In-Reply-To: <8e37c710-bd9d-6fe0-0263-4efeabfd9beb@FreeBSD.org> --o29koHnVcEqidntWU1GWZqJO9ROUgfbX6 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 3/11/2021 9:23 AM, John Baldwin wrote: > On 3/10/21 3:57 AM, Mateusz Guzik wrote: =2E.. > I don't know that we've had so many issues that we can't just fix them = on > HEAD right now vs having to make this a warning instead of keeping it a= s > a panic. >=20 Given this isn't a consistency assertion, a nice temporary mechanism would be to only warn during boot but panic for instances seen after that. Perhaps collecting and spamming the early warnings continually too so they get reported. Then less people are blocked from upgrading or having to deal with boot panics, and may be able to avoid triggering other cases. It's one thing to have INVARIANTS on HEAD and expect everyone to chip in on that, but another to have a prolonged unstable range of commits. just my 2 cents, Bryan --o29koHnVcEqidntWU1GWZqJO9ROUgfbX6-- --aVuFBlAJPYlT86BMcrZFhw1NvKwD0NTlj Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAmBKVbgFAwAAAAAACgkQNddxu25Gl8/r DQgAyXA6GZ/RjOKrEqcb0kSnMLzTdjws/55e+zpjgJTivXbcg4rHxDrsWBriqypHD3QlzaezitD/ uJuO8F5LZq7NizWQ6GaMfiq93L875OS75WtsZo701YDmxChhO4UAantRIS9/V0B1OHaDcKzHMCJy I73mhmYPYoeScTKBDH7Folj4Hvk4Y3o9AkefiAhDDfunIpnzE1tiY9KDgLxTB7edycIaom/FjBRV S10+JSAzB0SNihlPr3229EBh8rd9zK9QTlcKRGcMCM8Ksd8l7U/miAx1MZOGWHkZ/8vUjnSUtbeO PEADeI3nEKu5fmsiRCYlHk7xZJVutHlbx2vi0B1Axw== =Gs8d -----END PGP SIGNATURE----- --aVuFBlAJPYlT86BMcrZFhw1NvKwD0NTlj-- From owner-dev-commits-src-all@freebsd.org Thu Mar 11 17:43:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2733057CB12; Thu, 11 Mar 2021 17:43: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 4DxGW90dzSz3P5N; Thu, 11 Mar 2021 17:43: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 08D6FE99; Thu, 11 Mar 2021 17:43: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 12BHh0Tc065307; Thu, 11 Mar 2021 17:43:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BHh0cX065306; Thu, 11 Mar 2021 17:43:00 GMT (envelope-from git) Date: Thu, 11 Mar 2021 17:43:00 GMT Message-Id: <202103111743.12BHh0cX065306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: d174c32f66d6 - stable/13 - security(7): mention new W^X sysctls in the manual page 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d174c32f66d6668921f3ba8bc91bde150fb1d882 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 17:43:01 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d174c32f66d6668921f3ba8bc91bde150fb1d882 commit d174c32f66d6668921f3ba8bc91bde150fb1d882 Author: Evgeniy Khramtsov AuthorDate: 2021-03-02 18:52:22 +0000 Commit: Gordon Bergling CommitDate: 2021-03-11 17:42:43 +0000 security(7): mention new W^X sysctls in the manual page Reviewed by: emaste, gbe MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28986 (cherry picked from commit 907023b454f06a6af87f21f8a9d6de6c11b2d275) --- share/man/man7/security.7 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/man/man7/security.7 b/share/man/man7/security.7 index 9ff39c74759c..b4aeb5728313 100644 --- a/share/man/man7/security.7 +++ b/share/man/man7/security.7 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 8, 2020 +.Dd February 28, 2021 .Dt SECURITY 7 .Os .Sh NAME @@ -1080,6 +1080,12 @@ Enables non-executable stack for 32bit processes. Enabled by default if supported by hardware and corresponding binary. .It Dv kern.elf64.nxstack Enables non-executable stack for 64bit processes. +.It Dv kern.elf32.allow_wx +Enables mapping of simultaneously writable and executable pages for +32bit processes. +.It Dv kern.elf64.allow_wx +Enables mapping of simultaneously writable and executable pages for +64bit processes. .El .Sh SEE ALSO .Xr chflags 1 , From owner-dev-commits-src-all@freebsd.org Thu Mar 11 17:43:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A989F57CD14; Thu, 11 Mar 2021 17:43: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 4DxGX24TBqz3PHP; Thu, 11 Mar 2021 17:43: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 8C7E5FE3; Thu, 11 Mar 2021 17:43: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 12BHhkEG065519; Thu, 11 Mar 2021 17:43:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BHhkUQ065518; Thu, 11 Mar 2021 17:43:46 GMT (envelope-from git) Date: Thu, 11 Mar 2021 17:43:46 GMT Message-Id: <202103111743.12BHhkUQ065518@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: b97735743718 - stable/13 - wg(4): Fix an example in the manual page 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b97735743718e13ac8662930d7aa2cb2e495d563 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 17:43:46 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b97735743718e13ac8662930d7aa2cb2e495d563 commit b97735743718e13ac8662930d7aa2cb2e495d563 Author: Gordon Bergling AuthorDate: 2021-03-07 19:27:59 +0000 Commit: Gordon Bergling CommitDate: 2021-03-11 17:43:25 +0000 wg(4): Fix an example in the manual page The example in the manual page of wg(4) for connecting to a peer was missing the 'public-key' ifconfig(8) keyword and for the addressed peer the port must be specified. PR: 253866 Reported by: Sergey Akhmatov Reviewed by: debdrup Differential Revision: https://reviews.freebsd.org/D29115 (cherry picked from commit f7bfe310191c8292da51c8da166a521ff16e0e46) --- share/man/man4/wg.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 index 2a13b98f45e9..760584e3a386 100644 --- a/share/man/man4/wg.4 +++ b/share/man/man4/wg.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 2, 2021 +.Dd March 7, 2021 .Dt WG 4 .Os .Sh NAME @@ -184,7 +184,7 @@ $ ifconfig wg0 | awk '/public-key/ { print $2 }'` .Pp Connect to a specific endpoint using its public-key and set the allowed IP address .Bd -literal -offset indent -# ifconfig wg0 peer '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' endpoint 10.0.1.100 allowed-ips 192.168.2.100/32 +# ifconfig wg0 peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' endpoint 10.0.1.100:54321 allowed-ips 192.168.2.100/32 .Ed .Sh DIAGNOSTICS The From owner-dev-commits-src-all@freebsd.org Thu Mar 11 18:03:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54AE957D0CE; Thu, 11 Mar 2021 18:03: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 4DxGz91xT1z3QGs; Thu, 11 Mar 2021 18: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 357B3EE3; Thu, 11 Mar 2021 18: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 12BI3nGY091979; Thu, 11 Mar 2021 18: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 12BI3nWI091978; Thu, 11 Mar 2021 18:03:49 GMT (envelope-from git) Date: Thu, 11 Mar 2021 18:03:49 GMT Message-Id: <202103111803.12BI3nWI091978@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 1690984a8307 - releng/13.0 - security(7): mention new W^X sysctls in the manual page 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 1690984a8307673b9027192d4467e7b8199dc772 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 18:03:49 -0000 The branch releng/13.0 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=1690984a8307673b9027192d4467e7b8199dc772 commit 1690984a8307673b9027192d4467e7b8199dc772 Author: Evgeniy Khramtsov AuthorDate: 2021-03-02 18:52:22 +0000 Commit: Gordon Bergling CommitDate: 2021-03-11 18:00:55 +0000 security(7): mention new W^X sysctls in the manual page Reviewed by: emaste, gbe Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D28986 (cherry picked from commit 907023b454f06a6af87f21f8a9d6de6c11b2d275) --- share/man/man7/security.7 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/man/man7/security.7 b/share/man/man7/security.7 index 9ff39c74759c..b4aeb5728313 100644 --- a/share/man/man7/security.7 +++ b/share/man/man7/security.7 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 8, 2020 +.Dd February 28, 2021 .Dt SECURITY 7 .Os .Sh NAME @@ -1080,6 +1080,12 @@ Enables non-executable stack for 32bit processes. Enabled by default if supported by hardware and corresponding binary. .It Dv kern.elf64.nxstack Enables non-executable stack for 64bit processes. +.It Dv kern.elf32.allow_wx +Enables mapping of simultaneously writable and executable pages for +32bit processes. +.It Dv kern.elf64.allow_wx +Enables mapping of simultaneously writable and executable pages for +64bit processes. .El .Sh SEE ALSO .Xr chflags 1 , From owner-dev-commits-src-all@freebsd.org Thu Mar 11 18:03:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DA6957D484; Thu, 11 Mar 2021 18: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 4DxGzB2vTbz3QkV; Thu, 11 Mar 2021 18:03: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 5729911DC; Thu, 11 Mar 2021 18:03: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 12BI3oXu092000; Thu, 11 Mar 2021 18:03:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BI3oba091999; Thu, 11 Mar 2021 18:03:50 GMT (envelope-from git) Date: Thu, 11 Mar 2021 18:03:50 GMT Message-Id: <202103111803.12BI3oba091999@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 2b1bcf70b4d1 - releng/13.0 - wg(4): Fix an example in the manual page 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 2b1bcf70b4d1a8ef62415cbb89890f08ae57a447 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 18:03:50 -0000 The branch releng/13.0 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2b1bcf70b4d1a8ef62415cbb89890f08ae57a447 commit 2b1bcf70b4d1a8ef62415cbb89890f08ae57a447 Author: Gordon Bergling AuthorDate: 2021-03-07 19:27:59 +0000 Commit: Gordon Bergling CommitDate: 2021-03-11 18:02:51 +0000 wg(4): Fix an example in the manual page The example in the manual page of wg(4) for connecting to a peer was missing the 'public-key' ifconfig(8) keyword and for the addressed peer the port must be specified. PR: 253866 Reported by: Sergey Akhmatov Approved by: re (gjb) Reviewed by: debdrup Differential Revision: https://reviews.freebsd.org/D29115 (cherry picked from commit f7bfe310191c8292da51c8da166a521ff16e0e46) --- share/man/man4/wg.4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 index 2a13b98f45e9..760584e3a386 100644 --- a/share/man/man4/wg.4 +++ b/share/man/man4/wg.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 2, 2021 +.Dd March 7, 2021 .Dt WG 4 .Os .Sh NAME @@ -184,7 +184,7 @@ $ ifconfig wg0 | awk '/public-key/ { print $2 }'` .Pp Connect to a specific endpoint using its public-key and set the allowed IP address .Bd -literal -offset indent -# ifconfig wg0 peer '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' endpoint 10.0.1.100 allowed-ips 192.168.2.100/32 +# ifconfig wg0 peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' endpoint 10.0.1.100:54321 allowed-ips 192.168.2.100/32 .Ed .Sh DIAGNOSTICS The From owner-dev-commits-src-all@freebsd.org Thu Mar 11 18:18:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 148E657D7E7; Thu, 11 Mar 2021 18:18:07 +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 4DxHHf6dWdz3RLY; Thu, 11 Mar 2021 18:18:06 +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 32FD2260988; Thu, 11 Mar 2021 19:17:59 +0100 (CET) Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . To: John Baldwin , Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> From: Hans Petter Selasky Message-ID: Date: Thu, 11 Mar 2021 19:17:41 +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: <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4DxHHf6dWdz3RLY 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 18:18:07 -0000 On 3/11/21 6:13 PM, John Baldwin wrote: > On 3/10/21 2:09 AM, Hans Petter Selasky wrote: >> On 3/10/21 11:04 AM, Konstantin Belousov wrote: >>> This probably hangs machine instead of panicing.  In low memory >>> condition, >>> you do not handle interrupt, which probably mean that the source is not >>> silenced, and after EOI the same interrupt will be generated again. >> >> Hi, >> >> This usually happens during boot. Another possibility is to panic() >> there. I don't see so many options. > > Is there no way to pre-allocate this?  That is, could we not have all > ithreads invoke this during their initialization, and have the module > handler for linuxkpi iterate over ithreads allocating one for > each ithread during MOD_LOAD? > > I think there are few enough ithreads that allocating "extra" ones > is probably ok.  Alternatively, you could hook into the path when an > interrupt is registered perhaps by passing some sort of INTR_LINUX > flag or the like that causes kern_intr.c to allocate one for the > associated ithread when the interrupt is registered. > Yes, I have a review for that: https://reviews.freebsd.org/D29183 --HPS From owner-dev-commits-src-all@freebsd.org Thu Mar 11 18:35:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69D355A9AC4; Thu, 11 Mar 2021 18:35:32 +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 4DxHgm09Rxz3k9w; Thu, 11 Mar 2021 18:35:31 +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 12BIZNWL011269 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 11 Mar 2021 20:35:26 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12BIZNWL011269 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12BIZNce011267; Thu, 11 Mar 2021 20:35:23 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 11 Mar 2021 20:35:23 +0200 From: Konstantin Belousov To: Hans Petter Selasky Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . Message-ID: References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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: 4DxHgm09Rxz3k9w 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 18:35:32 -0000 On Thu, Mar 11, 2021 at 07:17:41PM +0100, Hans Petter Selasky wrote: > On 3/11/21 6:13 PM, John Baldwin wrote: > > On 3/10/21 2:09 AM, Hans Petter Selasky wrote: > > > On 3/10/21 11:04 AM, Konstantin Belousov wrote: > > > > This probably hangs machine instead of panicing.  In low memory > > > > condition, > > > > you do not handle interrupt, which probably mean that the source is not > > > > silenced, and after EOI the same interrupt will be generated again. > > > > > > Hi, > > > > > > This usually happens during boot. Another possibility is to panic() > > > there. I don't see so many options. > > > > Is there no way to pre-allocate this?  That is, could we not have all > > ithreads invoke this during their initialization, and have the module > > handler for linuxkpi iterate over ithreads allocating one for > > each ithread during MOD_LOAD? > > > > I think there are few enough ithreads that allocating "extra" ones > > is probably ok.  Alternatively, you could hook into the path when an > > interrupt is registered perhaps by passing some sort of INTR_LINUX > > flag or the like that causes kern_intr.c to allocate one for the > > associated ithread when the interrupt is registered. > > > > Yes, I have a review for that: > https://reviews.freebsd.org/D29183 And I dislike this. It is yet another case of introducing consumer-specific logic into core. Isn't netepoch example enough? I presented another patch to Hans, where task and mm allocations are switched to zones, and the zones have reserve applied. Then allocations from ithreads use the reserve. There is one detail there, reserve is finite, for x86 I set it to the total limit of interrupts. This somewhat breaks if interrupts are deallocated and reallocated, but I think it is good enough even with this wart. From owner-dev-commits-src-all@freebsd.org Thu Mar 11 18:42:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28CBF5A9BC0; Thu, 11 Mar 2021 18:42:12 +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 4DxHqS01w3z3kD4; Thu, 11 Mar 2021 18:42:11 +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)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 3646B260243; Thu, 11 Mar 2021 19:42:10 +0100 (CET) Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . To: Konstantin Belousov Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> From: Hans Petter Selasky Message-ID: <3dcd63b0-fe90-2855-f349-2117ca4b6b26@selasky.org> Date: Thu, 11 Mar 2021 19:41:53 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DxHqS01w3z3kD4 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 18:42:12 -0000 On 3/11/21 7:35 PM, Konstantin Belousov wrote: > And I dislike this. It is yet another case of introducing consumer-specific > logic into core. Isn't netepoch example enough? > > I presented another patch to Hans, where task and mm allocations are > switched to zones, and the zones have reserve applied. Then allocations > from ithreads use the reserve. > > There is one detail there, reserve is finite, for x86 I set it to the > total limit of interrupts. This somewhat breaks if interrupts are > deallocated and reallocated, but I think it is good enough even with > this wart. Hi, Your patch doesn't address the issue of initializing the pointers in question once. Still, for every call, we need to check if the pointer is valid. This is not neccessary. Also I don't see why we need to create a own UMA zone for these simple structures. Won't the per-CPU sysctl consume more memory than the actual task structures being allocated? --HPS From owner-dev-commits-src-all@freebsd.org Thu Mar 11 18:48:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D9815A9DDC; Thu, 11 Mar 2021 18:48: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 4DxHyt4337z3kYY; Thu, 11 Mar 2021 18:48: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 7DC191A38; Thu, 11 Mar 2021 18:48: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 12BImcof045451; Thu, 11 Mar 2021 18:48:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BImc8P045448; Thu, 11 Mar 2021 18:48:38 GMT (envelope-from git) Date: Thu, 11 Mar 2021 18:48:38 GMT Message-Id: <202103111848.12BImc8P045448@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: c22076b52839 - main - man: Remove obsolete info from hosts man page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c22076b5283970908e74b3abece53efc4670e87d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 18:48:38 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c22076b5283970908e74b3abece53efc4670e87d commit c22076b5283970908e74b3abece53efc4670e87d Author: Warner Losh AuthorDate: 2021-03-11 18:46:10 +0000 Commit: Warner Losh CommitDate: 2021-03-11 18:46:10 +0000 man: Remove obsolete info from hosts man page The NIC no longer provides a host database, and hasn't for quite some time. Remove that paragraph, it's not been relevant for many years. Also, hosts appeared in 4.1c, not 4.2, so correct that too. Noticed by: Henry Bent --- share/man/man5/hosts.5 | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/share/man/man5/hosts.5 b/share/man/man5/hosts.5 index 8b5dbaf3271c..d80c544b3644 100644 --- a/share/man/man5/hosts.5 +++ b/share/man/man5/hosts.5 @@ -64,20 +64,6 @@ These include addresses for the local interfaces that .Xr ifconfig 8 needs at boot time and a few machines on the local network. .Pp -This file may be created from the official host -data base maintained at the Network Information Control -Center -.Pq Tn NIC , -though local changes may be required -to bring it up to date regarding unofficial aliases -and/or unknown hosts. -As the data base maintained at -.Tn NIC -is incomplete, use of the name server is recommended for -sites on the -.Tn DARPA -Internet. -.Pp Network addresses are specified in the conventional ``.'' (dot) notation using the .Xr inet_addr 3 @@ -106,4 +92,4 @@ file resides in The .Nm file format appeared in -.Bx 4.2 . +.Bx 4.1c . From owner-dev-commits-src-all@freebsd.org Thu Mar 11 19:04:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73F845AA7B6; Thu, 11 Mar 2021 19:04:31 +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 4DxJKC0SFLz3mqD; Thu, 11 Mar 2021 19:04:30 +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 12BJ4NwJ017752 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 11 Mar 2021 21:04:26 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12BJ4NwJ017752 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12BJ4NYX017751; Thu, 11 Mar 2021 21:04:23 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 11 Mar 2021 21:04:23 +0200 From: Konstantin Belousov To: Hans Petter Selasky Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . Message-ID: References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> <3dcd63b0-fe90-2855-f349-2117ca4b6b26@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3dcd63b0-fe90-2855-f349-2117ca4b6b26@selasky.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: 4DxJKC0SFLz3mqD 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 19:04:31 -0000 On Thu, Mar 11, 2021 at 07:41:53PM +0100, Hans Petter Selasky wrote: > On 3/11/21 7:35 PM, Konstantin Belousov wrote: > > And I dislike this. It is yet another case of introducing consumer-specific > > logic into core. Isn't netepoch example enough? > > > > I presented another patch to Hans, where task and mm allocations are > > switched to zones, and the zones have reserve applied. Then allocations > > from ithreads use the reserve. > > > > There is one detail there, reserve is finite, for x86 I set it to the > > total limit of interrupts. This somewhat breaks if interrupts are > > deallocated and reallocated, but I think it is good enough even with > > this wart. > > Hi, > > Your patch doesn't address the issue of initializing the pointers in > question once. Still, for every call, we need to check if the pointer is > valid. This is not neccessary. I do not understand what you are saying there. Which pointers? How does it not address? > > Also I don't see why we need to create a own UMA zone for these simple > structures. Won't the per-CPU sysctl consume more memory than the actual > task structures being allocated? Dedicated UMA zone allows to gracefully solve the requirement of non-failing allocation in non-sleepable context. This is much simpler and cleaner than either trying to enumerate all existing ithreads or adding consumer-specific controls into generic kernel facility. From owner-dev-commits-src-all@freebsd.org Thu Mar 11 19:20:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2309A5AAD83; Thu, 11 Mar 2021 19:20:26 +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 4DxJgY6xqDz3nSn; Thu, 11 Mar 2021 19:20:25 +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 50C662601F5; Thu, 11 Mar 2021 20:20:24 +0100 (CET) Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . To: Konstantin Belousov Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> <3dcd63b0-fe90-2855-f349-2117ca4b6b26@selasky.org> From: Hans Petter Selasky Message-ID: <8fe37b5e-29a7-ffeb-fddb-3b31a6e79ab0@selasky.org> Date: Thu, 11 Mar 2021 20:20:05 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DxJgY6xqDz3nSn 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 19:20:26 -0000 On 3/11/21 8:04 PM, Konstantin Belousov wrote: > On Thu, Mar 11, 2021 at 07:41:53PM +0100, Hans Petter Selasky wrote: >> On 3/11/21 7:35 PM, Konstantin Belousov wrote: >>> And I dislike this. It is yet another case of introducing consumer-specific >>> logic into core. Isn't netepoch example enough? >>> >>> I presented another patch to Hans, where task and mm allocations are >>> switched to zones, and the zones have reserve applied. Then allocations >>> from ithreads use the reserve. >>> >>> There is one detail there, reserve is finite, for x86 I set it to the >>> total limit of interrupts. This somewhat breaks if interrupts are >>> deallocated and reallocated, but I think it is good enough even with >>> this wart. >> >> Hi, >> >> Your patch doesn't address the issue of initializing the pointers in >> question once. Still, for every call, we need to check if the pointer is >> valid. This is not neccessary. > I do not understand what you are saying there. > Which pointers? How does it not address? Hi, The current code calls linux_set_current() for every interrupt and timer callback. That means we continue to check td_lkpi_task for NULL for every one of these calls. Not strictly needed. > >> >> Also I don't see why we need to create a own UMA zone for these simple >> structures. Won't the per-CPU sysctl consume more memory than the actual >> task structures being allocated? > Dedicated UMA zone allows to gracefully solve the requirement of non-failing > allocation in non-sleepable context. This is much simpler and cleaner than > either trying to enumerate all existing ithreads or adding consumer-specific > controls into generic kernel facility. > Maybe I'm new to UMA zones. The M_USE_RESERVE can also be used with malloc() ? --HPS From owner-dev-commits-src-all@freebsd.org Thu Mar 11 19:24:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECE555AB059; Thu, 11 Mar 2021 19:24: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 4DxJmm6QnXz3p0H; Thu, 11 Mar 2021 19:24: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 CF69724A6; Thu, 11 Mar 2021 19:24: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 12BJOuU6097756; Thu, 11 Mar 2021 19:24:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BJOubr097755; Thu, 11 Mar 2021 19:24:56 GMT (envelope-from git) Date: Thu, 11 Mar 2021 19:24:56 GMT Message-Id: <202103111924.12BJOubr097755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 7a1f6858dabf - releng/13.0 - jail(8): reset to root cpuset before attaching to run commands 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 7a1f6858dabfdb24d9f58a52fd5e6e1fe0ceead1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 19:24:57 -0000 The branch releng/13.0 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=7a1f6858dabfdb24d9f58a52fd5e6e1fe0ceead1 commit 7a1f6858dabfdb24d9f58a52fd5e6e1fe0ceead1 Author: Kyle Evans AuthorDate: 2021-03-04 19:28:53 +0000 Commit: Kyle Evans CommitDate: 2021-03-11 19:24:28 +0000 jail(8): reset to root cpuset before attaching to run commands Recent changes have made it such that attaching to a jail will augment the attaching process' cpu mask with the jail's cpuset. While this is convenient for allowing the administrator to cpuset arbitrary programs that will attach to a jail, this is decidedly not convenient for executing long-running daemons during jail creation. This change inserts a reset of the process cpuset to the root cpuset between the fork and attach to execute a command. This allows commands executed to have the widest mask possible, and the administrator can cpuset(1) it back down inside the jail as needed. With this applied, one should be able to change a jail's cpuset at exec.poststart in addition to exec.created. The former was made difficult if jail(8) itself was running with a constrained set, as then some processes may have been spawned inside the jail with a non-root set. The latter is the preferred option so that processes starting in the jail are constrained appropriately up front. Note that all system commands are still run with the process' initial cpuset applied. PR: 253724 Approved by: re (gjb) (cherry picked from commit 466df976babed65f8a8de9e36d7f016a444609af) (cherry picked from commit bdd61b6914f1f961b5f414b2d5cc623a5a829b89) --- usr.sbin/jail/command.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/usr.sbin/jail/command.c b/usr.sbin/jail/command.c index a5c1839849fd..c1d418d6cc69 100644 --- a/usr.sbin/jail/command.c +++ b/usr.sbin/jail/command.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -84,6 +85,20 @@ static struct cfstring dummystring = { .len = 1 }; static struct phhead phash[PHASH_SIZE]; static int kq; +static cpusetid_t +root_cpuset_id(void) +{ + static cpusetid_t setid = CPUSET_INVALID; + static int error; + + /* Only try to get the cpuset once. */ + if (error == 0 && setid == CPUSET_INVALID) + error = cpuset_getid(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, &setid); + if (error != 0) + return (CPUSET_INVALID); + return (setid); +} + /* * Run the next command associated with a jail. */ @@ -283,6 +298,7 @@ run_command(struct cfjail *j) enum intparam comparam; size_t comlen; pid_t pid; + cpusetid_t setid; int argc, bg, clean, consfd, down, fib, i, injail, sjuser, timeout; #if defined(INET) || defined(INET6) char *addr, *extrap, *p, *val; @@ -632,6 +648,10 @@ run_command(struct cfjail *j) injail = comparam == IP_EXEC_START || comparam == IP_COMMAND || comparam == IP_EXEC_STOP; + if (injail) + setid = root_cpuset_id(); + else + setid = CPUSET_INVALID; clean = bool_param(j->intparams[IP_EXEC_CLEAN]); username = string_param(j->intparams[injail ? IP_EXEC_JAIL_USER : IP_EXEC_SYSTEM_USER]); @@ -700,6 +720,19 @@ run_command(struct cfjail *j) jail_warnx(j, "setfib: %s", strerror(errno)); exit(1); } + + /* + * We wouldn't have specialized our affinity, so just setid to + * root. We do this prior to attaching to avoid the kernel + * having to create a transient cpuset that we'll promptly + * free up with a reset to the jail's cpuset. + * + * This is just a best-effort to use as wide of mask as + * possible. + */ + if (setid != CPUSET_INVALID) + (void)cpuset_setid(CPU_WHICH_PID, -1, setid); + if (jail_attach(j->jid) < 0) { jail_warnx(j, "jail_attach: %s", strerror(errno)); exit(1); From owner-dev-commits-src-all@freebsd.org Thu Mar 11 19:40:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0F535AB47E; Thu, 11 Mar 2021 19:40: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 4DxK6X5WrFz3pj3; Thu, 11 Mar 2021 19: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 B04672811; Thu, 11 Mar 2021 19: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 12BJeKWZ018999; Thu, 11 Mar 2021 19: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 12BJeKu5018992; Thu, 11 Mar 2021 19:40:20 GMT (envelope-from git) Date: Thu, 11 Mar 2021 19:40:20 GMT Message-Id: <202103111940.12BJeKu5018992@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Nathan Whitehorn Subject: git: 3dbc2213dacb - releng/13.0 - Mount the EFI system partition (ESP) on newly-installed systems and VM images. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nwhitehorn X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 3dbc2213dacbb9a02898f4a16e363464b0f0738e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 19:40:20 -0000 The branch releng/13.0 has been updated by nwhitehorn: URL: https://cgit.FreeBSD.org/src/commit/?id=3dbc2213dacbb9a02898f4a16e363464b0f0738e commit 3dbc2213dacbb9a02898f4a16e363464b0f0738e Author: Nathan Whitehorn AuthorDate: 2021-02-23 21:16:52 +0000 Commit: Nathan Whitehorn CommitDate: 2021-03-11 19:39:57 +0000 Mount the EFI system partition (ESP) on newly-installed systems and VM images. Per hier(7), the ESP will be mounted at /boot/efi. On UFS systems, any existing ESP will be reused and mounted there; otherwise, a new one will be made. On ZFS systems, space for an ESP is allocated on all disks in the root pool, but only the partition actually used to boot is set up and mounted. This makes future upgrades of the EFI loader easier (upgrade scripts can just change /boot/efi) and also greatly simplifies the parts of the installer involved in initialization of the ESP. It also makes the installer's behavior correspond to the documentation in hier(7). Reviewed by: imp, tsoome, bdragon Approved by: re (gjb) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D28897 (cherry picked from commit 0b7472b3d8d2f1e90fade5236b44fd98d8e396c2) (cherry picked from commit 2c26d77d989abe48c662eeb6f52f7e4c9b81680c) (cherry picked from commit e77cf2a4ab32a381df3c06d25b8b4f650047c3f2) (cherry picked from commit e70eb40271512dfbca7cecf823e4b445e3989c2e) (cherry picked from commit 611d83116a6ca9132dbe72b39538f4651daeeb7e) --- release/tools/arm.subr | 1 + release/tools/vmimage.subr | 11 +- usr.sbin/bsdinstall/partedit/gpart_ops.c | 12 +-- usr.sbin/bsdinstall/partedit/partedit_efi.c | 1 + usr.sbin/bsdinstall/partedit/partedit_x86.c | 4 +- usr.sbin/bsdinstall/scripts/bootconfig | 150 +++++----------------------- usr.sbin/bsdinstall/scripts/zfsboot | 19 +++- 7 files changed, 59 insertions(+), 139 deletions(-) diff --git a/release/tools/arm.subr b/release/tools/arm.subr index 343d9f3a7034..2f91490c0859 100644 --- a/release/tools/arm.subr +++ b/release/tools/arm.subr @@ -184,6 +184,7 @@ arm_install_base() { TARGET_ARCH=${EMBEDDED_TARGET_ARCH} \ DESTDIR=${DESTDIR} KERNCONF=${KERNEL} \ ${CONF_FILES} installworld installkernel distribution + chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/efi chroot ${CHROOTDIR} mkdir -p ${DESTDIR}/boot/msdos arm_create_user diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr index 7bad725c9870..7bd971013656 100644 --- a/release/tools/vmimage.subr +++ b/release/tools/vmimage.subr @@ -52,7 +52,16 @@ write_partition_layout() { # Create an ESP espfilename=$(mktemp /tmp/efiboot.XXXXXX) make_esp_file ${espfilename} ${fat32min} ${BOOTFILES}/efi/loader_lua/loader_lua.efi - BOOTPARTS="${BOOTPARTS} -p efi:=${espfilename}" + BOOTPARTS="${BOOTPARTS} -p efi/efiesp:=${espfilename}" + + # Add this to fstab, requires temporarily remounting the fs + mddev=$(mdconfig -f ${VMBASE}) + mount /dev/${mddev} ${DESTDIR} + mkdir -p ${DESTDIR}/boot/efi + echo "/dev/${ROOTLABEL}/efiesp /boot/efi msdosfs rw 2 2" \ + >> ${DESTDIR}/etc/fstab + umount ${DESTDIR} + mdconfig -d -u ${mddev} fi mkimg -s ${SCHEME} -f ${VMFORMAT} \ diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c index e68a02b4264c..b49ff1c9fd42 100644 --- a/usr.sbin/bsdinstall/partedit/gpart_ops.c +++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c @@ -707,18 +707,8 @@ set_default_part_metadata(const char *name, const char *scheme, if (strcmp(type, "freebsd-swap") == 0) mountpoint = "none"; if (strcmp(type, bootpart_type(scheme, &default_bootmount)) == 0) { - if (default_bootmount == NULL) { - - int fd = openat(tmpdfd, "bsdinstall-esps", - O_CREAT | O_WRONLY | O_APPEND, 0600); - if (fd > 0) { - write(fd, md->name, strlen(md->name)); - write(fd, "\n", 1); - close(fd); - } - + if (default_bootmount == NULL) md->bootcode = 1; - } else if (mountpoint == NULL || strlen(mountpoint) == 0) mountpoint = default_bootmount; } diff --git a/usr.sbin/bsdinstall/partedit/partedit_efi.c b/usr.sbin/bsdinstall/partedit/partedit_efi.c index 85b3b15d1853..074475e07152 100644 --- a/usr.sbin/bsdinstall/partedit/partedit_efi.c +++ b/usr.sbin/bsdinstall/partedit/partedit_efi.c @@ -85,6 +85,7 @@ bootpart_type(const char *scheme, const char **mountpoint) { /* Only EFI is supported as boot partition */ + *mountpoint = "/boot/efi"; return ("efi"); } diff --git a/usr.sbin/bsdinstall/partedit/partedit_x86.c b/usr.sbin/bsdinstall/partedit/partedit_x86.c index e81adcad5f6b..6983188ba34f 100644 --- a/usr.sbin/bsdinstall/partedit/partedit_x86.c +++ b/usr.sbin/bsdinstall/partedit/partedit_x86.c @@ -113,8 +113,10 @@ const char * bootpart_type(const char *scheme, const char **mountpoint) { - if (strcmp(x86_bootmethod(), "UEFI") == 0) + if (strcmp(x86_bootmethod(), "UEFI") == 0) { + *mountpoint = "/boot/efi"; return ("efi"); + } return ("freebsd-boot"); } diff --git a/usr.sbin/bsdinstall/scripts/bootconfig b/usr.sbin/bsdinstall/scripts/bootconfig index f07fb3065c23..a592142d87a2 100755 --- a/usr.sbin/bsdinstall/scripts/bootconfig +++ b/usr.sbin/bsdinstall/scripts/bootconfig @@ -46,84 +46,8 @@ if [ `uname -m` == powerpc ]; then fi fi -# Update the ESP (EFI System Partition) with the new bootloader -if [ "$(uname -m)" = "amd64" ] || [ "$(uname -m)" = "i386" ]; then - X86_BOOTMETHOD=$(sysctl -n machdep.bootmethod) -fi - -if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "riscv" ] || [ "$X86_BOOTMETHOD" = "UEFI" ]; then - UFSBOOT_ESPS=$(cat $TMPDIR/bsdinstall-esps 2>/dev/null) - ZFSBOOT_DISKS=$(cat $TMPDIR/bsdinstall-zfsboot 2>/dev/null) - num_esps=0 - - if [ -n "$ZFSBOOT_DISKS" ]; then - # We're in a ZFS install environment - for disk in $ZFSBOOT_DISKS; do - index=$(gpart show "$disk" | cut -w -f 4,5 | grep "efi" | cut -w -f 1) - # Check that $index is an integer - [ -n "$index" ] && [ "$index" -eq "$index" ] && [ "$index" -ge 0 ] 2> /dev/null - if [ $? -ne 0 ]; then - continue - fi - - if [ -e "/dev/${disk}p${index}" ]; then - ESPS="$ESPS ${disk}p${index}" - elif [ -e "/dev/${disk}s${index}" ]; then - ESPS="$ESPS ${disk}s${index}" - else - continue - fi - - num_esps=$((num_esps + 1)) - done - fi - - if [ -n "$UFSBOOT_ESPS" ]; then - # We're in a UFS install environment - for partition in $UFSBOOT_ESPS; do - ESPS="$ESPS $partition" - num_esps=$((num_esps + 1)) - done - fi - - if [ -z "$ESPS" ]; then - # The installer hasn't given us any ESPs to use. - # Try and figure out which to use by looking for an - # unformatted efi partition - - for geom in $(gpart status -sg | awk '{print $1}'); do - hasfreebsd=$(gpart show "${geom}" | cut -w -f 4,5 | grep "freebsd") - if [ -n "$hasfreebsd" ]; then - index=$(gpart show "${geom}" | cut -w -f 4,5 | grep "efi" | cut -w -f 1) - # Check that $index is a valid integer - [ -n "$index" ] && [ "$index" -eq "$index" ] && [ "$index" -ge 0 ] 2> /dev/null - if [ $? -ne 0 ]; then - continue - fi - - mntpt=$(mktemp -d $TMPDIR/stand-test.XXXXXX) - if [ -e "/dev/${geom}p${index}" ]; then - dev=${geom}p${index} - elif [ -e "/dev/${geom}s${index}" ]; then - dev=/${geom}s${index} - else - continue - fi - - # Try and mount it. If it fails, assume it's - # unformatted and should be used. - mount -t msdosfs -o ro "/dev/${dev}" "${mntpt}" - if [ $? -ne 0 ]; then - ESPS="$ESPS ${dev}" - num_esps=$((num_esps + 1)) - else - umount "${mntpt}" - fi - rmdir "${mntpt}" - fi - done - fi - +# Update the ESP (EFI System Partition) with the new bootloader if we have an ESP +if [ -n "$(awk '{if ($2=="/boot/efi") printf("%s\n",$1);}' $PATH_FSTAB)" ]; then case $(uname -m) in arm64) ARCHBOOTNAME=aa64 ;; amd64) ARCHBOOTNAME=x64 ;; @@ -136,55 +60,33 @@ if [ "$(uname -m)" = "arm64" ] || [ "$(uname -m)" = "riscv" ] || [ "$X86_BOOTMET BOOTNAME="${BOOTDIR}/boot${ARCHBOOTNAME}.efi" FREEBSD_BOOTDIR="/efi/freebsd" FREEBSD_BOOTNAME="${FREEBSD_BOOTDIR}/loader.efi" + mntpt="$BSDINSTALL_CHROOT/boot/efi" + + f_dprintf "Installing loader.efi onto ESP" + mkdir -p "${mntpt}/${FREEBSD_BOOTDIR}" "${mntpt}/${BOOTDIR}" + cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${FREEBSD_BOOTNAME}" + + # + # The following shouldn't be necessary. UEFI defines a way to + # specifically select what to boot (which we do via + # efibootmgr). However, virtual environments often times lack + # support for the NV variables efibootmgr sets. In addition, + # some UEFI implementations have features that interfere with + # the setting of these variables. To combat that, we install the + # default removable media boot file as a fallback if it doesn't + # exist. We don't install it all the time since that can + # interfere with other installations on the drive (like rEFInd). + # + if [ ! -f "${mntpt}/${BOOTNAME}" ]; then + cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${BOOTNAME}" + fi - for esp in $ESPS; do - f_dprintf "Formatting /dev/${esp} as FAT32" - newfs_msdos -F 32 -c 1 -L EFISYS "/dev/$esp" > /dev/null 2>&1 - if [ $? -ne 0 ]; then - die "Failed to format ESP $esp as FAT32" - fi - - mntpt=$(mktemp -d $TMPDIR/stand-test.XXXXXX) - f_dprintf "Mounting ESP /dev/${esp}" - mount -t msdosfs "/dev/${esp}" "${mntpt}" - if [ $? -ne 0 ]; then - die "Failed to mount ESP ${dev} on ${mntpt}" - fi - - f_dprintf "Installing loader.efi onto ESP" - mkdir -p "${mntpt}/${FREEBSD_BOOTDIR}" "${mntpt}/${BOOTDIR}" - cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${FREEBSD_BOOTNAME}" - - # - # The following shouldn't be necessary. UEFI defines a way to - # specifically select what to boot (which we do via - # efibootmgr). However, virtual environments often times lack - # support for the NV variables efibootmgr sets. In addition, - # some UEFI implementations have features that interfere with - # the setting of these variables. To combat that, we install the - # default removable media boot file as a fallback if it doesn't - # exist. We don't install it all the time since that can - # interfere with other installations on the drive (like rEFInd). - # - if [ ! -f "${mntpt}/${BOOTNAME}" ]; then - cp "$BSDINSTALL_CHROOT/boot/loader.efi" "${mntpt}/${BOOTNAME}" - fi - - if [ "$num_esps" -gt 1 ]; then - bootlabel="FreeBSD (${esp})" - else - bootlabel="FreeBSD" - fi - - f_dprintf "Creating UEFI boot entry" - efibootmgr --create --activate --label "$bootlabel" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null + bootlabel="FreeBSD" - f_dprintf "Unmounting ESP" - umount "${mntpt}" - rmdir "${mntpt}" + f_dprintf "Creating UEFI boot entry" + efibootmgr --create --activate --label "$bootlabel" --loader "${mntpt}/${FREEBSD_BOOTNAME}" > /dev/null - f_dprintf "Finished configuring /dev/${esp} as ESP" - done + f_dprintf "Finished configuring ESP" fi # Add boot0cfg for MBR BIOS booting? diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index 33cec0ef9ae9..3b673addb10a 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -213,6 +213,7 @@ KLDLOAD='kldload %s' LN_SF='ln -sf "%s" "%s"' MKDIR_P='mkdir -p "%s"' MOUNT_TYPE='mount -t %s "%s" "%s"' +NEWFS_ESP='newfs_msdos "%s"' PRINTF_CONF="printf '%s=\"%%s\"\\\n' %s >> \"%s\"" PRINTF_FSTAB='printf "$FSTAB_FMT" "%s" "%s" "%s" "%s" "%s" "%s" >> "%s"' SHELL_TRUNCATE=':> "%s"' @@ -845,12 +846,25 @@ zfs_create_diskpart() if [ "$ZFSBOOT_BOOT_TYPE" = "UEFI" -o \ "$ZFSBOOT_BOOT_TYPE" = "BIOS+UEFI" ] then - f_eval_catch $funcname gpart \ + f_eval_catch -k justaddedpart $funcname gpart \ "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ - "$align_small" efiboot$index efi 200M \ + "$align_small" efiboot$index efi 260M \ $disk || return $FAILURE # We'll configure the ESP in bootconfig + if [ -z "$efibootpart" ]; then + efibootpart="/dev/$(echo $justaddedpart | cut -f 1 -d ' ')" + f_dprintf "$funcname: configuring ESP at [%s]" \ + "${efibootpart}" + + f_eval_catch $funcname newfs_msdos "$NEWFS_ESP"\ + "$efibootpart" \ + || return $FAILURE + f_eval_catch $funcname printf "$PRINTF_FSTAB" \ + $efibootpart /boot/efi msdosfs \ + rw 2 2 "$BSDINSTALL_TMPETC/fstab" \ + || return $FAILURE + fi fi if [ "$ZFSBOOT_BOOT_TYPE" = "BIOS" -o \ @@ -1066,6 +1080,7 @@ zfs_create_boot() local isswapmirror local bootpart targetpart swappart # Set by zfs_create_diskpart() below local create_options + local efibootpart # # Pedantic checks; should never be seen From owner-dev-commits-src-all@freebsd.org Thu Mar 11 20:08:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B08475AB951; Thu, 11 Mar 2021 20: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 4DxKkk4MPPz3r2X; Thu, 11 Mar 2021 20:08: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 845E62ADA; Thu, 11 Mar 2021 20: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 12BK8EH2051397; Thu, 11 Mar 2021 20: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 12BK8Eu2051396; Thu, 11 Mar 2021 20:08:14 GMT (envelope-from git) Date: Thu, 11 Mar 2021 20:08:14 GMT Message-Id: <202103112008.12BK8Eu2051396@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: d28cbb7944e5 - main - development(7): update to reflect Git transition 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: d28cbb7944e5b1015d94a04cadc97d473838611e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 20:08:14 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=d28cbb7944e5b1015d94a04cadc97d473838611e commit d28cbb7944e5b1015d94a04cadc97d473838611e Author: Edward Tomasz Napierala AuthorDate: 2021-03-11 20:03:30 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-11 20:07:53 +0000 development(7): update to reflect Git transition Reviewed By: debdrup, imp (earlier version) Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D28939 --- share/man/man7/development.7 | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/share/man/man7/development.7 b/share/man/man7/development.7 index 48b3b19384ab..3feb133e0534 100644 --- a/share/man/man7/development.7 +++ b/share/man/man7/development.7 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 19, 2020 +.Dd March 11, 2021 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -58,17 +58,25 @@ can be found at: .Lk https://www.FreeBSD.org/doc/en/articles/committers-guide/ .Pp .Fx -src development takes place in the CURRENT branch in Subversion, -located at: +src development takes place in the project-hosted +Git repository, located at: .Pp -.Lk https://svn.FreeBSD.org/base/head +.Lk https://git.FreeBSD.org/src.git .Pp -There is also a read-only GitHub mirror at: +The push URL is: .Pp -.Lk https://github.com/freebsd/freebsd +.Lk ssh://git@gitrepo.FreeBSD.org/src.git .Pp -Changes are first committed to CURRENT and then usually merged back -to STABLE. +There is also a public, read-only GitHub mirror at: +.Pp +.Lk https://github.com/freebsd/freebsd-src +.Pp +The +.Ql main +Git branch represents CURRENT; +all changes are first committed to CURRENT and then usually cherry-picked +back to STABLE, which refers to Git branches such as +.Ql stable/13 . Every few years the CURRENT branch is renamed to STABLE, and a new CURRENT is branched, with an incremented major version number. Releases are then branched off STABLE and numbered with consecutive minor @@ -114,7 +122,7 @@ the continuous integration system is at: Check out the CURRENT branch, build it, and install, overwriting the current system: .Bd -literal -offset indent -svnlite co https://svn.FreeBSD.org/base/head src +git clone https://git.FreeBSD.org/src.git src cd src make -sj8 buildworld buildkernel installkernel shutdown -r now @@ -166,7 +174,7 @@ make buildenv TARGET_ARCH=armv6 make -sj8 kernel KERNFAST=1 DESTDIR=/clients/arm .Ed .Sh SEE ALSO -.Xr svnlite 1 , +.Xr git 1 , .Xr witness 4 , .Xr build 7 , .Xr hier 7 , From owner-dev-commits-src-all@freebsd.org Thu Mar 11 20:46:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5899B5ACA03; Thu, 11 Mar 2021 20:46: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 4DxLZS26y5z3t1N; Thu, 11 Mar 2021 20:46: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 3BB2E3825; Thu, 11 Mar 2021 20:46: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 12BKk8Ff003179; Thu, 11 Mar 2021 20:46:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BKk8Aa003178; Thu, 11 Mar 2021 20:46:08 GMT (envelope-from git) Date: Thu, 11 Mar 2021 20:46:08 GMT Message-Id: <202103112046.12BKk8Aa003178@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: 2f1cfb7f63ca - main - gmirror: Pre-allocate the timeout event 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: 2f1cfb7f63ca744e7a143896347bdc8606c291d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 20:46:08 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2f1cfb7f63ca744e7a143896347bdc8606c291d6 commit 2f1cfb7f63ca744e7a143896347bdc8606c291d6 Author: Mark Johnston AuthorDate: 2021-03-11 20:43:04 +0000 Commit: Mark Johnston CommitDate: 2021-03-11 20:45:15 +0000 gmirror: Pre-allocate the timeout event structure We can't call malloc(M_WAITOK) in a callout handler. Reviewed by: imp Reported by: pho Tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29223 --- sys/geom/mirror/g_mirror.c | 43 ++++++++++++++++++++++++++++++++++--------- sys/geom/mirror/g_mirror.h | 1 + 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 350845205485..51836b7eabb8 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -115,6 +115,7 @@ static int g_mirror_update_disk(struct g_mirror_disk *disk, u_int state); static void g_mirror_update_device(struct g_mirror_softc *sc, bool force); static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); +static void g_mirror_timeout_drain(struct g_mirror_softc *sc); static int g_mirror_refresh_device(struct g_mirror_softc *sc, const struct g_provider *pp, const struct g_mirror_metadata *md); static void g_mirror_sync_reinit(const struct g_mirror_disk *disk, @@ -183,15 +184,14 @@ g_mirror_event_free(struct g_mirror_event *ep) free(ep, M_MIRROR); } -int -g_mirror_event_send(void *arg, int state, int flags) +static int +g_mirror_event_dispatch(struct g_mirror_event *ep, void *arg, int state, + int flags) { struct g_mirror_softc *sc; struct g_mirror_disk *disk; - struct g_mirror_event *ep; int error; - ep = malloc(sizeof(*ep), M_MIRROR, M_WAITOK); G_MIRROR_DEBUG(4, "%s: Sending event %p.", __func__, ep); if ((flags & G_MIRROR_EVENT_DEVICE) != 0) { disk = NULL; @@ -226,6 +226,15 @@ g_mirror_event_send(void *arg, int state, int flags) return (error); } +int +g_mirror_event_send(void *arg, int state, int flags) +{ + struct g_mirror_event *ep; + + ep = malloc(sizeof(*ep), M_MIRROR, M_WAITOK); + return (g_mirror_event_dispatch(ep, arg, state, flags)); +} + static struct g_mirror_event * g_mirror_event_first(struct g_mirror_softc *sc) { @@ -582,7 +591,7 @@ g_mirror_destroy_device(struct g_mirror_softc *sc) mtx_unlock(&sc->sc_events_mtx); } } - callout_drain(&sc->sc_callout); + g_mirror_timeout_drain(sc); g_topology_lock(); LIST_FOREACH_SAFE(cp, &sc->sc_sync.ds_geom->consumer, consumer, tmpcp) { @@ -2291,13 +2300,26 @@ static void g_mirror_go(void *arg) { struct g_mirror_softc *sc; + struct g_mirror_event *ep; sc = arg; G_MIRROR_DEBUG(0, "Force device %s start due to timeout.", sc->sc_name); - g_mirror_event_send(sc, 0, + ep = sc->sc_timeout_event; + sc->sc_timeout_event = NULL; + g_mirror_event_dispatch(ep, sc, 0, G_MIRROR_EVENT_DONTWAIT | G_MIRROR_EVENT_DEVICE); } +static void +g_mirror_timeout_drain(struct g_mirror_softc *sc) +{ + sx_assert(&sc->sc_lock, SX_XLOCKED); + + callout_drain(&sc->sc_callout); + g_mirror_event_free(sc->sc_timeout_event); + sc->sc_timeout_event = NULL; +} + static u_int g_mirror_determine_state(struct g_mirror_disk *disk) { @@ -2454,7 +2476,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool force) * Disks went down in starting phase, so destroy * device. */ - callout_drain(&sc->sc_callout); + g_mirror_timeout_drain(sc); sc->sc_flags |= G_MIRROR_DEVICE_FLAG_DESTROY; G_MIRROR_DEBUG(1, "root_mount_rel[%u] %p", __LINE__, sc->sc_rootmount); @@ -2491,7 +2513,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool force) } } else { /* Cancel timeout. */ - callout_drain(&sc->sc_callout); + g_mirror_timeout_drain(sc); } /* @@ -3153,10 +3175,13 @@ g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md, sc->sc_rootmount = root_mount_hold("GMIRROR"); G_MIRROR_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount); + /* - * Run timeout. + * Schedule startup timeout. */ timeout = g_mirror_timeout * hz; + sc->sc_timeout_event = malloc(sizeof(struct g_mirror_event), M_MIRROR, + M_WAITOK); callout_reset(&sc->sc_callout, timeout, g_mirror_go, sc); return (sc->sc_geom); } diff --git a/sys/geom/mirror/g_mirror.h b/sys/geom/mirror/g_mirror.h index 57f341f752e1..7cec94adae18 100644 --- a/sys/geom/mirror/g_mirror.h +++ b/sys/geom/mirror/g_mirror.h @@ -207,6 +207,7 @@ struct g_mirror_softc { TAILQ_HEAD(, g_mirror_event) sc_events; struct mtx sc_events_mtx; + struct g_mirror_event *sc_timeout_event; struct callout sc_callout; From owner-dev-commits-src-all@freebsd.org Thu Mar 11 21:07:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 745FF5ACDC4; Thu, 11 Mar 2021 21:07:14 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) (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 4DxM2p2Fx1z3v29; Thu, 11 Mar 2021 21:07:14 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lj1-x235.google.com with SMTP id f16so3985790ljm.1; Thu, 11 Mar 2021 13:07:13 -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=jxxviOhMpR+zatahLOz7lsjVuNN2lCjSSN92wag8JA4=; b=huid5XpDTyfib/GC3t37OSavxZiajLWvgn2CozvGNIq3FCNXL0CrmcextsjEbDs4hg w0dCX3+gmigQn1hUUy/qTMOpsZKj0i/Z4MvcEgjt7MXgUtLR7RW5Hiu6H9dAWjA+1sRp iAOzWIriC35XlEl+IGzBcLba0iZYpah335ZjPUfX2ZJVU7p+MRv6dKCLHBqUVS/JK/e5 6bO44UvqPbiEsfv2e8tXVVvNpLH0VnRuL8nm1+n8DRZ4KhhfKtLPAva3dCPTe5BWLHDu Kk+rb66gC6LeHE2FYcP5FlJl+gfIDtK5ZNU4hmiOYRifUZfoNcRJfDsUQVofiyQT0UJh zdbg== 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=jxxviOhMpR+zatahLOz7lsjVuNN2lCjSSN92wag8JA4=; b=tfTLqn8rDiKJ0Dch48AP1PR+7V84E/n75FJdwLgms3qF/kCtx3ONqs2K7F3feHjI2H dPWxfPsA0ufbVP/O3YFNQYW3gaJMFL6T37Dm8tgmhQccZX8xRd7cAw/HUmjGKNgfYJkq gbIS0oyxQz0B0nN8Bv0nry5SKqM841EEqg5mE+9HzhhTsEO5GjGXdPo7EdIOUrGVPvik VkbBk5aet+vFhsfAyz1ICycf+izIPMAQRntdLaK0bFvGEKHCiXB3bw3bCbS4FBm/gHGT DCoYKWrWtUOY9FQ4J7KrDk9CmCC4j/BVbQis45gq6bksSJ6F8lkoTxGg77WXMoTd/oXR hpXQ== X-Gm-Message-State: AOAM532u/OOpH6/8glQM270qOvuc7PhPGeFYHzEipISXmjk9HAqbWTh/ ACWEctzaVuxPrn0c+m2gjLKhCn9Tz58BlPiDUc3YfnlP7Ug= X-Google-Smtp-Source: ABdhPJw3NtTCmKS9zZZmzpEWzNO/RDgoh/QDU/H4qTzkrhDLcemFbxljHrSbFS+9ak3f4hcW4H2A8KXbkIoIgBgB3U4= X-Received: by 2002:a2e:534a:: with SMTP id t10mr426250ljd.499.1615496832143; Thu, 11 Mar 2021 13:07:12 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a2e:b54e:0:0:0:0:0 with HTTP; Thu, 11 Mar 2021 13:07:11 -0800 (PST) In-Reply-To: <8e37c710-bd9d-6fe0-0263-4efeabfd9beb@FreeBSD.org> References: <202103091117.129BHOZa042851@gitrepo.freebsd.org> <8e37c710-bd9d-6fe0-0263-4efeabfd9beb@FreeBSD.org> From: Mateusz Guzik Date: Thu, 11 Mar 2021 22:07:11 +0100 Message-ID: Subject: Re: git: 1ae20f7c70ea - main - kern: malloc: fix panic on M_WAITOK during THREAD_NO_SLEEPING() To: John Baldwin Cc: Kyle Evans , 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: 4DxM2p2Fx1z3v29 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 21:07:14 -0000 On 3/11/21, John Baldwin wrote: > On 3/10/21 3:57 AM, Mateusz Guzik wrote: >> There is something very wrong going on here. >> >> Key thing to note is that malloc is ultimately a wrapper around >> uma_zalloc. Whatever asserts you may want to add to malloc to catch >> problems sooner, should also present in uma. >> >> uma has the following: >> >> if (flags & M_WAITOK) { >> WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, >> "uma_zalloc_debug: zone \"%s\"", zone->uz_name); >> } > > This warns about holding locks, not about TD_NO_SLEEPING. Witness' role > is to check lock orders and warn about invalid operations when holding > certain locks. It does not currently verify anything about other > inhibitions > like TD_NO_SLEEPING. See, e.g. the list of assertions in userret() which > includes a WITNESS_WARN in addition to several other checks (including > TD_NO_SLEEPING). Arguably we should just move the TD_NO_SLEEPING check > from malloc() to here along with the td_intr_nesting_level. Any case > where you can't use malloc() with M_WAITOK you can't use uma with M_WAITOK > either. > My point is that the witness check is clearly deficient even ignoring uma -- there are other places which do this and fail to properly check if going off cpu is allowed. In fact, looks like the TD_NO_SLEEPING stuff is already not properly checked for when taking sleepable locks. >> This code used to execute prior to this commit and fail to catch the >> problems which got reported already. >> >> In other words: >> - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK is incomplete in terms of >> internals its internals >> - the above should be in malloc, perhaps after being abstracted into a >> an assert-helper >> - fixing witness deficiency will probably find a slew of new problems >> - this should remain as a warning (maybe rate-limited) for the foreseable >> future > > I don't know that we've had so many issues that we can't just fix them on > HEAD right now vs having to make this a warning instead of keeping it as > a panic. > > -- > John Baldwin > -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Thu Mar 11 21:17:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 739125ACFBA; Thu, 11 Mar 2021 21:17: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 4DxMH62qv1z3v4l; Thu, 11 Mar 2021 21:17: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 4F7F23D1F; Thu, 11 Mar 2021 21:17: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 12BLHs1G043439; Thu, 11 Mar 2021 21:17:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BLHsj9043438; Thu, 11 Mar 2021 21:17:54 GMT (envelope-from git) Date: Thu, 11 Mar 2021 21:17:54 GMT Message-Id: <202103112117.12BLHsj9043438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: ba5de7e93014 - main - SPDX: Spell 4 clause BSD license correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ba5de7e9301438f69ee3532e19d7ec6d496cda05 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 21:17:54 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ba5de7e9301438f69ee3532e19d7ec6d496cda05 commit ba5de7e9301438f69ee3532e19d7ec6d496cda05 Author: Warner Losh AuthorDate: 2021-03-11 20:25:55 +0000 Commit: Warner Losh CommitDate: 2021-03-11 21:17:54 +0000 SPDX: Spell 4 clause BSD license correctly --- sys/powerpc/aim/moea64_native.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/powerpc/aim/moea64_native.c b/sys/powerpc/aim/moea64_native.c index a5837886a2a2..29ba51a48587 100644 --- a/sys/powerpc/aim/moea64_native.c +++ b/sys/powerpc/aim/moea64_native.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND 4-Clause-BSD + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD AND BSD-4-Clause * * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. From owner-dev-commits-src-all@freebsd.org Thu Mar 11 21:45:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FF265AD918; Thu, 11 Mar 2021 21:45: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 4DxMtj0wbBz4QnZ; Thu, 11 Mar 2021 21:45: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 12DE54582; Thu, 11 Mar 2021 21:45: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 12BLjGCX082237; Thu, 11 Mar 2021 21:45:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BLjG6l082236; Thu, 11 Mar 2021 21:45:16 GMT (envelope-from git) Date: Thu, 11 Mar 2021 21:45:16 GMT Message-Id: <202103112145.12BLjG6l082236@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d4803b958cff - releng/13.0 - Fix 'in6_purgeaddr: err=65, destination address delete failed' message. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: d4803b958cff52dd14856a2a214c21bea1b69af7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 21:45:17 -0000 The branch releng/13.0 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d4803b958cff52dd14856a2a214c21bea1b69af7 commit d4803b958cff52dd14856a2a214c21bea1b69af7 Author: Alexander V. Chernikov AuthorDate: 2021-03-08 20:27:29 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-11 21:38:01 +0000 Fix 'in6_purgeaddr: err=65, destination address delete failed' message. P2P ifa may require 2 routes: one is the loopback route, another is the "prefix" route towards its destination. Current code marks loopback routes existence with IFA_RTSELF and "prefix" p2p routes with IFA_ROUTE. For historic reasons, we fill in ifa_dstaddr for loopback interfaces. To avoid installing the same route twice, we preemptively set IFA_RTSELF when adding "prefix" route for loopback. However, the teardown part doesn't have this hack, so we try to remove the same route twice. Fix this by checking if ifa_dstaddr is different from the ifa_addr and moving this logic into a separate function. Reviewed By: kp Approved by: re(gjb) Differential Revision: https://reviews.freebsd.org/D29121 (cherry picked from commit 83cedad139721c6c150be8c078417cfcb311ee78) --- sys/netinet6/in6.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 48fa8dd2efc6..4f0724b7859f 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1294,13 +1294,27 @@ in6_handle_dstaddr_rtrequest(int cmd, struct in6_ifaddr *ia) return (error); } +static bool +ifa_is_p2p(struct in6_ifaddr *ia) +{ + int plen; + + plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ + + if ((plen == 128) && (ia->ia_dstaddr.sin6_family == AF_INET6) && + !IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, &ia->ia_dstaddr.sin6_addr)) + return (true); + + return (false); +} + void in6_purgeaddr(struct ifaddr *ifa) { struct ifnet *ifp = ifa->ifa_ifp; struct in6_ifaddr *ia = (struct in6_ifaddr *) ifa; struct in6_multi_mship *imm; - int plen, error; + int error; if (ifa->ifa_carp) (*carp_detach_p)(ifa, false); @@ -1328,10 +1342,7 @@ in6_purgeaddr(struct ifaddr *ifa) free(imm, M_IP6MADDR); } /* Check if we need to remove p2p route */ - plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ - if (ia->ia_dstaddr.sin6_family != AF_INET6) - plen = 0; - if ((ia->ia_flags & IFA_ROUTE) && plen == 128) { + if ((ia->ia_flags & IFA_ROUTE) && ifa_is_p2p(ia)) { error = in6_handle_dstaddr_rtrequest(RTM_DELETE, ia); if (error != 0) log(LOG_INFO, "%s: err=%d, destination address delete " @@ -1434,7 +1445,7 @@ static int in6_notify_ifa(struct ifnet *ifp, struct in6_ifaddr *ia, struct in6_aliasreq *ifra, int hostIsNew) { - int error = 0, plen, ifacount = 0; + int error = 0, ifacount = 0; struct ifaddr *ifa; struct sockaddr_in6 *pdst; char ip6buf[INET6_ADDRSTRLEN]; @@ -1487,14 +1498,7 @@ in6_notify_ifa(struct ifnet *ifp, struct in6_ifaddr *ia, * XXX: the logic below rejects assigning multiple addresses on a p2p * interface that share the same destination. */ - plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ - if (!(ia->ia_flags & IFA_ROUTE) && plen == 128 && - ia->ia_dstaddr.sin6_family == AF_INET6) { - /* - * Handle the case for ::1 . - */ - if (ifp->if_flags & IFF_LOOPBACK) - ia->ia_flags |= IFA_RTSELF; + if (!(ia->ia_flags & IFA_ROUTE) && ifa_is_p2p(ia)) { error = in6_handle_dstaddr_rtrequest(RTM_ADD, ia); if (error) goto done; From owner-dev-commits-src-all@freebsd.org Thu Mar 11 22:23:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC8405AE133; Thu, 11 Mar 2021 22:23: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 4DxNkK5vTrz4SlX; Thu, 11 Mar 2021 22:23: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 BD70A4B2C; Thu, 11 Mar 2021 22:23: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 12BMN5o3034818; Thu, 11 Mar 2021 22:23:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BMN5VX034817; Thu, 11 Mar 2021 22:23:05 GMT (envelope-from git) Date: Thu, 11 Mar 2021 22:23:05 GMT Message-Id: <202103112223.12BMN5VX034817@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 6a2ab3769abb - stable/13 - Remove the usr/tests/usr.bin/yacc/yacc directory when removing yacc. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6a2ab3769abb0ea6357a9c1b9630c4efc884aebc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 22:23:05 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6a2ab3769abb0ea6357a9c1b9630c4efc884aebc commit 6a2ab3769abb0ea6357a9c1b9630c4efc884aebc Author: John Baldwin AuthorDate: 2021-03-03 22:46:45 +0000 Commit: John Baldwin CommitDate: 2021-03-11 19:17:56 +0000 Remove the usr/tests/usr.bin/yacc/yacc directory when removing yacc. (cherry picked from commit e6cfd2939a4261c1f4bf802368cea8faf824c128) --- tools/build/mk/OptionalObsoleteFiles.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index b517cff65338..4045355fb27f 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -9177,6 +9177,7 @@ OLD_FILES+=usr/tests/usr.bin/yacc/yacc/varsyntax_calc1.output OLD_FILES+=usr/tests/usr.bin/yacc/yacc/varsyntax_calc1.tab.c OLD_FILES+=usr/tests/usr.bin/yacc/yacc/varsyntax_calc1.tab.h OLD_FILES+=usr/tests/usr.bin/yacc/yacc_tests +OLD_DIRS+=usr/tests/usr.bin/yacc/yacc OLD_DIRS+=usr/tests/usr.bin/yacc .endif From owner-dev-commits-src-all@freebsd.org Thu Mar 11 22:23:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 069795ADEBA; Thu, 11 Mar 2021 22:23: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 4DxNkL6sNdz4SsV; Thu, 11 Mar 2021 22:23: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 DE81D4C10; Thu, 11 Mar 2021 22:23: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 12BMN6kT034836; Thu, 11 Mar 2021 22:23:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BMN6oT034835; Thu, 11 Mar 2021 22:23:06 GMT (envelope-from git) Date: Thu, 11 Mar 2021 22:23:06 GMT Message-Id: <202103112223.12BMN6oT034835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 0fc5395122b4 - stable/13 - Correct the name of the structure used for TCP socket options. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0fc5395122b4b50564f3dc9164830a0d1635b622 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 22:23:07 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0fc5395122b4b50564f3dc9164830a0d1635b622 commit 0fc5395122b4b50564f3dc9164830a0d1635b622 Author: John Baldwin AuthorDate: 2021-03-08 18:46:40 +0000 Commit: John Baldwin CommitDate: 2021-03-11 19:17:56 +0000 Correct the name of the structure used for TCP socket options. The structure was renamed while refactoring Netflix's KTLS changes for upstreaming, but the original name remained in tcp.4 and was subsequently copied to ktls.4. PR: 254141 Reported by: asomers (cherry picked from commit c5a365623f88999b524d94003187ef09fda55f67) --- share/man/man4/ktls.4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man4/ktls.4 b/share/man/man4/ktls.4 index 21e1a1bdb6ca..648eeaedfa6a 100644 --- a/share/man/man4/ktls.4 +++ b/share/man/man4/ktls.4 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2021 +.Dd March 8, 2021 .Dt KTLS 4 .Os .Sh NAME @@ -54,7 +54,7 @@ and .Dv TCP_RXTLS_ENABLE socket options. Both socket options accept a -.Vt struct tls_so_enable +.Vt struct tls_enable structure as their argument. The members of this structure describe the cipher suite used for the TLS session and provide the session keys used for the respective @@ -166,7 +166,7 @@ will fail with one of the following errors: .It Bq Er EINVAL The version fields in a TLS record's header did not match the version required by the -.Vt struct tls_so_enable +.Vt struct tls_enable structure used to enable in-kernel TLS. .It Bq Er EMSGSIZE A TLS record's length was either too small or too large. From owner-dev-commits-src-all@freebsd.org Thu Mar 11 22:23:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80F3F5ADEBC; Thu, 11 Mar 2021 22:23: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 4DxNkN1Zh5z4Ssg; Thu, 11 Mar 2021 22:23: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 239964D11; Thu, 11 Mar 2021 22:23: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 12BMN7oO034859; Thu, 11 Mar 2021 22:23:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BMN7a9034858; Thu, 11 Mar 2021 22:23:07 GMT (envelope-from git) Date: Thu, 11 Mar 2021 22:23:07 GMT Message-Id: <202103112223.12BMN7a9034858@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: da55db32647b - stable/13 - Add ObsoleteFiles.inc entries for various OCF headers removed in 13. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: da55db32647bfe56ce12857ad6ef611af4cfb7be Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 22:23:09 -0000 The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=da55db32647bfe56ce12857ad6ef611af4cfb7be commit da55db32647bfe56ce12857ad6ef611af4cfb7be Author: John Baldwin AuthorDate: 2021-03-08 19:17:21 +0000 Commit: John Baldwin CommitDate: 2021-03-11 19:17:57 +0000 Add ObsoleteFiles.inc entries for various OCF headers removed in 13. (cherry picked from commit ef74bfc6fed298d5ca0e3cb92bf008b715ea0c2f) --- ObsoleteFiles.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 5f4495c50ee6..d72eebbe7de1 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -1212,11 +1212,19 @@ OLD_DIRS+=usr/lib/clang/10.0.0/lib/freebsd OLD_DIRS+=usr/lib/clang/10.0.0/lib OLD_DIRS+=usr/lib/clang/10.0.0 +# 20200520: xform_userland.h removed +OLD_FILES+=usr/include/crypto/xform_userland.h + # 20200515: libalias cuseeme protocol support retired OLD_LIBS+=lib/libalias_cuseeme.so OLD_FILES+=usr/lib/libalias_cuseeme.a OLD_FILES+=usr/lib/libalias_cuseeme_p.a +# 20200511: Remove deprecated crypto algorithms +OLD_FILES+=usr/include/crypto/cast.h +OLD_FILES+=usr/include/crypto/castsb.h +OLD_FILES+=usr/include/crypto/skipjack.h + # 20200511: Remove ubsec(4) OLD_FILES+=usr/share/man/man4/ubsec.4.gz @@ -1252,6 +1260,7 @@ OLD_FILES+=usr/share/man/man1/gdbserver.1.gz OLD_FILES+=usr/share/man/man1/kgdb.1.gz # 20200327: OCF refactoring +OLD_FILES+=usr/include/crypto/cryptosoft.h OLD_FILES+=usr/share/man/man9/crypto_find_driver.9.gz OLD_FILES+=usr/share/man/man9/crypto_register.9.gz OLD_FILES+=usr/share/man/man9/crypto_unregister.9.gz From owner-dev-commits-src-all@freebsd.org Thu Mar 11 23:38:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EDAE5AF84A; Thu, 11 Mar 2021 23:38: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 4DxQPG1cKwz4Xjc; Thu, 11 Mar 2021 23:38: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 25A935AA5; Thu, 11 Mar 2021 23:38: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 12BNcQaw027720; Thu, 11 Mar 2021 23:38:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BNcPZT027719; Thu, 11 Mar 2021 23:38:25 GMT (envelope-from git) Date: Thu, 11 Mar 2021 23:38:25 GMT Message-Id: <202103112338.12BNcPZT027719@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 003e38a01cf9 - releng/13.0 - Remove the usr/tests/usr.bin/yacc/yacc directory when removing yacc. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 003e38a01cf9070fb1b64589bcbc8cae01d5e2a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 23:38:26 -0000 The branch releng/13.0 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=003e38a01cf9070fb1b64589bcbc8cae01d5e2a2 commit 003e38a01cf9070fb1b64589bcbc8cae01d5e2a2 Author: John Baldwin AuthorDate: 2021-03-03 22:46:45 +0000 Commit: John Baldwin CommitDate: 2021-03-11 23:37:29 +0000 Remove the usr/tests/usr.bin/yacc/yacc directory when removing yacc. Approved by: re (gjb) (cherry picked from commit e6cfd2939a4261c1f4bf802368cea8faf824c128) (cherry picked from commit 6a2ab3769abb0ea6357a9c1b9630c4efc884aebc) --- tools/build/mk/OptionalObsoleteFiles.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index b517cff65338..4045355fb27f 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -9177,6 +9177,7 @@ OLD_FILES+=usr/tests/usr.bin/yacc/yacc/varsyntax_calc1.output OLD_FILES+=usr/tests/usr.bin/yacc/yacc/varsyntax_calc1.tab.c OLD_FILES+=usr/tests/usr.bin/yacc/yacc/varsyntax_calc1.tab.h OLD_FILES+=usr/tests/usr.bin/yacc/yacc_tests +OLD_DIRS+=usr/tests/usr.bin/yacc/yacc OLD_DIRS+=usr/tests/usr.bin/yacc .endif From owner-dev-commits-src-all@freebsd.org Thu Mar 11 23:38:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 599575AF66F; Thu, 11 Mar 2021 23:38: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 4DxQPH2872z4XZ7; Thu, 11 Mar 2021 23:38: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 3C81F5A31; Thu, 11 Mar 2021 23:38: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 12BNcRk5027738; Thu, 11 Mar 2021 23:38:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BNcRmK027737; Thu, 11 Mar 2021 23:38:27 GMT (envelope-from git) Date: Thu, 11 Mar 2021 23:38:27 GMT Message-Id: <202103112338.12BNcRmK027737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 3b9e12f66e0c - releng/13.0 - Correct the name of the structure used for TCP socket options. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 3b9e12f66e0cfd0c7db0eda9f72770499a6408b8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 23:38:27 -0000 The branch releng/13.0 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3b9e12f66e0cfd0c7db0eda9f72770499a6408b8 commit 3b9e12f66e0cfd0c7db0eda9f72770499a6408b8 Author: John Baldwin AuthorDate: 2021-03-08 18:46:40 +0000 Commit: John Baldwin CommitDate: 2021-03-11 23:37:45 +0000 Correct the name of the structure used for TCP socket options. The structure was renamed while refactoring Netflix's KTLS changes for upstreaming, but the original name remained in tcp.4 and was subsequently copied to ktls.4. PR: 254141 Reported by: asomers Approved by: re (gjb) (cherry picked from commit c5a365623f88999b524d94003187ef09fda55f67) (cherry picked from commit 0fc5395122b4b50564f3dc9164830a0d1635b622) --- share/man/man4/ktls.4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man4/ktls.4 b/share/man/man4/ktls.4 index 21e1a1bdb6ca..648eeaedfa6a 100644 --- a/share/man/man4/ktls.4 +++ b/share/man/man4/ktls.4 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2021 +.Dd March 8, 2021 .Dt KTLS 4 .Os .Sh NAME @@ -54,7 +54,7 @@ and .Dv TCP_RXTLS_ENABLE socket options. Both socket options accept a -.Vt struct tls_so_enable +.Vt struct tls_enable structure as their argument. The members of this structure describe the cipher suite used for the TLS session and provide the session keys used for the respective @@ -166,7 +166,7 @@ will fail with one of the following errors: .It Bq Er EINVAL The version fields in a TLS record's header did not match the version required by the -.Vt struct tls_so_enable +.Vt struct tls_enable structure used to enable in-kernel TLS. .It Bq Er EMSGSIZE A TLS record's length was either too small or too large. From owner-dev-commits-src-all@freebsd.org Thu Mar 11 23:38:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60CB95AF863; Thu, 11 Mar 2021 23:38: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 4DxQPJ5ppdz4XZD; Thu, 11 Mar 2021 23:38: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 6140D5A32; Thu, 11 Mar 2021 23:38: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 12BNcSKX027760; Thu, 11 Mar 2021 23:38:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12BNcSOI027759; Thu, 11 Mar 2021 23:38:28 GMT (envelope-from git) Date: Thu, 11 Mar 2021 23:38:28 GMT Message-Id: <202103112338.12BNcSOI027759@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 290e4d98abbc - releng/13.0 - Add ObsoleteFiles.inc entries for various OCF headers removed in 13. 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 290e4d98abbc6981d8bb93e7389ac203d296fbb3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 23:38:29 -0000 The branch releng/13.0 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=290e4d98abbc6981d8bb93e7389ac203d296fbb3 commit 290e4d98abbc6981d8bb93e7389ac203d296fbb3 Author: John Baldwin AuthorDate: 2021-03-08 19:17:21 +0000 Commit: John Baldwin CommitDate: 2021-03-11 23:37:52 +0000 Add ObsoleteFiles.inc entries for various OCF headers removed in 13. Approved by: re (gjb) (cherry picked from commit ef74bfc6fed298d5ca0e3cb92bf008b715ea0c2f) (cherry picked from commit da55db32647bfe56ce12857ad6ef611af4cfb7be) --- ObsoleteFiles.inc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 5f4495c50ee6..d72eebbe7de1 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -1212,11 +1212,19 @@ OLD_DIRS+=usr/lib/clang/10.0.0/lib/freebsd OLD_DIRS+=usr/lib/clang/10.0.0/lib OLD_DIRS+=usr/lib/clang/10.0.0 +# 20200520: xform_userland.h removed +OLD_FILES+=usr/include/crypto/xform_userland.h + # 20200515: libalias cuseeme protocol support retired OLD_LIBS+=lib/libalias_cuseeme.so OLD_FILES+=usr/lib/libalias_cuseeme.a OLD_FILES+=usr/lib/libalias_cuseeme_p.a +# 20200511: Remove deprecated crypto algorithms +OLD_FILES+=usr/include/crypto/cast.h +OLD_FILES+=usr/include/crypto/castsb.h +OLD_FILES+=usr/include/crypto/skipjack.h + # 20200511: Remove ubsec(4) OLD_FILES+=usr/share/man/man4/ubsec.4.gz @@ -1252,6 +1260,7 @@ OLD_FILES+=usr/share/man/man1/gdbserver.1.gz OLD_FILES+=usr/share/man/man1/kgdb.1.gz # 20200327: OCF refactoring +OLD_FILES+=usr/include/crypto/cryptosoft.h OLD_FILES+=usr/share/man/man9/crypto_find_driver.9.gz OLD_FILES+=usr/share/man/man9/crypto_register.9.gz OLD_FILES+=usr/share/man/man9/crypto_unregister.9.gz From owner-dev-commits-src-all@freebsd.org Fri Mar 12 00:04:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8AF05683E2; Fri, 12 Mar 2021 00:04: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 4DxQyw5qy6z4ZKl; Fri, 12 Mar 2021 00:04: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 BB2D861AA; Fri, 12 Mar 2021 00:04: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 12C048jb066557; Fri, 12 Mar 2021 00:04:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12C048Lr066556; Fri, 12 Mar 2021 00:04:08 GMT (envelope-from git) Date: Fri, 12 Mar 2021 00:04:08 GMT Message-Id: <202103120004.12C048Lr066556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 13c22f749530 - releng/13.0 - update to 13.0-RC2 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 13c22f7495305f5b92874128b088ab47d9512c20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 00:04:08 -0000 The branch releng/13.0 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=13c22f7495305f5b92874128b088ab47d9512c20 commit 13c22f7495305f5b92874128b088ab47d9512c20 Author: Glen Barber AuthorDate: 2021-03-12 00:03:52 +0000 Commit: Glen Barber CommitDate: 2021-03-12 00:03:52 +0000 update to 13.0-RC2 While here, switch the pkg(8) repo to use release_0 for populating the dvd1.iso packages. Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/pkg_repos/release-dvd.conf | 2 +- sys/conf/newvers.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/release/pkg_repos/release-dvd.conf b/release/pkg_repos/release-dvd.conf index 34997f2c7067..060bc150756b 100644 --- a/release/pkg_repos/release-dvd.conf +++ b/release/pkg_repos/release-dvd.conf @@ -1,6 +1,6 @@ # $FreeBSD$ release: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_0", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index e2c07563f53b..30178e155226 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="RC1" +BRANCH="RC2" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-all@freebsd.org Fri Mar 12 00:15:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F6CB568874; Fri, 12 Mar 2021 00:15: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 4DxRDV0pBtz4Zdt; Fri, 12 Mar 2021 00:15: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 0E5F65FE8; Fri, 12 Mar 2021 00:15: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 12C0Fr1Q080481; Fri, 12 Mar 2021 00:15:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12C0Frgm080480; Fri, 12 Mar 2021 00:15:53 GMT (envelope-from git) Date: Fri, 12 Mar 2021 00:15:53 GMT Message-Id: <202103120015.12C0Frgm080480@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 8a157722e947 - main - Remove README in favor of README.md MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a157722e947191a63e9108cbfb60ee2605858b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 00:15:54 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8a157722e947191a63e9108cbfb60ee2605858b4 commit 8a157722e947191a63e9108cbfb60ee2605858b4 Author: Warner Losh AuthorDate: 2021-03-12 00:11:28 +0000 Commit: Warner Losh CommitDate: 2021-03-12 00:14:35 +0000 Remove README in favor of README.md Complete the transition to README.md I started 3 years ago. Remove the now-redundant README file. It's currently just README.md w/o the light markup and adds no real value. This also allows us to use additional MarkDown markup as we see fit w/o worrying about keeping things in sync. --- README | 80 ------------------------------------------------------------------ 1 file changed, 80 deletions(-) diff --git a/README b/README deleted file mode 100644 index aad363baf9ea..000000000000 --- a/README +++ /dev/null @@ -1,80 +0,0 @@ -This is the top level of the FreeBSD source directory. This file -was last revised on: -$FreeBSD$ - -FreeBSD is an operating system used to power modern servers, -desktops, and embedded platforms. A large community has -continually developed it for more than thirty years. Its -advanced networking, security, and storage features have -made FreeBSD the platform of choice for many of the -busiest web sites and most pervasive embedded networking -and storage devices. - -For copyright information, please see the file COPYRIGHT in this -directory. Additional copyright information also exists for some -sources in this tree - please see the specific source directories for -more information. - -The Makefile in this directory supports a number of targets for -building components (or all) of the FreeBSD source tree. See build(7), config(8), -https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html, and -https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html -for more information, including setting make(1) variables. - -Source Roadmap: ---------------- - -bin System/user commands. - -cddl Various commands and libraries under the Common Development - and Distribution License. - -contrib Packages contributed by 3rd parties. - -crypto Cryptography stuff (see crypto/README). - -etc Template files for /etc. - -gnu Various commands and libraries under the GNU Public License. - Please see gnu/COPYING* for more information. - -include System include files. - -kerberos5 Kerberos5 (Heimdal) package. - -lib System libraries. - -libexec System daemons. - -release Release building Makefile & associated tools. - -rescue Build system for statically linked /rescue utilities. - -sbin System commands. - -secure Cryptographic libraries and commands. - -share Shared resources. - -stand Boot loader sources. - -sys Kernel sources. - -sys//conf Kernel configuration files. GENERIC is the configuration - used in release builds. NOTES contains documentation of - all possible entries. - -tests Regression tests which can be run by Kyua. See tests/README - for additional information. - -tools Utilities for regression testing and miscellaneous tasks. - -usr.bin User commands. - -usr.sbin System administration commands. - - -For information on synchronizing your source tree with one or more of -the FreeBSD Project's development branches, please see: - - https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/current-stable.html From owner-dev-commits-src-all@freebsd.org Fri Mar 12 00:39:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2714A569007; Fri, 12 Mar 2021 00:39: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 4DxRlH0g53z4bcl; Fri, 12 Mar 2021 00:39: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 09BAE64DA; Fri, 12 Mar 2021 00:39: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 12C0d6dS006836; Fri, 12 Mar 2021 00:39:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12C0d6r5006835; Fri, 12 Mar 2021 00:39:06 GMT (envelope-from git) Date: Fri, 12 Mar 2021 00:39:06 GMT Message-Id: <202103120039.12C0d6r5006835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 2918e9fdb82f - main - readme: update style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2918e9fdb82ffe5e95cab90a754bc6c2b6dd16a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 00:39:07 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=2918e9fdb82ffe5e95cab90a754bc6c2b6dd16a2 commit 2918e9fdb82ffe5e95cab90a754bc6c2b6dd16a2 Author: Warner Losh AuthorDate: 2021-03-12 00:21:16 +0000 Commit: Warner Losh CommitDate: 2021-03-12 00:38:30 +0000 readme: update style Update the style to one sentence per line, as is currently used in the FreeBSD document project. Make the links to the handbook clickable. --- README.md | 108 ++++++++++++++++++++------------------------------------------ 1 file changed, 34 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 72bd634cd813..9f07ed61647e 100644 --- a/README.md +++ b/README.md @@ -1,82 +1,42 @@ FreeBSD Source: --------------- -This is the top level of the FreeBSD source directory. This file -was last revised on: -$FreeBSD$ +This is the top level of the FreeBSD source directory. -FreeBSD is an operating system used to power modern servers, -desktops, and embedded platforms. A large community has -continually developed it for more than thirty years. Its -advanced networking, security, and storage features have -made FreeBSD the platform of choice for many of the -busiest web sites and most pervasive embedded networking -and storage devices. +FreeBSD is an operating system used to power modern servers, desktops, and embedded platforms. +A large community has continually developed it for more than thirty years. +Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices. -For copyright information, please see the file COPYRIGHT in this -directory. Additional copyright information also exists for some -sources in this tree - please see the specific source directories for -more information. +For copyright information, please see the file COPYRIGHT in this directory. +Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information. -The Makefile in this directory supports a number of targets for -building components (or all) of the FreeBSD source tree. See build(7), config(8), -https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html, and -https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html -for more information, including setting make(1) variables. +The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. +See build(7), config(8), [FreeBSD handbook on building userland](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html), and [Handbook for kernels](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html) for more information, including setting make(1) variables. Source Roadmap: --------------- -``` -bin System/user commands. - -cddl Various commands and libraries under the Common Development - and Distribution License. - -contrib Packages contributed by 3rd parties. - -crypto Cryptography stuff (see crypto/README). - -etc Template files for /etc. - -gnu Various commands and libraries under the GNU Public License. - Please see gnu/COPYING* for more information. - -include System include files. - -kerberos5 Kerberos5 (Heimdal) package. - -lib System libraries. - -libexec System daemons. - -release Release building Makefile & associated tools. - -rescue Build system for statically linked /rescue utilities. - -sbin System commands. - -secure Cryptographic libraries and commands. - -share Shared resources. - -stand Boot loader sources. - -sys Kernel sources. - -sys//conf Kernel configuration files. GENERIC is the configuration - used in release builds. NOTES contains documentation of - all possible entries. - -tests Regression tests which can be run by Kyua. See tests/README - for additional information. - -tools Utilities for regression testing and miscellaneous tasks. - -usr.bin User commands. - -usr.sbin System administration commands. -``` - -For information on synchronizing your source tree with one or more of -the FreeBSD Project's development branches, please see: - - https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/current-stable.html +| Directory | Description | +| --------- | ------------ | +| bin | System/user commands. | +| cddl | Various commands and libraries under the Common Development and Distribution License. | +| contrib | Packages contributed by 3rd parties. | +| crypto | Cryptography stuff (see [crypto/README](crypto/README)). | +| etc | Template files for /etc. | +| gnu | Various commands and libraries under the GNU Public License. Please see [gnu/COPYING](gnu/COPYING) and [gnu/COPYING.LIB](gnu/COPYING.LIB) for more information. | +| include | System include files. | +| kerberos5 | Kerberos5 (Heimdal) package. | +| lib | System libraries. | +| libexec | System daemons. | +| release | Release building Makefile & associated tools. | +| rescue | Build system for statically linked /rescue utilities. | +| sbin | System commands. | +| secure | Cryptographic libraries and commands. | +| share | Shared resources. | +| stand | Boot loader sources. | +| sys | Kernel sources. | +| sys//conf | Kernel configuration files. GENERIC is the configuration used in release builds. NOTES contains documentation of all possible entries. | +| tests | Regression tests which can be run by Kyua. See [tests/README](tests/README) for additional information. | +| tools | Utilities for regression testing and miscellaneous tasks. | +| usr.bin | User commands. | +| usr.sbin | System administration commands. | + +For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see [FreeBSD Handbook](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/current-stable.html). From owner-dev-commits-src-all@freebsd.org Fri Mar 12 00:52:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 783955694A0; Fri, 12 Mar 2021 00:52: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 4DxS3G2hqkz4c0n; Fri, 12 Mar 2021 00:52: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 4FADE6B1A; Fri, 12 Mar 2021 00:52: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 12C0qwIA032261; Fri, 12 Mar 2021 00:52:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12C0qwOW032260; Fri, 12 Mar 2021 00:52:58 GMT (envelope-from git) Date: Fri, 12 Mar 2021 00:52:58 GMT Message-Id: <202103120052.12C0qwOW032260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: dbd92cc2a491 - main - Fix arch rendering MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dbd92cc2a4915a2070c93cff423314f43edfc841 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 00:52:58 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=dbd92cc2a4915a2070c93cff423314f43edfc841 commit dbd92cc2a4915a2070c93cff423314f43edfc841 Author: Warner Losh AuthorDate: 2021-03-12 00:52:13 +0000 Commit: Warner Losh CommitDate: 2021-03-12 00:52:13 +0000 Fix arch rendering --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f07ed61647e..74ffbfbb94bb 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Source Roadmap: | share | Shared resources. | | stand | Boot loader sources. | | sys | Kernel sources. | -| sys//conf | Kernel configuration files. GENERIC is the configuration used in release builds. NOTES contains documentation of all possible entries. | +| sys/`arch`/conf | Kernel configuration files. GENERIC is the configuration used in release builds. NOTES contains documentation of all possible entries. | | tests | Regression tests which can be run by Kyua. See [tests/README](tests/README) for additional information. | | tools | Utilities for regression testing and miscellaneous tasks. | | usr.bin | User commands. | From owner-dev-commits-src-all@freebsd.org Fri Mar 12 00:55:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6383C568FE5; Fri, 12 Mar 2021 00:55: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 4DxS6R2Mybz4cHW; Fri, 12 Mar 2021 00:55: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 440EC6930; Fri, 12 Mar 2021 00:55: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 12C0thNO032812; Fri, 12 Mar 2021 00:55:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12C0thpg032811; Fri, 12 Mar 2021 00:55:43 GMT (envelope-from git) Date: Fri, 12 Mar 2021 00:55:43 GMT Message-Id: <202103120055.12C0thpg032811@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e75eac2cb81c - main - readme: Link to COPYRIGHT file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e75eac2cb81c510389f527da14cec4a16123e673 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 00:55:43 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e75eac2cb81c510389f527da14cec4a16123e673 commit e75eac2cb81c510389f527da14cec4a16123e673 Author: Warner Losh AuthorDate: 2021-03-12 00:55:16 +0000 Commit: Warner Losh CommitDate: 2021-03-12 00:55:16 +0000 readme: Link to COPYRIGHT file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 74ffbfbb94bb..e6899c7549e0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ FreeBSD is an operating system used to power modern servers, desktops, and embed A large community has continually developed it for more than thirty years. Its advanced networking, security, and storage features have made FreeBSD the platform of choice for many of the busiest web sites and most pervasive embedded networking and storage devices. -For copyright information, please see the file COPYRIGHT in this directory. +For copyright information, please see [the file COPYRIGHT](COPYRIGHT) in this directory. Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information. The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. From owner-dev-commits-src-all@freebsd.org Fri Mar 12 04:43:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB70956DF19; Fri, 12 Mar 2021 04:43: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 4DxY8n5dZMz4ncG; Fri, 12 Mar 2021 04:43: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 B43FE11E98; Fri, 12 Mar 2021 04:43: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 12C4h52E035997; Fri, 12 Mar 2021 04:43:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12C4h5HM035996; Fri, 12 Mar 2021 04:43:05 GMT (envelope-from git) Date: Fri, 12 Mar 2021 04:43:05 GMT Message-Id: <202103120443.12C4h5HM035996@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: a491581f3f8d - main - Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a491581f3f8df07cdff0236bd556895205929af4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 04:43:05 -0000 The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=a491581f3f8df07cdff0236bd556895205929af4 commit a491581f3f8df07cdff0236bd556895205929af4 Author: Wei Hu AuthorDate: 2021-03-12 04:35:16 +0000 Commit: Wei Hu CommitDate: 2021-03-12 04:35:16 +0000 Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver Receive Segment Coalescing (RSC) in the vSwitch is a feature available in Windows Server 2019 hosts and later. It reduces the per packet processing overhead by coalescing multiple TCP segments when possible. This happens mostly when TCP traffics are among different guests on same host. This patch adds netvsc driver support for this feature. The patch also updates NVS version to 6.1 as needed for RSC enablement. MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D29075 --- sys/dev/hyperv/netvsc/hn_nvs.c | 5 + sys/dev/hyperv/netvsc/hn_rndis.c | 25 ++++ sys/dev/hyperv/netvsc/if_hn.c | 258 ++++++++++++++++++++++++++++----------- sys/dev/hyperv/netvsc/if_hnreg.h | 14 +++ sys/dev/hyperv/netvsc/if_hnvar.h | 19 ++- sys/dev/hyperv/netvsc/ndis.h | 31 +++-- sys/net/rndis.h | 7 +- 7 files changed, 269 insertions(+), 90 deletions(-) diff --git a/sys/dev/hyperv/netvsc/hn_nvs.c b/sys/dev/hyperv/netvsc/hn_nvs.c index 73a112c4e5e1..4dbc28996617 100644 --- a/sys/dev/hyperv/netvsc/hn_nvs.c +++ b/sys/dev/hyperv/netvsc/hn_nvs.c @@ -80,6 +80,8 @@ struct hn_nvs_sendctx hn_nvs_sendctx_none = HN_NVS_SENDCTX_INITIALIZER(hn_nvs_sent_none, NULL); static const uint32_t hn_nvs_version[] = { + HN_NVS_VERSION_61, + HN_NVS_VERSION_6, HN_NVS_VERSION_5, HN_NVS_VERSION_4, HN_NVS_VERSION_2, @@ -508,6 +510,9 @@ hn_nvs_conf_ndis(struct hn_softc *sc, int mtu) conf.nvs_caps = HN_NVS_NDIS_CONF_VLAN; if (sc->hn_nvs_ver >= HN_NVS_VERSION_5) conf.nvs_caps |= HN_NVS_NDIS_CONF_SRIOV; + if (sc->hn_nvs_ver >= HN_NVS_VERSION_61) + conf.nvs_caps |= HN_NVS_NDIS_CONF_RSC; + /* NOTE: No response. */ error = hn_nvs_req_send(sc, &conf, sizeof(conf)); diff --git a/sys/dev/hyperv/netvsc/hn_rndis.c b/sys/dev/hyperv/netvsc/hn_rndis.c index b9bf683fe811..794a82cf3957 100644 --- a/sys/dev/hyperv/netvsc/hn_rndis.c +++ b/sys/dev/hyperv/netvsc/hn_rndis.c @@ -723,6 +723,17 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu) params.ndis_udp6csum = NDIS_OFFLOAD_PARAM_RX; } + /* RSC offload */ + if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) { + if (hwcaps.ndis_rsc.ndis_ip4 && hwcaps.ndis_rsc.ndis_ip6) { + params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_ON; + params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_ON; + } else { + params.ndis_rsc_ip4 = NDIS_OFFLOAD_RSC_OFF; + params.ndis_rsc_ip6 = NDIS_OFFLOAD_RSC_OFF; + } + } + if (bootverbose) { if_printf(sc->hn_ifp, "offload csum: " "ip4 %u, tcp4 %u, udp4 %u, tcp6 %u, udp6 %u\n", @@ -734,6 +745,10 @@ hn_rndis_conf_offload(struct hn_softc *sc, int mtu) if_printf(sc->hn_ifp, "offload lsov2: ip4 %u, ip6 %u\n", params.ndis_lsov2_ip4, params.ndis_lsov2_ip6); + if (hwcaps.ndis_hdr.ndis_rev >= NDIS_OFFLOAD_PARAMS_REV_3) + if_printf(sc->hn_ifp, "offload rsc: ip4 %u, ip6 %u\n", + params.ndis_rsc_ip4, + params.ndis_rsc_ip6); } error = hn_rndis_set(sc, OID_TCP_OFFLOAD_PARAMETERS, ¶ms, paramsz); @@ -969,6 +984,11 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) if_printf(sc->hn_ifp, "invalid NDIS objsize %u\n", caps->ndis_hdr.ndis_size); return (EINVAL); + } else if (caps->ndis_hdr.ndis_rev >= NDIS_OFFLOAD_REV_3 && + caps->ndis_hdr.ndis_size < NDIS_OFFLOAD_SIZE) { + if_printf(sc->hn_ifp, "invalid NDIS rev3 objsize %u\n", + caps->ndis_hdr.ndis_size); + return (EINVAL); } if (bootverbose) { @@ -1001,6 +1021,11 @@ hn_rndis_query_hwcaps(struct hn_softc *sc, struct ndis_offload *caps) caps->ndis_lsov2.ndis_ip6_minsg, caps->ndis_lsov2.ndis_ip6_encap, caps->ndis_lsov2.ndis_ip6_opts); + if (caps->ndis_hdr.ndis_rev >= NDIS_OFFLOAD_REV_3) + if_printf(sc->hn_ifp, "hwcaps rsc: " + "ip4 %u ip6 %u\n", + caps->ndis_rsc.ndis_ip4, + caps->ndis_rsc.ndis_ip6); } return (0); } diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 9243ff226f5b..f4bdbb1ee788 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -223,11 +223,25 @@ struct hn_txdesc { #define HN_TXD_FLAG_DMAMAP 0x0002 #define HN_TXD_FLAG_ONAGG 0x0004 +#define HN_NDIS_PKTINFO_SUBALLOC 0x01 +#define HN_NDIS_PKTINFO_1ST_FRAG 0x02 +#define HN_NDIS_PKTINFO_LAST_FRAG 0x04 + +struct packet_info_id { + uint8_t ver; + uint8_t flag; + uint16_t pkt_id; +}; + +#define NDIS_PKTINFOID_SZ sizeof(struct packet_info_id) + + struct hn_rxinfo { - uint32_t vlan_info; - uint32_t csum_info; - uint32_t hash_info; - uint32_t hash_value; + const uint32_t *vlan_info; + const uint32_t *csum_info; + const uint32_t *hash_info; + const uint32_t *hash_value; + const struct packet_info_id *pktinfo_id; }; struct hn_rxvf_setarg { @@ -239,15 +253,13 @@ struct hn_rxvf_setarg { #define HN_RXINFO_CSUM 0x0002 #define HN_RXINFO_HASHINF 0x0004 #define HN_RXINFO_HASHVAL 0x0008 +#define HN_RXINFO_PKTINFO_ID 0x0010 #define HN_RXINFO_ALL \ (HN_RXINFO_VLAN | \ HN_RXINFO_CSUM | \ HN_RXINFO_HASHINF | \ - HN_RXINFO_HASHVAL) - -#define HN_NDIS_VLAN_INFO_INVALID 0xffffffff -#define HN_NDIS_RXCSUM_INFO_INVALID 0 -#define HN_NDIS_HASH_INFO_INVALID 0 + HN_RXINFO_HASHVAL | \ + HN_RXINFO_PKTINFO_ID) static int hn_probe(device_t); static int hn_attach(device_t); @@ -396,8 +408,7 @@ static int hn_rxfilter_config(struct hn_softc *); static int hn_rss_reconfig(struct hn_softc *); static void hn_rss_ind_fixup(struct hn_softc *); static void hn_rss_mbuf_hash(struct hn_softc *, uint32_t); -static int hn_rxpkt(struct hn_rx_ring *, const void *, - int, const struct hn_rxinfo *); +static int hn_rxpkt(struct hn_rx_ring *); static uint32_t hn_rss_type_fromndis(uint32_t); static uint32_t hn_rss_type_tondis(uint32_t); @@ -3353,9 +3364,10 @@ again: * allocated with cluster size MJUMPAGESIZE, and filled * accordingly. * - * Return 1 if able to complete the job; otherwise 0. + * Return the last mbuf in the chain or NULL if failed to + * allocate new mbuf. */ -static int +static struct mbuf * hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) { struct mbuf *m, *n; @@ -3383,7 +3395,7 @@ hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) */ n = m_getjcl(M_NOWAIT, m->m_type, 0, MJUMPAGESIZE); if (n == NULL) - break; + return NULL; n->m_len = min(MJUMPAGESIZE, remainder); bcopy(cp, mtod(n, caddr_t), n->m_len); cp += n->m_len; @@ -3391,10 +3403,8 @@ hv_m_append(struct mbuf *m0, int len, c_caddr_t cp) m->m_next = n; m = n; } - if (m0->m_flags & M_PKTHDR) - m0->m_pkthdr.len += len - remainder; - return (remainder == 0); + return m; } #if defined(INET) || defined(INET6) @@ -3412,14 +3422,14 @@ hn_lro_rx(struct lro_ctrl *lc, struct mbuf *m) #endif static int -hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, - const struct hn_rxinfo *info) +hn_rxpkt(struct hn_rx_ring *rxr) { struct ifnet *ifp, *hn_ifp = rxr->hn_ifp; - struct mbuf *m_new; + struct mbuf *m_new, *n; int size, do_lro = 0, do_csum = 1, is_vf = 0; int hash_type = M_HASHTYPE_NONE; int l3proto = ETHERTYPE_MAX, l4proto = IPPROTO_DONE; + int i; ifp = hn_ifp; if (rxr->hn_rxvf_ifp != NULL) { @@ -3446,20 +3456,20 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, return (0); } - if (__predict_false(dlen < ETHER_HDR_LEN)) { + if (__predict_false(rxr->rsc.pktlen < ETHER_HDR_LEN)) { if_inc_counter(hn_ifp, IFCOUNTER_IERRORS, 1); return (0); } - if (dlen <= MHLEN) { + if (rxr->rsc.cnt == 1 && rxr->rsc.pktlen <= MHLEN) { m_new = m_gethdr(M_NOWAIT, MT_DATA); if (m_new == NULL) { if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); return (0); } - memcpy(mtod(m_new, void *), data, dlen); - m_new->m_pkthdr.len = m_new->m_len = dlen; - rxr->hn_small_pkts++; + memcpy(mtod(m_new, void *), rxr->rsc.frag_data[0], + rxr->rsc.frag_len[0]); + m_new->m_pkthdr.len = m_new->m_len = rxr->rsc.frag_len[0]; } else { /* * Get an mbuf with a cluster. For packets 2K or less, @@ -3468,7 +3478,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * if looped around to the Hyper-V TX channel, so avoid them. */ size = MCLBYTES; - if (dlen > MCLBYTES) { + if (rxr->rsc.pktlen > MCLBYTES) { /* 4096 */ size = MJUMPAGESIZE; } @@ -3479,29 +3489,42 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, return (0); } - hv_m_append(m_new, dlen, data); + n = m_new; + for (i = 0; i < rxr->rsc.cnt; i++) { + n = hv_m_append(n, rxr->rsc.frag_len[i], + rxr->rsc.frag_data[i]); + if (n == NULL) { + if_inc_counter(hn_ifp, IFCOUNTER_IQDROPS, 1); + return (0); + } else { + m_new->m_pkthdr.len += rxr->rsc.frag_len[i]; + } + } } + if (rxr->rsc.pktlen <= MHLEN) + rxr->hn_small_pkts++; + m_new->m_pkthdr.rcvif = ifp; if (__predict_false((hn_ifp->if_capenable & IFCAP_RXCSUM) == 0)) do_csum = 0; /* receive side checksum offload */ - if (info->csum_info != HN_NDIS_RXCSUM_INFO_INVALID) { + if (rxr->rsc.csum_info != NULL) { /* IP csum offload */ - if ((info->csum_info & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { + if ((*(rxr->rsc.csum_info) & NDIS_RXCSUM_INFO_IPCS_OK) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_IP_CHECKED | CSUM_IP_VALID); rxr->hn_csum_ip++; } /* TCP/UDP csum offload */ - if ((info->csum_info & (NDIS_RXCSUM_INFO_UDPCS_OK | + if ((*(rxr->rsc.csum_info) & (NDIS_RXCSUM_INFO_UDPCS_OK | NDIS_RXCSUM_INFO_TCPCS_OK)) && do_csum) { m_new->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR); m_new->m_pkthdr.csum_data = 0xffff; - if (info->csum_info & NDIS_RXCSUM_INFO_TCPCS_OK) + if (*(rxr->rsc.csum_info) & NDIS_RXCSUM_INFO_TCPCS_OK) rxr->hn_csum_tcp++; else rxr->hn_csum_udp++; @@ -3514,7 +3537,7 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * the do_lro setting here is actually _not_ accurate. We * depend on the RSS hash type check to reset do_lro. */ - if ((info->csum_info & + if ((*(rxr->rsc.csum_info) & (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) == (NDIS_RXCSUM_INFO_TCPCS_OK | NDIS_RXCSUM_INFO_IPCS_OK)) do_lro = 1; @@ -3551,11 +3574,11 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, } } - if (info->vlan_info != HN_NDIS_VLAN_INFO_INVALID) { + if (rxr->rsc.vlan_info != NULL) { m_new->m_pkthdr.ether_vtag = EVL_MAKETAG( - NDIS_VLAN_INFO_ID(info->vlan_info), - NDIS_VLAN_INFO_PRI(info->vlan_info), - NDIS_VLAN_INFO_CFI(info->vlan_info)); + NDIS_VLAN_INFO_ID(*(rxr->rsc.vlan_info)), + NDIS_VLAN_INFO_PRI(*(rxr->rsc.vlan_info)), + NDIS_VLAN_INFO_CFI(*(rxr->rsc.vlan_info))); m_new->m_flags |= M_VLANTAG; } @@ -3581,14 +3604,14 @@ hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, * matter here), do _not_ mess with unsupported hash types or * functions. */ - if (info->hash_info != HN_NDIS_HASH_INFO_INVALID) { + if (rxr->rsc.hash_info != NULL) { rxr->hn_rss_pkts++; - m_new->m_pkthdr.flowid = info->hash_value; + m_new->m_pkthdr.flowid = *(rxr->rsc.hash_value); if (!is_vf) hash_type = M_HASHTYPE_OPAQUE_HASH; - if ((info->hash_info & NDIS_HASH_FUNCTION_MASK) == + if ((*(rxr->rsc.hash_info) & NDIS_HASH_FUNCTION_MASK) == NDIS_HASH_FUNCTION_TOEPLITZ) { - uint32_t type = (info->hash_info & NDIS_HASH_TYPE_MASK & + uint32_t type = (*(rxr->rsc.hash_info) & NDIS_HASH_TYPE_MASK & rxr->hn_mbuf_hash); /* @@ -5033,6 +5056,16 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt) OID_AUTO, "rss_pkts", CTLFLAG_RW, &rxr->hn_rss_pkts, "# of packets w/ RSS info received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rsc_pkts", CTLFLAG_RW, + &rxr->hn_rsc_pkts, + "# of RSC packets received"); + SYSCTL_ADD_ULONG(ctx, + SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), + OID_AUTO, "rsc_drop", CTLFLAG_RW, + &rxr->hn_rsc_drop, + "# of RSC fragments dropped"); SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(rxr->hn_rx_sysctl_tree), OID_AUTO, "pktbuf_len", CTLFLAG_RD, @@ -7057,37 +7090,56 @@ hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_rxinfo *info) dlen = pi->rm_size - pi->rm_pktinfooffset; data = pi->rm_data; - switch (pi->rm_type) { - case NDIS_PKTINFO_TYPE_VLAN: - if (__predict_false(dlen < NDIS_VLAN_INFO_SIZE)) - return (EINVAL); - info->vlan_info = *((const uint32_t *)data); - mask |= HN_RXINFO_VLAN; - break; + if (pi->rm_internal == 1) { + switch (pi->rm_type) { + case NDIS_PKTINFO_IT_PKTINFO_ID: + if (__predict_false(dlen < NDIS_PKTINFOID_SZ)) + return (EINVAL); + info->pktinfo_id = + (const struct packet_info_id *)data; + mask |= HN_RXINFO_PKTINFO_ID; + break; - case NDIS_PKTINFO_TYPE_CSUM: - if (__predict_false(dlen < NDIS_RXCSUM_INFO_SIZE)) - return (EINVAL); - info->csum_info = *((const uint32_t *)data); - mask |= HN_RXINFO_CSUM; - break; + default: + goto next; + } + } else { + switch (pi->rm_type) { + case NDIS_PKTINFO_TYPE_VLAN: + if (__predict_false(dlen + < NDIS_VLAN_INFO_SIZE)) + return (EINVAL); + info->vlan_info = (const uint32_t *)data; + mask |= HN_RXINFO_VLAN; + break; - case HN_NDIS_PKTINFO_TYPE_HASHVAL: - if (__predict_false(dlen < HN_NDIS_HASH_VALUE_SIZE)) - return (EINVAL); - info->hash_value = *((const uint32_t *)data); - mask |= HN_RXINFO_HASHVAL; - break; + case NDIS_PKTINFO_TYPE_CSUM: + if (__predict_false(dlen + < NDIS_RXCSUM_INFO_SIZE)) + return (EINVAL); + info->csum_info = (const uint32_t *)data; + mask |= HN_RXINFO_CSUM; + break; - case HN_NDIS_PKTINFO_TYPE_HASHINF: - if (__predict_false(dlen < HN_NDIS_HASH_INFO_SIZE)) - return (EINVAL); - info->hash_info = *((const uint32_t *)data); - mask |= HN_RXINFO_HASHINF; - break; + case HN_NDIS_PKTINFO_TYPE_HASHVAL: + if (__predict_false(dlen + < HN_NDIS_HASH_VALUE_SIZE)) + return (EINVAL); + info->hash_value = (const uint32_t *)data; + mask |= HN_RXINFO_HASHVAL; + break; - default: - goto next; + case HN_NDIS_PKTINFO_TYPE_HASHINF: + if (__predict_false(dlen + < HN_NDIS_HASH_INFO_SIZE)) + return (EINVAL); + info->hash_info = (const uint32_t *)data; + mask |= HN_RXINFO_HASHINF; + break; + + default: + goto next; + } } if (mask == HN_RXINFO_ALL) { @@ -7104,7 +7156,7 @@ next: * - If there is no hash value, invalidate the hash info. */ if ((mask & HN_RXINFO_HASHVAL) == 0) - info->hash_info = HN_NDIS_HASH_INFO_INVALID; + info->hash_info = NULL; return (0); } @@ -7122,12 +7174,34 @@ hn_rndis_check_overlap(int off, int len, int check_off, int check_len) return (true); } +static __inline void +hn_rsc_add_data(struct hn_rx_ring *rxr, const void *data, + uint32_t len, struct hn_rxinfo *info) +{ + uint32_t cnt = rxr->rsc.cnt; + + if (cnt) { + rxr->rsc.pktlen += len; + } else { + rxr->rsc.vlan_info = info->vlan_info; + rxr->rsc.csum_info = info->csum_info; + rxr->rsc.hash_info = info->hash_info; + rxr->rsc.hash_value = info->hash_value; + rxr->rsc.pktlen = len; + } + + rxr->rsc.frag_data[cnt] = data; + rxr->rsc.frag_len[cnt] = len; + rxr->rsc.cnt++; +} + static void hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) { const struct rndis_packet_msg *pkt; struct hn_rxinfo info; int data_off, pktinfo_off, data_len, pktinfo_len; + bool rsc_more= false; /* * Check length. @@ -7235,9 +7309,11 @@ hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) /* * Check per-packet-info coverage and find useful per-packet-info. */ - info.vlan_info = HN_NDIS_VLAN_INFO_INVALID; - info.csum_info = HN_NDIS_RXCSUM_INFO_INVALID; - info.hash_info = HN_NDIS_HASH_INFO_INVALID; + info.vlan_info = NULL; + info.csum_info = NULL; + info.hash_info = NULL; + info.pktinfo_id = NULL; + if (__predict_true(pktinfo_len != 0)) { bool overlap; int error; @@ -7281,7 +7357,43 @@ hn_rndis_rx_data(struct hn_rx_ring *rxr, const void *data, int dlen) pkt->rm_len, data_off, data_len); return; } - hn_rxpkt(rxr, ((const uint8_t *)pkt) + data_off, data_len, &info); + + /* Identify RSC fragments, drop invalid packets */ + if ((info.pktinfo_id != NULL) && + (info.pktinfo_id->flag & HN_NDIS_PKTINFO_SUBALLOC)) { + if (info.pktinfo_id->flag & HN_NDIS_PKTINFO_1ST_FRAG) { + rxr->rsc.cnt = 0; + rxr->hn_rsc_pkts++; + } else if (rxr->rsc.cnt == 0) + goto drop; + + rsc_more = true; + + if (info.pktinfo_id->flag & HN_NDIS_PKTINFO_LAST_FRAG) + rsc_more = false; + + if (rsc_more && rxr->rsc.is_last) + goto drop; + } else { + rxr->rsc.cnt = 0; + } + + if (__predict_false(rxr->rsc.cnt >= HN_NVS_RSC_MAX)) + goto drop; + + /* Store data in per rx ring structure */ + hn_rsc_add_data(rxr,((const uint8_t *)pkt) + data_off, + data_len, &info); + + if (rsc_more) + return; + + hn_rxpkt(rxr); + rxr->rsc.cnt = 0; + return; +drop: + rxr->hn_rsc_drop++; + return; } static __inline void @@ -7394,6 +7506,8 @@ hn_nvs_handle_rxbuf(struct hn_rx_ring *rxr, struct vmbus_channel *chan, "ofs %d, len %d\n", i, ofs, len); continue; } + + rxr->rsc.is_last = (i == (count - 1)); hn_rndis_rxpkt(rxr, rxr->hn_rxbuf + ofs, len); } diff --git a/sys/dev/hyperv/netvsc/if_hnreg.h b/sys/dev/hyperv/netvsc/if_hnreg.h index 154d69264679..54db556cc56d 100644 --- a/sys/dev/hyperv/netvsc/if_hnreg.h +++ b/sys/dev/hyperv/netvsc/if_hnreg.h @@ -48,6 +48,8 @@ #define HN_NVS_VERSION_2 0x30002 #define HN_NVS_VERSION_4 0x40000 #define HN_NVS_VERSION_5 0x50000 +#define HN_NVS_VERSION_6 0x60000 +#define HN_NVS_VERSION_61 0x60001 #define HN_NVS_RXBUF_SIG 0xcafe #define HN_NVS_CHIM_SIG 0xface @@ -101,6 +103,7 @@ struct hn_nvs_init { uint32_t nvs_ver_min; uint32_t nvs_ver_max; uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_init) >= HN_NVS_REQSIZE_MIN); @@ -118,11 +121,13 @@ struct hn_nvs_ndis_conf { uint32_t nvs_rsvd; uint64_t nvs_caps; /* HN_NVS_NDIS_CONF_ */ uint8_t nvs_rsvd1[12]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_conf) >= HN_NVS_REQSIZE_MIN); #define HN_NVS_NDIS_CONF_SRIOV 0x0004 #define HN_NVS_NDIS_CONF_VLAN 0x0008 +#define HN_NVS_NDIS_CONF_RSC 0x0080 /* No response */ struct hn_nvs_ndis_init { @@ -130,6 +135,7 @@ struct hn_nvs_ndis_init { uint32_t nvs_ndis_major; /* NDIS_VERSION_MAJOR_ */ uint32_t nvs_ndis_minor; /* NDIS_VERSION_MINOR_ */ uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_ndis_init) >= HN_NVS_REQSIZE_MIN); @@ -141,6 +147,7 @@ struct hn_nvs_datapath { uint32_t nvs_type; /* HN_NVS_TYPE_SET_DATAPATH */ uint32_t nvs_active_path;/* HN_NVS_DATAPATH_* */ uint32_t nvs_rsvd[6]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_datapath) >= HN_NVS_REQSIZE_MIN); @@ -149,6 +156,7 @@ struct hn_nvs_rxbuf_conn { uint32_t nvs_gpadl; /* RXBUF vmbus GPADL */ uint16_t nvs_sig; /* HN_NVS_RXBUF_SIG */ uint8_t nvs_rsvd[22]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rxbuf_conn) >= HN_NVS_REQSIZE_MIN); @@ -171,6 +179,7 @@ struct hn_nvs_rxbuf_disconn { uint32_t nvs_type; /* HN_NVS_TYPE_RXBUF_DISCONN */ uint16_t nvs_sig; /* HN_NVS_RXBUF_SIG */ uint8_t nvs_rsvd[26]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rxbuf_disconn) >= HN_NVS_REQSIZE_MIN); @@ -179,6 +188,7 @@ struct hn_nvs_chim_conn { uint32_t nvs_gpadl; /* chimney buf vmbus GPADL */ uint16_t nvs_sig; /* NDIS_NVS_CHIM_SIG */ uint8_t nvs_rsvd[22]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_chim_conn) >= HN_NVS_REQSIZE_MIN); @@ -193,6 +203,7 @@ struct hn_nvs_chim_disconn { uint32_t nvs_type; /* HN_NVS_TYPE_CHIM_DISCONN */ uint16_t nvs_sig; /* HN_NVS_CHIM_SIG */ uint8_t nvs_rsvd[26]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_chim_disconn) >= HN_NVS_REQSIZE_MIN); @@ -203,6 +214,7 @@ struct hn_nvs_subch_req { uint32_t nvs_op; /* HN_NVS_SUBCH_OP_ */ uint32_t nvs_nsubch; uint8_t nvs_rsvd[20]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_subch_req) >= HN_NVS_REQSIZE_MIN); @@ -226,6 +238,7 @@ struct hn_nvs_rndis { uint32_t nvs_chim_idx; uint32_t nvs_chim_sz; uint8_t nvs_rsvd[16]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rndis) >= HN_NVS_REQSIZE_MIN); @@ -233,6 +246,7 @@ struct hn_nvs_rndis_ack { uint32_t nvs_type; /* HN_NVS_TYPE_RNDIS_ACK */ uint32_t nvs_status; /* HN_NVS_STATUS_ */ uint8_t nvs_rsvd[24]; + uint8_t nvs_msg_pad[8]; } __packed; CTASSERT(sizeof(struct hn_nvs_rndis_ack) >= HN_NVS_REQSIZE_MIN); diff --git a/sys/dev/hyperv/netvsc/if_hnvar.h b/sys/dev/hyperv/netvsc/if_hnvar.h index c0e17c9643e0..27d93db5395e 100644 --- a/sys/dev/hyperv/netvsc/if_hnvar.h +++ b/sys/dev/hyperv/netvsc/if_hnvar.h @@ -33,7 +33,7 @@ #define HN_CHIM_SIZE (15 * 1024 * 1024) -#define HN_RXBUF_SIZE (16 * 1024 * 1024) +#define HN_RXBUF_SIZE (31 * 1024 * 1024) #define HN_RXBUF_SIZE_COMPAT (15 * 1024 * 1024) #define HN_MTU_MAX (65535 - ETHER_ADDR_LEN) @@ -56,6 +56,20 @@ struct buf_ring; #endif struct hn_tx_ring; +#define HN_NVS_RSC_MAX 562 /* Max RSC frags in one vmbus packet */ + +struct hn_rx_rsc { + const uint32_t *vlan_info; + const uint32_t *csum_info; + const uint32_t *hash_info; + const uint32_t *hash_value; + uint32_t cnt; /* fragment count */ + uint32_t pktlen; /* full packet length */ + uint8_t is_last; /* last fragment */ + const void *frag_data[HN_NVS_RSC_MAX]; + uint32_t frag_len[HN_NVS_RSC_MAX]; +}; + struct hn_rx_ring { struct ifnet *hn_ifp; struct ifnet *hn_rxvf_ifp; /* SR-IOV VF for RX */ @@ -66,6 +80,7 @@ struct hn_rx_ring { uint32_t hn_mbuf_hash; /* NDIS_HASH_ */ uint8_t *hn_rxbuf; /* shadow sc->hn_rxbuf */ int hn_rx_idx; + struct hn_rx_rsc rsc; /* Trust csum verification on host side */ int hn_trust_hcsum; /* HN_TRUST_HCSUM_ */ @@ -80,6 +95,8 @@ struct hn_rx_ring { u_long hn_pkts; u_long hn_rss_pkts; u_long hn_ack_failed; + u_long hn_rsc_pkts; + u_long hn_rsc_drop; /* Rarely used stuffs */ struct sysctl_oid *hn_rx_sysctl_tree; diff --git a/sys/dev/hyperv/netvsc/ndis.h b/sys/dev/hyperv/netvsc/ndis.h index 32b6aa307452..c69da7807a63 100644 --- a/sys/dev/hyperv/netvsc/ndis.h +++ b/sys/dev/hyperv/netvsc/ndis.h @@ -115,8 +115,8 @@ struct ndis_offload_params { /* NDIS >= 6.30 */ uint8_t ndis_rsc_ip4; /* NDIS_OFFLOAD_RSC_ */ uint8_t ndis_rsc_ip6; /* NDIS_OFFLOAD_RSC_ */ - uint32_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ - uint32_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ + uint8_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ + uint8_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ }; #define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params) @@ -305,17 +305,17 @@ struct ndis_lsov2_offload { struct ndis_ipsecv2_offload { uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/ - uint16_t ndis_ip6; - uint16_t ndis_ip4opt; - uint16_t ndis_ip6ext; - uint16_t ndis_ah; - uint16_t ndis_esp; - uint16_t ndis_ah_esp; - uint16_t ndis_xport; - uint16_t ndis_tun; - uint16_t ndis_xport_tun; - uint16_t ndis_lso; - uint16_t ndis_extseq; + uint8_t ndis_ip6; + uint8_t ndis_ip4opt; + uint8_t ndis_ip6ext; + uint8_t ndis_ah; + uint8_t ndis_esp; + uint8_t ndis_ah_esp; + uint8_t ndis_xport; + uint8_t ndis_tun; + uint8_t ndis_xport_tun; + uint8_t ndis_lso; + uint8_t ndis_extseq; uint32_t ndis_udp_esp; uint32_t ndis_auth; uint32_t ndis_crypto; @@ -323,8 +323,8 @@ struct ndis_ipsecv2_offload { }; struct ndis_rsc_offload { - uint16_t ndis_ip4; - uint16_t ndis_ip6; + uint8_t ndis_ip4; + uint8_t ndis_ip6; }; struct ndis_encap_offload { @@ -419,5 +419,4 @@ struct ndis_offload { #define NDIS_TXCSUM_INFO_MKUDPCS(thoff) \ NDIS_TXCSUM_INFO_MKL4CS((thoff), NDIS_TXCSUM_INFO_UDPCS) - #endif /* !_NET_NDIS_H_ */ diff --git a/sys/net/rndis.h b/sys/net/rndis.h index 5d45469a4b52..56350dbb7824 100644 --- a/sys/net/rndis.h +++ b/sys/net/rndis.h @@ -142,7 +142,8 @@ struct rndis_packet_msg { /* Per-packet-info for RNDIS data message */ struct rndis_pktinfo { uint32_t rm_size; - uint32_t rm_type; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_type:31; /* NDIS_PKTINFO_TYPE_ */ + uint32_t rm_internal:1; /* Indicate if internal type */ uint32_t rm_pktinfooffset; uint8_t rm_data[]; }; @@ -165,6 +166,10 @@ struct rndis_pktinfo { #define NDIS_PKTINFO_TYPE_CACHE_NBLIST 10 #define NDIS_PKTINFO_TYPE_PKT_PAD 11 +/* Per-packet-info internal type */ +#define NDIS_PKTINFO_IT_PKTINFO_ID 1 +/* Add more internal type here */ + /* * RNDIS control messages */ From owner-dev-commits-src-all@freebsd.org Fri Mar 12 06:43:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A217857011E; Fri, 12 Mar 2021 06:43: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 4DxbqV4Bnpz4tNn; Fri, 12 Mar 2021 06:43: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 82A151344C; Fri, 12 Mar 2021 06:43: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 12C6hI05094151; Fri, 12 Mar 2021 06:43:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12C6hIRE094150; Fri, 12 Mar 2021 06:43:18 GMT (envelope-from git) Date: Fri, 12 Mar 2021 06:43:18 GMT Message-Id: <202103120643.12C6hIRE094150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: 6385cabd5be6 - main - Do not complain about incorrect cylinder group check-hashes when asked to add them to a filesystem. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6385cabd5be627c4f395e3abf215882aaeb36320 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 06:43:18 -0000 The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=6385cabd5be627c4f395e3abf215882aaeb36320 commit 6385cabd5be627c4f395e3abf215882aaeb36320 Author: Kirk McKusick AuthorDate: 2021-03-12 06:44:33 +0000 Commit: Kirk McKusick CommitDate: 2021-03-12 06:46:15 +0000 Do not complain about incorrect cylinder group check-hashes when asked to add them to a filesystem. MFC after: 3 days Sponsored by: Netflix --- sbin/fsck_ffs/fsutil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 77571deb38f4..127884400651 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -926,7 +926,8 @@ check_cgmagic(int cg, struct bufarea *cgbp, int request_rebuild) * Extended cylinder group checks. */ calchash = cgp->cg_ckhash; - if ((sblock.fs_metackhash & CK_CYLGRP) != 0) { + if ((sblock.fs_metackhash & CK_CYLGRP) != 0 && + (ckhashadd & CK_CYLGRP) == 0) { cghash = cgp->cg_ckhash; cgp->cg_ckhash = 0; calchash = calculate_crc32c(~0L, (void *)cgp, sblock.fs_cgsize); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9447C575961; Fri, 12 Mar 2021 11:32: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 4DxkDv3k9wz3Qy9; Fri, 12 Mar 2021 11:32: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 729CA17030; Fri, 12 Mar 2021 11:32: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 12CBWFCA077287; Fri, 12 Mar 2021 11:32:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWFPD077286; Fri, 12 Mar 2021 11:32:15 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:15 GMT Message-Id: <202103121132.12CBWFPD077286@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: 25aac48d2ce3 - main - simplify journal_mount: move the out label after success block 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: 25aac48d2ce322355e7890a1de0f045a15d1cc09 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=25aac48d2ce322355e7890a1de0f045a15d1cc09 commit 25aac48d2ce322355e7890a1de0f045a15d1cc09 Author: Konstantin Belousov AuthorDate: 2021-03-04 18:55:33 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:30:37 +0000 simplify journal_mount: move the out label after success block This removes the need to check for error == 0. Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_softdep.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 786fb43c7d81..e60ac2f6868b 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3016,26 +3016,26 @@ journal_mount(mp, fs, cred) jblocks->jb_low = jblocks->jb_free / 3; /* Reserve 33%. */ jblocks->jb_min = jblocks->jb_free / 10; /* Suspend at 10%. */ ump->softdep_jblocks = jblocks; -out: - if (error == 0) { - MNT_ILOCK(mp); - mp->mnt_flag |= MNT_SUJ; - mp->mnt_flag &= ~MNT_SOFTDEP; - MNT_IUNLOCK(mp); - /* - * Only validate the journal contents if the - * filesystem is clean, otherwise we write the logs - * but they'll never be used. If the filesystem was - * still dirty when we mounted it the journal is - * invalid and a new journal can only be valid if it - * starts from a clean mount. - */ - if (fs->fs_clean) { - DIP_SET(ip, i_modrev, fs->fs_mtime); - ip->i_flags |= IN_MODIFIED; - ffs_update(vp, 1); - } + + MNT_ILOCK(mp); + mp->mnt_flag |= MNT_SUJ; + mp->mnt_flag &= ~MNT_SOFTDEP; + MNT_IUNLOCK(mp); + + /* + * Only validate the journal contents if the + * filesystem is clean, otherwise we write the logs + * but they'll never be used. If the filesystem was + * still dirty when we mounted it the journal is + * invalid and a new journal can only be valid if it + * starts from a clean mount. + */ + if (fs->fs_clean) { + DIP_SET(ip, i_modrev, fs->fs_mtime); + ip->i_flags |= IN_MODIFIED; + ffs_update(vp, 1); } +out: vput(vp); return (error); } From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4232575962; Fri, 12 Mar 2021 11:32: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 4DxkDw4llLz3Qsc; Fri, 12 Mar 2021 11:32: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 96328170BD; Fri, 12 Mar 2021 11:32: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 12CBWGHZ077305; Fri, 12 Mar 2021 11:32:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWGuD077304; Fri, 12 Mar 2021 11:32:16 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:16 GMT Message-Id: <202103121132.12CBWGuD077304@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: fd97fa64638d - main - Add FFSV_FORCEINODEDEP flag for ffs_vgetf() 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: fd97fa64638d810b415af7afcc86634c9709ad12 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:16 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fd97fa64638d810b415af7afcc86634c9709ad12 commit fd97fa64638d810b415af7afcc86634c9709ad12 Author: Konstantin Belousov AuthorDate: 2021-03-03 17:40:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:30:38 +0000 Add FFSV_FORCEINODEDEP flag for ffs_vgetf() It will be used to allow SU flush code to sync the volume while external consumers see that SU is already disabled on the filesystem. Use it where ffs_vgetf() called by SU code to process dependencies. Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_extern.h | 1 + sys/ufs/ffs/ffs_softdep.c | 13 +++++++------ sys/ufs/ffs/ffs_vfsops.c | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 544012089046..62486941354e 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -127,6 +127,7 @@ int ffs_breadz(struct ufsmount *, struct vnode *, daddr_t, daddr_t, int, #define FFSV_FORCEINSMQ 0x0001 #define FFSV_REPLACE 0x0002 #define FFSV_REPLACE_DOOMED 0x0004 +#define FFSV_FORCEINODEDEP 0x0008 /* * Flags to ffs_reload diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index e60ac2f6868b..9c32a785a321 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1471,7 +1471,7 @@ get_parent_vp(struct vnode *vp, struct mount *mp, ino_t inum, struct buf *bp, ASSERT_VOP_ELOCKED(vp, "child vnode must be locked"); for (bplocked = true, pvp = NULL;;) { error = ffs_vgetf(mp, inum, LK_EXCLUSIVE | LK_NOWAIT, &pvp, - FFSV_FORCEINSMQ); + FFSV_FORCEINSMQ | FFSV_FORCEINODEDEP); if (error == 0) { /* * Since we could have unlocked vp, the inode @@ -1512,7 +1512,7 @@ get_parent_vp(struct vnode *vp, struct mount *mp, ino_t inum, struct buf *bp, VOP_UNLOCK(vp); error = ffs_vgetf(mp, inum, LK_EXCLUSIVE, &pvp, - FFSV_FORCEINSMQ); + FFSV_FORCEINSMQ | FFSV_FORCEINODEDEP); if (error != 0) { MPASS(error != ERELOOKUP); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); @@ -8387,7 +8387,7 @@ handle_complete_freeblocks(freeblks, flags) */ if (spare && freeblks->fb_len != 0) { if (ffs_vgetf(freeblks->fb_list.wk_mp, freeblks->fb_inum, - flags, &vp, FFSV_FORCEINSMQ) != 0) + flags, &vp, FFSV_FORCEINSMQ | FFSV_FORCEINODEDEP) != 0) return (EBUSY); ip = VTOI(vp); if (ip->i_mode == 0) { @@ -10177,7 +10177,8 @@ handle_workitem_remove(dirrem, flags) mp = dirrem->dm_list.wk_mp; ump = VFSTOUFS(mp); flags |= LK_EXCLUSIVE; - if (ffs_vgetf(mp, oldinum, flags, &vp, FFSV_FORCEINSMQ) != 0) + if (ffs_vgetf(mp, oldinum, flags, &vp, FFSV_FORCEINSMQ | + FFSV_FORCEINODEDEP) != 0) return (EBUSY); ip = VTOI(vp); MPASS(ip->i_mode != 0); @@ -14269,7 +14270,7 @@ clear_remove(mp) if (error != 0) goto finish_write; error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, - FFSV_FORCEINSMQ); + FFSV_FORCEINSMQ | FFSV_FORCEINODEDEP); vfs_unbusy(mp); if (error != 0) { softdep_error("clear_remove: vget", error); @@ -14349,7 +14350,7 @@ clear_inodedeps(mp) return; } if ((error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, - FFSV_FORCEINSMQ)) != 0) { + FFSV_FORCEINSMQ | FFSV_FORCEINODEDEP)) != 0) { softdep_error("clear_inodedeps: vget", error); vfs_unbusy(mp); vn_finished_write(mp); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 762874562082..f2bfe13cf89b 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -2074,7 +2074,8 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags) *vpp = NULL; return (error); } - if (DOINGSOFTDEP(vp)) + if (DOINGSOFTDEP(vp) && (!fs->fs_ronly || + (ffs_flags & FFSV_FORCEINODEDEP) != 0)) softdep_load_inodeblock(ip); else ip->i_effnlink = ip->i_nlink; From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EABB0575AF4; Fri, 12 Mar 2021 11:32: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 4DxkDx6DBvz3QWG; Fri, 12 Mar 2021 11:32: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 C5A7616C4B; Fri, 12 Mar 2021 11:32: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 12CBWHeH077324; Fri, 12 Mar 2021 11:32:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWH2T077323; Fri, 12 Mar 2021 11:32:17 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:17 GMT Message-Id: <202103121132.12CBWH2T077323@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: a285d3edacf6 - main - ffs_extern.h: Add comments for ffs_vgetf() flags 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: a285d3edacf602e555a918119d787d94f342fe90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:18 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a285d3edacf602e555a918119d787d94f342fe90 commit a285d3edacf602e555a918119d787d94f342fe90 Author: Konstantin Belousov AuthorDate: 2021-03-11 07:02:16 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:30:59 +0000 ffs_extern.h: Add comments for ffs_vgetf() flags Requested and reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_extern.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 62486941354e..7080edd21ab3 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -124,10 +124,12 @@ int ffs_breadz(struct ufsmount *, struct vnode *, daddr_t, daddr_t, int, /* * Flags to ffs_vgetf */ -#define FFSV_FORCEINSMQ 0x0001 -#define FFSV_REPLACE 0x0002 -#define FFSV_REPLACE_DOOMED 0x0004 -#define FFSV_FORCEINODEDEP 0x0008 +#define FFSV_FORCEINSMQ 0x0001 /* Force insertion into mount list */ +#define FFSV_REPLACE 0x0002 /* Replace existing vnode */ +#define FFSV_REPLACE_DOOMED 0x0004 /* Replace existing vnode if it is + doomed */ +#define FFSV_FORCEINODEDEP 0x0008 /* Force allocation of inodedep, ignore + MNT_SOFTDEP */ /* * Flags to ffs_reload From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F5A55759F4; Fri, 12 Mar 2021 11:32: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 4DxkDz6GJXz3QqY; Fri, 12 Mar 2021 11:32: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 09C2B170BE; Fri, 12 Mar 2021 11:32: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 12CBWIYa077346; Fri, 12 Mar 2021 11:32:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWItr077345; Fri, 12 Mar 2021 11:32:18 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:18 GMT Message-Id: <202103121132.12CBWItr077345@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: 81cdb19e04e5 - main - ffs softdep: clear ump->um_softdep on softdep_unmount() 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: 81cdb19e04e57a934e8a5dd76e5c7e0afcba1acb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:27 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=81cdb19e04e57a934e8a5dd76e5c7e0afcba1acb commit 81cdb19e04e57a934e8a5dd76e5c7e0afcba1acb Author: Konstantin Belousov AuthorDate: 2021-03-03 17:42:24 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:07 +0000 ffs softdep: clear ump->um_softdep on softdep_unmount() Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_softdep.c | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 9c32a785a321..c1a9c300aeff 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -2776,13 +2776,11 @@ softdep_unmount(mp) struct mount *mp; { struct ufsmount *ump; -#ifdef INVARIANTS - int i; -#endif + struct mount_softdeps *ums; - KASSERT(MOUNTEDSOFTDEP(mp) != 0, - ("softdep_unmount called on non-softdep filesystem")); ump = VFSTOUFS(mp); + KASSERT(ump->um_softdep != NULL, + ("softdep_unmount called on non-softdep filesystem")); MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_SOFTDEP; if (MOUNTEDSUJ(mp) == 0) { @@ -2805,30 +2803,37 @@ softdep_unmount(mp) KASSERT((ump->softdep_flags & FLUSH_EXIT) == 0, ("Thread shutdown failed")); } + /* - * Free up our resources. + * We are no longer have softdep structure attached to ump. */ + ums = ump->um_softdep; ACQUIRE_GBLLOCK(&lk); - TAILQ_REMOVE(&softdepmounts, ump->um_softdep, sd_next); + TAILQ_REMOVE(&softdepmounts, ums, sd_next); FREE_GBLLOCK(&lk); - rw_destroy(LOCK_PTR(ump)); - hashdestroy(ump->pagedep_hashtbl, M_PAGEDEP, ump->pagedep_hash_size); - hashdestroy(ump->inodedep_hashtbl, M_INODEDEP, ump->inodedep_hash_size); - hashdestroy(ump->newblk_hashtbl, M_NEWBLK, ump->newblk_hash_size); - hashdestroy(ump->bmsafemap_hashtbl, M_BMSAFEMAP, - ump->bmsafemap_hash_size); - free(ump->indir_hashtbl, M_FREEWORK); + ump->um_softdep = NULL; + + /* + * Free up our resources. + */ + rw_destroy(&ums->sd_fslock); + hashdestroy(ums->sd_pdhash, M_PAGEDEP, ums->sd_pdhashsize); + hashdestroy(ums->sd_idhash, M_INODEDEP, ums->sd_idhashsize); + hashdestroy(ums->sd_newblkhash, M_NEWBLK, ums->sd_newblkhashsize); + hashdestroy(ums->sd_bmhash, M_BMSAFEMAP, ums->sd_bmhashsize); + free(ums->sd_indirhash, M_FREEWORK); #ifdef INVARIANTS - for (i = 0; i <= D_LAST; i++) { - KASSERT(ump->softdep_curdeps[i] == 0, + for (int i = 0; i <= D_LAST; i++) { + KASSERT(ums->sd_curdeps[i] == 0, ("Unmount %s: Dep type %s != 0 (%ld)", ump->um_fs->fs_fsmnt, - TYPENAME(i), ump->softdep_curdeps[i])); - KASSERT(LIST_EMPTY(&ump->softdep_alldeps[i]), - ("Unmount %s: Dep type %s not empty (%p)", ump->um_fs->fs_fsmnt, - TYPENAME(i), LIST_FIRST(&ump->softdep_alldeps[i]))); + TYPENAME(i), ums->sd_curdeps[i])); + KASSERT(LIST_EMPTY(&ums->sd_alldeps[i]), + ("Unmount %s: Dep type %s not empty (%p)", + ump->um_fs->fs_fsmnt, + TYPENAME(i), LIST_FIRST(&ums->sd_alldeps[i]))); } #endif - free(ump->um_softdep, M_MOUNTDATA); + free(ums, M_MOUNTDATA); } static struct jblocks * From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC5AC575CA0; Fri, 12 Mar 2021 11: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 4DxkF50jzyz3Qp4; Fri, 12 Mar 2021 11:32: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 5705F17035; Fri, 12 Mar 2021 11:32: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 12CBWMAa077408; Fri, 12 Mar 2021 11:32:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWMbH077407; Fri, 12 Mar 2021 11:32:22 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:22 GMT Message-Id: <202103121132.12CBWMbH077407@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: fabbc3d879cc - main - softdep_flush(): do not access ump after we acked FLUSH_EXIT and unlocked SU lock 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: fabbc3d879cce5c37df25707107a0fcb64267346 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:27 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fabbc3d879cce5c37df25707107a0fcb64267346 commit fabbc3d879cce5c37df25707107a0fcb64267346 Author: Konstantin Belousov AuthorDate: 2021-02-28 22:45:04 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:08 +0000 softdep_flush(): do not access ump after we acked FLUSH_EXIT and unlocked SU lock otherwise we might follow a pointer in the freed memory. Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_softdep.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index af5b9f57b328..4e20652973b4 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1569,6 +1569,7 @@ softdep_flush(addr) struct mount *mp; struct thread *td; struct ufsmount *ump; + int cleanups; td = curthread; td->td_pflags |= TDP_NORUNNINGBUF; @@ -1603,10 +1604,14 @@ softdep_flush(addr) continue; } ump->softdep_flags &= ~FLUSH_EXIT; + cleanups = ump->um_softdep->sd_cleanups; FREE_LOCK(ump); wakeup(&ump->softdep_flags); - if (print_threads) - printf("Stop thread %s: searchfailed %d, did cleanups %d\n", td->td_name, searchfailed, ump->um_softdep->sd_cleanups); + if (print_threads) { + printf("Stop thread %s: searchfailed %d, " + "did cleanups %d\n", + td->td_name, searchfailed, cleanups); + } atomic_subtract_int(&stat_flush_threads, 1); kthread_exit(); panic("kthread_exit failed\n"); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26F5D575D01; Fri, 12 Mar 2021 11:32: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 4DxkF50xdlz3R4L; Fri, 12 Mar 2021 11:32: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 DF256171EA; Fri, 12 Mar 2021 11:32: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 12CBWJhD077368; Fri, 12 Mar 2021 11:32:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWJKM077367; Fri, 12 Mar 2021 11:32:19 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:19 GMT Message-Id: <202103121132.12CBWJKM077367@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: 7f682bdcabda - main - Rework MOUNTED/DOING SOFTDEP/SUJ macros 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: 7f682bdcabdaf95ded6a69994344ddbc84fd36db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:27 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7f682bdcabdaf95ded6a69994344ddbc84fd36db commit 7f682bdcabdaf95ded6a69994344ddbc84fd36db Author: Konstantin Belousov AuthorDate: 2021-03-03 17:43:17 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:07 +0000 Rework MOUNTED/DOING SOFTDEP/SUJ macros Now MNT_SOFTDEP indicates that SU are active in any variant +-J, and SU+J is indicated by MNT_SOFTDEP | MNT_SUJ combination. The reason is that unmount will be able to easily hide SU from other operations by clearing MNT_SOFTDEP while keeping the record of the active journal. Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_softdep.c | 1 - sys/ufs/ufs/inode.h | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index c1a9c300aeff..519a3679cac9 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -3024,7 +3024,6 @@ journal_mount(mp, fs, cred) MNT_ILOCK(mp); mp->mnt_flag |= MNT_SUJ; - mp->mnt_flag &= ~MNT_SOFTDEP; MNT_IUNLOCK(mp); /* diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index 0169d2903108..a82b4658c0af 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -265,11 +265,11 @@ struct indir { #define ITOV(ip) ((ip)->i_vnode) /* Determine if soft dependencies are being done */ -#define DOINGSOFTDEP(vp) \ - (((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) != 0) -#define MOUNTEDSOFTDEP(mp) (((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) != 0) -#define DOINGSUJ(vp) (((vp)->v_mount->mnt_flag & MNT_SUJ) != 0) -#define MOUNTEDSUJ(mp) (((mp)->mnt_flag & MNT_SUJ) != 0) +#define MOUNTEDSOFTDEP(mp) (((mp)->mnt_flag & MNT_SOFTDEP) != 0) +#define DOINGSOFTDEP(vp) MOUNTEDSOFTDEP((vp)->v_mount) +#define MOUNTEDSUJ(mp) (((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ)) == \ + (MNT_SOFTDEP | MNT_SUJ)) +#define DOINGSUJ(vp) MOUNTEDSUJ((vp)->v_mount) /* This overlays the fid structure (see mount.h). */ struct ufid { From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98423575CF4; Fri, 12 Mar 2021 11:32: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 4DxkF83Hhzz3Qwt; Fri, 12 Mar 2021 11:32: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 D5AF716C4D; Fri, 12 Mar 2021 11:32: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 12CBWQaN077492; Fri, 12 Mar 2021 11:32:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWQSD077491; Fri, 12 Mar 2021 11:32:26 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:26 GMT Message-Id: <202103121132.12CBWQSD077491@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: 7a8d4b4da69a - main - FFS: assign fully initialized struct mount_softdeps to um_softdep 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: 7a8d4b4da69af966bff4892acb2fd101a95a4848 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:28 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7a8d4b4da69af966bff4892acb2fd101a95a4848 commit 7a8d4b4da69af966bff4892acb2fd101a95a4848 Author: Konstantin Belousov AuthorDate: 2021-03-03 22:02:30 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:08 +0000 FFS: assign fully initialized struct mount_softdeps to um_softdep Other threads observing the non-NULL um_softdep can assume that it is safe to use it. This is important for ro->rw remounts where change from read-only to read-write status cannot be made atomic. Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_softdep.c | 68 ++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index cb0be9d21529..cd00181b3c21 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -2679,50 +2679,52 @@ softdep_mount(devvp, mp, fs, cred) u_int cyl, i; int error; + ump = VFSTOUFS(mp); + sdp = malloc(sizeof(struct mount_softdeps), M_MOUNTDATA, M_WAITOK | M_ZERO); - MNT_ILOCK(mp); - mp->mnt_flag = (mp->mnt_flag & ~MNT_ASYNC) | MNT_SOFTDEP; - if ((mp->mnt_kern_flag & MNTK_SOFTDEP) == 0) { - mp->mnt_kern_flag = (mp->mnt_kern_flag & ~MNTK_ASYNC) | - MNTK_SOFTDEP | MNTK_NOASYNC; - } - ump = VFSTOUFS(mp); - ump->um_softdep = sdp; - MNT_IUNLOCK(mp); - rw_init(LOCK_PTR(ump), "per-fs softdep"); + rw_init(&sdp->sd_fslock, "SUrw"); sdp->sd_ump = ump; - LIST_INIT(&ump->softdep_workitem_pending); - LIST_INIT(&ump->softdep_journal_pending); - TAILQ_INIT(&ump->softdep_unlinked); - LIST_INIT(&ump->softdep_dirtycg); - ump->softdep_worklist_tail = NULL; - ump->softdep_on_worklist = 0; - ump->softdep_deps = 0; - LIST_INIT(&ump->softdep_mkdirlisthd); - ump->pagedep_hashtbl = hashinit(desiredvnodes / 5, M_PAGEDEP, - &ump->pagedep_hash_size); - ump->pagedep_nextclean = 0; - ump->inodedep_hashtbl = hashinit(desiredvnodes, M_INODEDEP, - &ump->inodedep_hash_size); - ump->inodedep_nextclean = 0; - ump->newblk_hashtbl = hashinit(max_softdeps / 2, M_NEWBLK, - &ump->newblk_hash_size); - ump->bmsafemap_hashtbl = hashinit(1024, M_BMSAFEMAP, - &ump->bmsafemap_hash_size); + LIST_INIT(&sdp->sd_workitem_pending); + LIST_INIT(&sdp->sd_journal_pending); + TAILQ_INIT(&sdp->sd_unlinked); + LIST_INIT(&sdp->sd_dirtycg); + sdp->sd_worklist_tail = NULL; + sdp->sd_on_worklist = 0; + sdp->sd_deps = 0; + LIST_INIT(&sdp->sd_mkdirlisthd); + sdp->sd_pdhash = hashinit(desiredvnodes / 5, M_PAGEDEP, + &sdp->sd_pdhashsize); + sdp->sd_pdnextclean = 0; + sdp->sd_idhash = hashinit(desiredvnodes, M_INODEDEP, + &sdp->sd_idhashsize); + sdp->sd_idnextclean = 0; + sdp->sd_newblkhash = hashinit(max_softdeps / 2, M_NEWBLK, + &sdp->sd_newblkhashsize); + sdp->sd_bmhash = hashinit(1024, M_BMSAFEMAP, &sdp->sd_bmhashsize); i = 1 << (ffs(desiredvnodes / 10) - 1); - ump->indir_hashtbl = malloc(i * sizeof(struct indir_hashhead), + sdp->sd_indirhash = malloc(i * sizeof(struct indir_hashhead), M_FREEWORK, M_WAITOK); - ump->indir_hash_size = i - 1; - for (i = 0; i <= ump->indir_hash_size; i++) - TAILQ_INIT(&ump->indir_hashtbl[i]); + sdp->sd_indirhashsize = i - 1; + for (i = 0; i <= sdp->sd_indirhashsize; i++) + TAILQ_INIT(&sdp->sd_indirhash[i]); #ifdef INVARIANTS for (i = 0; i <= D_LAST; i++) - LIST_INIT(&ump->softdep_alldeps[i]); + LIST_INIT(&sdp->sd_alldeps[i]); #endif ACQUIRE_GBLLOCK(&lk); TAILQ_INSERT_TAIL(&softdepmounts, sdp, sd_next); FREE_GBLLOCK(&lk); + + ump->um_softdep = sdp; + MNT_ILOCK(mp); + mp->mnt_flag = (mp->mnt_flag & ~MNT_ASYNC) | MNT_SOFTDEP; + if ((mp->mnt_kern_flag & MNTK_SOFTDEP) == 0) { + mp->mnt_kern_flag = (mp->mnt_kern_flag & ~MNTK_ASYNC) | + MNTK_SOFTDEP | MNTK_NOASYNC; + } + MNT_IUNLOCK(mp); + if ((fs->fs_flags & FS_SUJ) && (error = journal_mount(mp, fs, cred)) != 0) { printf("Failed to start journal: %d\n", error); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1A16575C9D; Fri, 12 Mar 2021 11:32: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 4DxkF262dxz3QtF; Fri, 12 Mar 2021 11:32: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 4362117033; Fri, 12 Mar 2021 11:32: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 12CBWLBa077386; Fri, 12 Mar 2021 11:32:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWLmm077385; Fri, 12 Mar 2021 11:32:21 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:21 GMT Message-Id: <202103121132.12CBWLmm077385@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: 7c7a6681fab2 - main - ffs: clear MNT_SOFTDEP earlier when remounting rw to ro 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: 7c7a6681fab2c0453085d30424f479c0f766904d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:26 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7c7a6681fab2c0453085d30424f479c0f766904d commit 7c7a6681fab2c0453085d30424f479c0f766904d Author: Konstantin Belousov AuthorDate: 2021-02-28 18:55:35 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:07 +0000 ffs: clear MNT_SOFTDEP earlier when remounting rw to ro Suppose that we remount rw->ro and in parallel some reader tries to instantiate a vnode, e.g. during lookup. Suppose that softdep_unmount() already started, but we did not cleared the MNT_SOFTDEP flag yet. Then ffs_vgetf() calls into softdep_load_inodeblock() which accessed destroyed hashes and freed memory. Set/clear fs_ronly simultaneously (WRT to files flush) with MNT_SOFTDEP. It might be reasonable to move the change of fs_ronly to under MNT_ILOCK, but no readers take it. Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_softdep.c | 21 ++++++++++++--------- sys/ufs/ffs/ffs_vfsops.c | 28 +++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 519a3679cac9..af5b9f57b328 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1792,10 +1792,10 @@ softdep_process_worklist(mp, full) long starttime; KASSERT(mp != NULL, ("softdep_process_worklist: NULL mp")); - if (MOUNTEDSOFTDEP(mp) == 0) + ump = VFSTOUFS(mp); + if (ump->um_softdep == NULL) return (0); matchcnt = 0; - ump = VFSTOUFS(mp); ACQUIRE_LOCK(ump); starttime = time_second; softdep_process_journal(mp, NULL, full ? MNT_WAIT : 0); @@ -2134,6 +2134,8 @@ softdep_waitidle(struct mount *mp, int flags __unused) int error, i; ump = VFSTOUFS(mp); + KASSERT(ump->um_softdep != NULL, + ("softdep_waitidle called on non-softdep filesystem")); devvp = ump->um_devvp; td = curthread; error = 0; @@ -2171,14 +2173,15 @@ softdep_flushfiles(oldmnt, flags, td) int flags; struct thread *td; { -#ifdef QUOTA struct ufsmount *ump; +#ifdef QUOTA int i; #endif int error, early, depcount, loopcnt, retry_flush_count, retry; int morework; - KASSERT(MOUNTEDSOFTDEP(oldmnt) != 0, + ump = VFSTOUFS(oldmnt); + KASSERT(ump->um_softdep != NULL, ("softdep_flushfiles called on non-softdep filesystem")); loopcnt = 10; retry_flush_count = 3; @@ -2222,7 +2225,6 @@ retry_flush: MNT_ILOCK(oldmnt); morework = oldmnt->mnt_nvnodelistsize > 0; #ifdef QUOTA - ump = VFSTOUFS(oldmnt); UFS_LOCK(ump); for (i = 0; i < MAXQUOTAS; i++) { if (ump->um_quotas[i] != NULLVP) @@ -2783,7 +2785,7 @@ softdep_unmount(mp) ("softdep_unmount called on non-softdep filesystem")); MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_SOFTDEP; - if (MOUNTEDSUJ(mp) == 0) { + if ((mp->mnt_flag & MNT_SUJ) == 0) { MNT_IUNLOCK(mp); } else { mp->mnt_flag &= ~MNT_SUJ; @@ -3706,12 +3708,12 @@ softdep_process_journal(mp, needwk, flags) int off; int devbsize; - if (MOUNTEDSUJ(mp) == 0) + ump = VFSTOUFS(mp); + if (ump->um_softdep == NULL || ump->um_softdep->sd_jblocks == NULL) return; shouldflush = softdep_flushcache; bio = NULL; jseg = NULL; - ump = VFSTOUFS(mp); LOCK_OWNED(ump); fs = ump->um_fs; jblocks = ump->softdep_jblocks; @@ -14201,7 +14203,8 @@ check_clear_deps(mp) * causes deferred work to be done sooner. */ ump = VFSTOUFS(mp); - suj_susp = MOUNTEDSUJ(mp) && ump->softdep_jblocks->jb_suspended; + suj_susp = ump->um_softdep->sd_jblocks != NULL && + ump->softdep_jblocks->jb_suspended; if (req_clear_remove || req_clear_inodedeps || suj_susp) { FREE_LOCK(ump); softdep_send_speedup(ump, 0, BIO_SPEEDUP_TRIM | BIO_SPEEDUP_WRITE); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index f2bfe13cf89b..273d6e497955 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -380,6 +380,7 @@ ffs_mount(struct mount *mp) accmode_t accmode; struct nameidata ndp; char *fspec; + bool mounted_softdep; td = curthread; if (vfs_filteropt(mp->mnt_optnew, ffs_opts)) @@ -491,6 +492,16 @@ ffs_mount(struct mount *mp) error = vfs_write_suspend_umnt(mp); if (error != 0) return (error); + + fs->fs_ronly = 1; + if (MOUNTEDSOFTDEP(mp)) { + MNT_ILOCK(mp); + mp->mnt_flag &= ~MNT_SOFTDEP; + MNT_IUNLOCK(mp); + mounted_softdep = true; + } else + mounted_softdep = false; + /* * Check for and optionally get rid of files open * for writing. @@ -498,15 +509,22 @@ ffs_mount(struct mount *mp) flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; - if (MOUNTEDSOFTDEP(mp)) { + if (mounted_softdep) { error = softdep_flushfiles(mp, flags, td); } else { error = ffs_flushfiles(mp, flags, td); } if (error) { + fs->fs_ronly = 0; + if (mounted_softdep) { + MNT_ILOCK(mp); + mp->mnt_flag |= MNT_SOFTDEP; + MNT_IUNLOCK(mp); + } vfs_write_resume(mp, 0); return (error); } + if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) { printf("WARNING: %s Update error: blocks %jd " @@ -521,10 +539,15 @@ ffs_mount(struct mount *mp) if ((error = ffs_sbupdate(ump, MNT_WAIT, 0)) != 0) { fs->fs_ronly = 0; fs->fs_clean = 0; + if (mounted_softdep) { + MNT_ILOCK(mp); + mp->mnt_flag |= MNT_SOFTDEP; + MNT_IUNLOCK(mp); + } vfs_write_resume(mp, 0); return (error); } - if (MOUNTEDSOFTDEP(mp)) + if (mounted_softdep) softdep_unmount(mp); g_topology_lock(); /* @@ -532,7 +555,6 @@ ffs_mount(struct mount *mp) */ g_access(ump->um_cp, 0, -1, -1); g_topology_unlock(); - fs->fs_ronly = 1; MNT_ILOCK(mp); mp->mnt_flag |= MNT_RDONLY; MNT_IUNLOCK(mp); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B8E7575C10; Fri, 12 Mar 2021 11:32: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 4DxkF60VGrz3Qtn; Fri, 12 Mar 2021 11:32: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 7580816CBB; Fri, 12 Mar 2021 11:32: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 12CBWNbu077430; Fri, 12 Mar 2021 11:32:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWN1X077429; Fri, 12 Mar 2021 11:32:23 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:23 GMT Message-Id: <202103121132.12CBWN1X077429@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: d7e5e374167f - main - softdep_unmount: handle spurious wakeups 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: d7e5e374167fe98e998b80691824750f44bb050d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:27 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d7e5e374167fe98e998b80691824750f44bb050d commit d7e5e374167fe98e998b80691824750f44bb050d Author: Konstantin Belousov AuthorDate: 2021-02-28 22:46:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:08 +0000 softdep_unmount: handle spurious wakeups Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_softdep.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 4e20652973b4..cb0be9d21529 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -2805,10 +2805,13 @@ softdep_unmount(mp) ACQUIRE_LOCK(ump); ump->softdep_flags |= FLUSH_EXIT; wakeup(&ump->softdep_flushtd); - msleep(&ump->softdep_flags, LOCK_PTR(ump), PVM | PDROP, - "sdwait", 0); + while ((ump->softdep_flags & FLUSH_EXIT) != 0) { + msleep(&ump->softdep_flags, LOCK_PTR(ump), PVM, + "sdwait", 0); + } KASSERT((ump->softdep_flags & FLUSH_EXIT) == 0, ("Thread shutdown failed")); + FREE_LOCK(ump); } /* From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27B15575C2A; Fri, 12 Mar 2021 11:32: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 4DxkFD6SqBz3R6q; Fri, 12 Mar 2021 11:32: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 F305516C4E; Fri, 12 Mar 2021 11:32: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 12CBWRhv077512; Fri, 12 Mar 2021 11:32:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWRA3077511; Fri, 12 Mar 2021 11:32:27 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:27 GMT Message-Id: <202103121132.12CBWRA3077511@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: 0b3948e73b74 - main - softdep_unmount: assert that no dandling dependencies are left 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: 0b3948e73b749b0fefc3f9d4fc61f356542bb9b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:33 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0b3948e73b749b0fefc3f9d4fc61f356542bb9b9 commit 0b3948e73b749b0fefc3f9d4fc61f356542bb9b9 Author: Konstantin Belousov AuthorDate: 2021-03-06 09:52:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:08 +0000 softdep_unmount: assert that no dandling dependencies are left Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_softdep.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index cd00181b3c21..0091b5dcd3b8 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -2825,6 +2825,13 @@ softdep_unmount(mp) FREE_GBLLOCK(&lk); ump->um_softdep = NULL; + KASSERT(ums->sd_on_journal == 0, + ("ump %p ums %p on_journal %d", ump, ums, ums->sd_on_journal)); + KASSERT(ums->sd_on_worklist == 0, + ("ump %p ums %p on_worklist %d", ump, ums, ums->sd_on_worklist)); + KASSERT(ums->sd_deps == 0, + ("ump %p ums %p deps %d", ump, ums, ums->sd_deps)); + /* * Free up our resources. */ From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE61F575BBE; Fri, 12 Mar 2021 11:32: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 4DxkF749YJz3Qys; Fri, 12 Mar 2021 11:32: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 9FB8F16C4C; Fri, 12 Mar 2021 11:32: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 12CBWONY077448; Fri, 12 Mar 2021 11:32:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWOxe077447; Fri, 12 Mar 2021 11:32:24 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:24 GMT Message-Id: <202103121132.12CBWOxe077447@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: f776c54cee81 - main - ffs_mount: when remounting ro->rw and sbupdate failed, cleanup softdeps 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: f776c54cee81b4297b59ffe87a0f154e3924ee7f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:27 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f776c54cee81b4297b59ffe87a0f154e3924ee7f commit f776c54cee81b4297b59ffe87a0f154e3924ee7f Author: Konstantin Belousov AuthorDate: 2021-03-03 18:02:13 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:08 +0000 ffs_mount: when remounting ro->rw and sbupdate failed, cleanup softdeps Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_vfsops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 273d6e497955..584a20adb54d 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -645,6 +645,8 @@ ffs_mount(struct mount *mp) fs->fs_clean = 0; if ((error = ffs_sbupdate(ump, MNT_WAIT, 0)) != 0) { fs->fs_ronly = 1; + if ((fs->fs_flags & FS_DOSOFTDEP) != 0) + softdep_unmount(mp); MNT_ILOCK(mp); mp->mnt_flag |= saved_mnt_flag; MNT_IUNLOCK(mp); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 904E7575EA2; Fri, 12 Mar 2021 11:32: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 4DxkF831hRz3QpG; Fri, 12 Mar 2021 11:32: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 C293116CBC; Fri, 12 Mar 2021 11: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 12CBWPI1077470; Fri, 12 Mar 2021 11: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 12CBWPxG077469; Fri, 12 Mar 2021 11:32:25 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:25 GMT Message-Id: <202103121132.12CBWPxG077469@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: 2af934cc15bd - main - Assert that um_softdep is NULL on free(ump), i.e. softdep_unmount() was called 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: 2af934cc15bd8e7daa2daeb806321d0daddf3b7a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:28 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2af934cc15bd8e7daa2daeb806321d0daddf3b7a commit 2af934cc15bd8e7daa2daeb806321d0daddf3b7a Author: Konstantin Belousov AuthorDate: 2021-03-03 19:40:34 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:08 +0000 Assert that um_softdep is NULL on free(ump), i.e. softdep_unmount() was called Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/ufs/ffs/ffs_vfsops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 584a20adb54d..321ed03f7f67 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1355,6 +1355,7 @@ out: free(mp->mnt_gjprovider, M_UFSMNT); mp->mnt_gjprovider = NULL; } + MPASS(ump->um_softdep == NULL); free(ump, M_UFSMNT); mp->mnt_data = NULL; } @@ -1537,6 +1538,7 @@ ffs_unmount(mp, mntflags) UFS_UNLOCK(ump); if (MOUNTEDSOFTDEP(mp)) softdep_unmount(mp); + MPASS(ump->um_softdep == NULL); if (fs->fs_ronly == 0 || ump->um_fsckpid > 0) { fs->fs_clean = fs->fs_flags & (FS_UNCLEAN|FS_NEEDSFSCK) ? 0 : 1; error = ffs_sbupdate(ump, MNT_WAIT, 0); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:32:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC416575EB1; Fri, 12 Mar 2021 11:32: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 4DxkFF0cB2z3R4h; Fri, 12 Mar 2021 11:32: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 1EC83170C3; Fri, 12 Mar 2021 11:32: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 12CBWSer077532; Fri, 12 Mar 2021 11:32:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CBWS8f077531; Fri, 12 Mar 2021 11:32:28 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:28 GMT Message-Id: <202103121132.12CBWS8f077531@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: 44691b33cc99 - main - vlrureclaim: only skip vnode with resident pages if it own the pages 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: 44691b33cc99d0e17262368b6e0f64e531994a23 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:32:34 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=44691b33cc99d0e17262368b6e0f64e531994a23 commit 44691b33cc99d0e17262368b6e0f64e531994a23 Author: Konstantin Belousov AuthorDate: 2021-03-06 21:09:16 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:08 +0000 vlrureclaim: only skip vnode with resident pages if it own the pages Nullfs vnode which shares vm_object and pages with the lower vnode should not be exempt from the reclaim just because lower vnode cached a lot. Their reclamation is actually very cheap and should be preferred over real fs vnodes, but this change is already useful. Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/kern/vfs_subr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index c4772f691397..37e713ee48ea 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1169,7 +1169,7 @@ restart: VI_LOCK(vp); if (vp->v_usecount > 0 || (!reclaim_nc_src && !LIST_EMPTY(&vp->v_cache_src)) || - (vp->v_object != NULL && + (vp->v_object != NULL && vp->v_object->handle == vp && vp->v_object->resident_page_count > trigger)) { VOP_UNLOCK(vp); vdropl(vp); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:41:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22B295762F8; Fri, 12 Mar 2021 11:41: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 4DxkRS0Sbtz3jSF; Fri, 12 Mar 2021 11:41: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 3850B16CBD; Fri, 12 Mar 2021 11: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 12CBWUPP077554; Fri, 12 Mar 2021 11: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 12CBWUXL077553; Fri, 12 Mar 2021 11:32:30 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:32:30 GMT Message-Id: <202103121132.12CBWUXL077553@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: 16dea8341024 - main - null_vput_pair(): release use reference on dvp earlier 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: 16dea8341024b8ee8be619c27d4e63bd81bd9b6c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:41:24 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=16dea8341024b8ee8be619c27d4e63bd81bd9b6c commit 16dea8341024b8ee8be619c27d4e63bd81bd9b6c Author: Konstantin Belousov AuthorDate: 2021-03-07 21:08:38 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-12 11:31:08 +0000 null_vput_pair(): release use reference on dvp earlier We might own the last use reference, and then vrele() at the end would need to take the dvp vnode lock to inactivate, which causes deadlock with vp. We cannot vrele() dvp from start since this might unlock ldvp. Handle it by holding the vnode and dropping use ref after lowerfs VOP_VPUT_PAIR() ended. This effectivaly requires unlock of the vp vnode after VOP_VPUT_PAIR(), so the call is changed to set unlock_vp to true unconditionally. This opens more opportunities for vp to be reclaimed, if lvp is still alive we reinstantiate vp with null_nodeget(). Reported and tested by: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29178 --- sys/fs/nullfs/null_vnops.c | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 45065e0be7b5..bc0f5cdb7801 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -985,33 +985,50 @@ null_vput_pair(struct vop_vput_pair_args *ap) vpp = ap->a_vpp; vp = NULL; lvp = NULL; - if (vpp != NULL) { + mp = NULL; + if (vpp != NULL) vp = *vpp; - if (vp != NULL) { + if (vp != NULL) { + lvp = NULLVPTOLOWERVP(vp); + vref(lvp); + if (!ap->a_unlock_vp) { vhold(vp); + vhold(lvp); mp = vp->v_mount; - lvp = NULLVPTOLOWERVP(vp); - if (ap->a_unlock_vp) - vref(lvp); + vfs_ref(mp); } } - res = VOP_VPUT_PAIR(ldvp, &lvp, ap->a_unlock_vp); + res = VOP_VPUT_PAIR(ldvp, lvp != NULL ? &lvp : NULL, true); + if (vp != NULL && ap->a_unlock_vp) + vrele(vp); + vrele(dvp); + + if (vp == NULL || ap->a_unlock_vp) + return (res); - /* lvp might have been unlocked and vp reclaimed */ - if (vp != NULL) { - if (!ap->a_unlock_vp && vp->v_vnlock != lvp->v_vnlock) { + /* lvp has been unlocked and vp might be reclaimed */ + VOP_LOCK(vp, LK_EXCLUSIVE | LK_RETRY); + if (vp->v_data == NULL && vfs_busy(mp, MBF_NOWAIT) == 0) { + vput(vp); + vget(lvp, LK_EXCLUSIVE | LK_RETRY); + if (VN_IS_DOOMED(lvp)) { + vput(lvp); + vget(vp, LK_EXCLUSIVE | LK_RETRY); + } else { error = null_nodeget(mp, lvp, &vp1); if (error == 0) { - vput(vp); *vpp = vp1; + } else { + vget(vp, LK_EXCLUSIVE | LK_RETRY); } } - if (ap->a_unlock_vp) - vrele(vp); - vdrop(vp); + vfs_unbusy(mp); } - vrele(dvp); + vdrop(lvp); + vdrop(vp); + vfs_rel(mp); + return (res); } From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:58:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 988655769BA; Fri, 12 Mar 2021 11:58: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 4Dxkpm3lKSz3k6k; Fri, 12 Mar 2021 11: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 7369B17608; Fri, 12 Mar 2021 11: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 12CBw81O004483; Fri, 12 Mar 2021 11: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 12CBw8PY004482; Fri, 12 Mar 2021 11:58:08 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:58:08 GMT Message-Id: <202103121158.12CBw8PY004482@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: cada2b74b8d6 - main - Update doc links in README 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: cada2b74b8d670741643dca8e3d40c39d8fc7105 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:58:08 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=cada2b74b8d670741643dca8e3d40c39d8fc7105 commit cada2b74b8d670741643dca8e3d40c39d8fc7105 Author: Li-Wen Hsu AuthorDate: 2021-03-12 11:55:56 +0000 Commit: Li-Wen Hsu CommitDate: 2021-03-12 11:57:58 +0000 Update doc links in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e6899c7549e0..67428843ee20 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ For copyright information, please see [the file COPYRIGHT](COPYRIGHT) in this di Additional copyright information also exists for some sources in this tree - please see the specific source directories for more information. The Makefile in this directory supports a number of targets for building components (or all) of the FreeBSD source tree. -See build(7), config(8), [FreeBSD handbook on building userland](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html), and [Handbook for kernels](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html) for more information, including setting make(1) variables. +See build(7), config(8), [FreeBSD handbook on building userland](https://docs.freebsd.org/en/books/handbook/cutting-edge/#makeworld), and [Handbook for kernels](https://docs.freebsd.org/en/books/handbook/kernelconfig/) for more information, including setting make(1) variables. Source Roadmap: --------------- @@ -39,4 +39,4 @@ Source Roadmap: | usr.bin | User commands. | | usr.sbin | System administration commands. | -For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see [FreeBSD Handbook](https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/current-stable.html). +For information on synchronizing your source tree with one or more of the FreeBSD Project's development branches, please see [FreeBSD Handbook](https://docs.freebsd.org/en/books/handbook/cutting-edge/#current-stable). From owner-dev-commits-src-all@freebsd.org Fri Mar 12 11:58:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2572576CA0; Fri, 12 Mar 2021 11: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 4Dxkpn4hrZz3kW9; Fri, 12 Mar 2021 11: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 94133172E0; Fri, 12 Mar 2021 11: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 12CBw9PX004503; Fri, 12 Mar 2021 11: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 12CBw9JF004502; Fri, 12 Mar 2021 11:58:09 GMT (envelope-from git) Date: Fri, 12 Mar 2021 11:58:09 GMT Message-Id: <202103121158.12CBw9JF004502@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: aaf998056ed4 - main - Whitespace cleanup 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: aaf998056ed46c0dfb429e3e5cfe624c8aa4dec8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 11:58:09 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=aaf998056ed46c0dfb429e3e5cfe624c8aa4dec8 commit aaf998056ed46c0dfb429e3e5cfe624c8aa4dec8 Author: Li-Wen Hsu AuthorDate: 2021-03-12 11:57:30 +0000 Commit: Li-Wen Hsu CommitDate: 2021-03-12 11:57:58 +0000 Whitespace cleanup --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 67428843ee20..89972e866b61 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ See build(7), config(8), [FreeBSD handbook on building userland](https://docs.fr Source Roadmap: --------------- | Directory | Description | -| --------- | ------------ | +| --------- | ----------- | | bin | System/user commands. | | cddl | Various commands and libraries under the Common Development and Distribution License. | | contrib | Packages contributed by 3rd parties. | From owner-dev-commits-src-all@freebsd.org Fri Mar 12 12:00:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E70C55771F2; Fri, 12 Mar 2021 12:00:38 +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 4Dxksf0tyJz3kp5; Fri, 12 Mar 2021 12:00:37 +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 12CC0Tsp070045 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 12 Mar 2021 14:00:32 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12CC0Tsp070045 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12CC0SLD070042; Fri, 12 Mar 2021 14:00:28 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 12 Mar 2021 14:00:28 +0200 From: Konstantin Belousov To: Hans Petter Selasky Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . Message-ID: References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> <3dcd63b0-fe90-2855-f349-2117ca4b6b26@selasky.org> <8fe37b5e-29a7-ffeb-fddb-3b31a6e79ab0@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8fe37b5e-29a7-ffeb-fddb-3b31a6e79ab0@selasky.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: 4Dxksf0tyJz3kp5 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 12:00:39 -0000 On Thu, Mar 11, 2021 at 08:20:05PM +0100, Hans Petter Selasky wrote: > On 3/11/21 8:04 PM, Konstantin Belousov wrote: > > On Thu, Mar 11, 2021 at 07:41:53PM +0100, Hans Petter Selasky wrote: > > > On 3/11/21 7:35 PM, Konstantin Belousov wrote: > > > > And I dislike this. It is yet another case of introducing consumer-specific > > > > logic into core. Isn't netepoch example enough? > > > > > > > > I presented another patch to Hans, where task and mm allocations are > > > > switched to zones, and the zones have reserve applied. Then allocations > > > > from ithreads use the reserve. > > > > > > > > There is one detail there, reserve is finite, for x86 I set it to the > > > > total limit of interrupts. This somewhat breaks if interrupts are > > > > deallocated and reallocated, but I think it is good enough even with > > > > this wart. > > > > > > Hi, > > > > > > Your patch doesn't address the issue of initializing the pointers in > > > question once. Still, for every call, we need to check if the pointer is > > > valid. This is not neccessary. > > I do not understand what you are saying there. > > Which pointers? How does it not address? > > Hi, > > The current code calls linux_set_current() for every interrupt and timer > callback. That means we continue to check td_lkpi_task for NULL for every > one of these calls. Not strictly needed. And how this would change? The linux_set_current() calls are spread all over the linuxkpi code, so - you cannot eliminate them for interrupt thread context - they are already there anyway. What is your point? > > > > > > > > > Also I don't see why we need to create a own UMA zone for these simple > > > structures. Won't the per-CPU sysctl consume more memory than the actual > > > task structures being allocated? > > Dedicated UMA zone allows to gracefully solve the requirement of non-failing > > allocation in non-sleepable context. This is much simpler and cleaner than > > either trying to enumerate all existing ithreads or adding consumer-specific > > controls into generic kernel facility. > > > > Maybe I'm new to UMA zones. The M_USE_RESERVE can also be used with malloc() > ? Yes M_USE_RESERVE can be used on zones without reserve (like malloc zones), but it would have a different meaning. On allocation failure due to low memory, for zones with reserve, it means: - first look at reserve, and if nothing left, you are allowed to consume the last free page in the system For zones without reserve, it just allows to utilize the last free page. In other words, if you have a reserve in zone, alloc requests are guaranteed to not fail regardless of the free memory. From owner-dev-commits-src-all@freebsd.org Fri Mar 12 12:15:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB763577470; Fri, 12 Mar 2021 12:15: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 4DxlBs4TbRz3lsc; Fri, 12 Mar 2021 12:15: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 88EA3179E3; Fri, 12 Mar 2021 12:15: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 12CCFX6Z031169; Fri, 12 Mar 2021 12:15:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CCFXXD031168; Fri, 12 Mar 2021 12:15:33 GMT (envelope-from git) Date: Fri, 12 Mar 2021 12:15:33 GMT Message-Id: <202103121215.12CCFXXD031168@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: b8f7267d499c - main - uma: allow uma_zfree_pcu(..., NULL) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8f7267d499c8ef8e70b021879d3e9e087ecc32d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 12:15:33 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b8f7267d499c8ef8e70b021879d3e9e087ecc32d commit b8f7267d499c8ef8e70b021879d3e9e087ecc32d Author: Kristof Provost AuthorDate: 2021-03-10 14:11:59 +0000 Commit: Kristof Provost CommitDate: 2021-03-12 11:12:35 +0000 uma: allow uma_zfree_pcu(..., NULL) We already allow free(NULL) and uma_zfree(..., NULL). Make uma_zfree_pcpu(..., NULL) work as well. This also means that counter_u64_free(NULL) will work. These make cleanup code simpler. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29189 --- sys/vm/uma_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 8cbd1216678a..b1762500c147 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -3171,6 +3171,11 @@ uma_zfree_pcpu_arg(uma_zone_t zone, void *pcpu_item, void *udata) #ifdef SMP MPASS(zone->uz_flags & UMA_ZONE_PCPU); #endif + + /* uma_zfree_pcu_*(..., NULL) does nothing, to match free(9). */ + if (pcpu_item == NULL) + return; + item = zpcpu_offset_to_base(pcpu_item); uma_zfree_arg(zone, item, udata); } From owner-dev-commits-src-all@freebsd.org Fri Mar 12 12:15:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C86825779AC; Fri, 12 Mar 2021 12:15: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 4DxlBt5MV2z3lmC; Fri, 12 Mar 2021 12:15: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 AB073178CE; Fri, 12 Mar 2021 12:15: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 12CCFYkh031189; Fri, 12 Mar 2021 12:15:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CCFY0S031188; Fri, 12 Mar 2021 12:15:34 GMT (envelope-from git) Date: Fri, 12 Mar 2021 12:15:34 GMT Message-Id: <202103121215.12CCFY0S031188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 51dc8e7f6888 - main - Document that uma_zfree_pcpu() allows NULL now MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51dc8e7f688867e73eb7edc6bc65fdc77c9d5fff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 12:15:34 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=51dc8e7f688867e73eb7edc6bc65fdc77c9d5fff commit 51dc8e7f688867e73eb7edc6bc65fdc77c9d5fff Author: Kristof Provost AuthorDate: 2021-03-11 08:32:01 +0000 Commit: Kristof Provost CommitDate: 2021-03-12 11:12:35 +0000 Document that uma_zfree_pcpu() allows NULL now While here also document that for counter_u64_free(). Reviewed by: rpokala@ MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29215 --- share/man/man9/counter.9 | 7 +++++-- share/man/man9/zone.9 | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/share/man/man9/counter.9 b/share/man/man9/counter.9 index 1eb36b571249..04376ba9c994 100644 --- a/share/man/man9/counter.9 +++ b/share/man/man9/counter.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 6, 2020 +.Dd March 11, 2021 .Dt COUNTER 9 .Os .Sh NAME @@ -98,10 +98,13 @@ or .Va M_WAITOK . If .Va M_NOWAIT -is specified the operation may fail. +is specified the operation may fail and return +.Dv NULL . .It Fn counter_u64_free c Free the previously allocated counter .Fa c . +It is safe to pass +.Dv NULL . .It Fn counter_u64_add c v Add .Fa v diff --git a/share/man/man9/zone.9 b/share/man/man9/zone.9 index 91c965ff69ce..7da40b13469b 100644 --- a/share/man/man9/zone.9 +++ b/share/man/man9/zone.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 20, 2020 +.Dd March 11, 2021 .Dt UMA 9 .Os .Sh NAME @@ -385,6 +385,22 @@ specify an argument for the and .Dv dtor functions of the zone, respectively. +The variants +.Fn uma_zalloc_pcpu +and +.Fn uma_zfree_pcpu +allocate and free +.Va mp_ncpu +shadow copies as described for +.Dv UMA_ZONE_PCPU . +If +.Fa item +is +.Dv NULL , +then +.Fn uma_zfree_pcpu +does nothing. +.Pp The .Fn uma_zalloc_domain function allows callers to specify a fixed From owner-dev-commits-src-all@freebsd.org Fri Mar 12 12:15:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FCE05777D4; Fri, 12 Mar 2021 12:15: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 4DxlBw05n6z3lP1; Fri, 12 Mar 2021 12:15: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 D054817A4D; Fri, 12 Mar 2021 12:15: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 12CCFZrB031209; Fri, 12 Mar 2021 12:15:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CCFZYQ031208; Fri, 12 Mar 2021 12:15:35 GMT (envelope-from git) Date: Fri, 12 Mar 2021 12:15:35 GMT Message-Id: <202103121215.12CCFZYQ031208@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 28dc2c954f50 - main - pf: Simplify cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28dc2c954f5096ae594ed5cd7a83d66ce4bf1ded Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 12:15:36 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=28dc2c954f5096ae594ed5cd7a83d66ce4bf1ded commit 28dc2c954f5096ae594ed5cd7a83d66ce4bf1ded Author: Kristof Provost AuthorDate: 2021-03-10 14:15:16 +0000 Commit: Kristof Provost CommitDate: 2021-03-12 11:12:35 +0000 pf: Simplify cleanup We can now counter_u64_free(NULL), so remove the checks. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29190 --- sys/netpfil/pf/if_pfsync.c | 6 ++---- sys/netpfil/pf/pf.c | 12 ++++-------- sys/netpfil/pf/pf_if.c | 6 ++---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 1cdb365c98df..059300f6a6a7 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -624,10 +624,8 @@ cleanup: cleanup_state: /* pf_state_insert() frees the state keys. */ if (st) { for (int i = 0; i < 2; i++) { - if (st->packets[i] != NULL) - counter_u64_free(st->packets[i]); - if (st->bytes[i] != NULL) - counter_u64_free(st->bytes[i]); + counter_u64_free(st->packets[i]); + counter_u64_free(st->bytes[i]); } if (st->dst.scrub) uma_zfree(V_pf_state_scrub_z, st->dst.scrub); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index c131f810b0ec..f088f117b8e8 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -707,10 +707,8 @@ pf_free_src_node(struct pf_ksrc_node *sn) { for (int i = 0; i < 2; i++) { - if (sn->bytes[i]) - counter_u64_free(sn->bytes[i]); - if (sn->packets[i]) - counter_u64_free(sn->packets[i]); + counter_u64_free(sn->bytes[i]); + counter_u64_free(sn->packets[i]); } uma_zfree(V_pf_sources_z, sn); } @@ -1739,10 +1737,8 @@ pf_free_state(struct pf_state *cur) cur->timeout)); for (int i = 0; i < 2; i++) { - if (cur->bytes[i] != NULL) - counter_u64_free(cur->bytes[i]); - if (cur->packets[i] != NULL) - counter_u64_free(cur->packets[i]); + counter_u64_free(cur->bytes[i]); + counter_u64_free(cur->packets[i]); } pf_normalize_tcp_cleanup(cur); diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index e941e3a79b91..be290a1e1f2e 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -256,10 +256,8 @@ pf_kkif_free(struct pfi_kkif *kif) for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { - if (kif->pfik_packets[i][j][k]) - counter_u64_free(kif->pfik_packets[i][j][k]); - if (kif->pfik_bytes[i][j][k]) - counter_u64_free(kif->pfik_bytes[i][j][k]); + counter_u64_free(kif->pfik_packets[i][j][k]); + counter_u64_free(kif->pfik_bytes[i][j][k]); } } } From owner-dev-commits-src-all@freebsd.org Fri Mar 12 12:15:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A3FD5777D8; Fri, 12 Mar 2021 12:15: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 4DxlBx1rSRz3lPC; Fri, 12 Mar 2021 12:15: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 048071791B; Fri, 12 Mar 2021 12:15: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 12CCFaIU031228; Fri, 12 Mar 2021 12:15:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CCFaAg031227; Fri, 12 Mar 2021 12:15:36 GMT (envelope-from git) Date: Fri, 12 Mar 2021 12:15:36 GMT Message-Id: <202103121215.12CCFaAg031227@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: cecfaf9bede9 - main - pf: Fully remove interrupt events on vnet cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cecfaf9bede9665d6a10f1e575cd5d575450cff7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 12:15:39 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=cecfaf9bede9665d6a10f1e575cd5d575450cff7 commit cecfaf9bede9665d6a10f1e575cd5d575450cff7 Author: Kristof Provost AuthorDate: 2021-03-10 21:56:11 +0000 Commit: Kristof Provost CommitDate: 2021-03-12 11:12:43 +0000 pf: Fully remove interrupt events on vnet cleanup swi_remove() removes the software interrupt handler but does not remove the associated interrupt event. This is visible when creating and remove a vnet jail in `procstat -t 12`. We can remove it manually with intr_event_destroy(). PR: 254171 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29211 --- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/if_pfsync.c | 10 ++++++++-- sys/netpfil/pf/pf.c | 1 + sys/netpfil/pf/pf_ioctl.c | 8 ++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 31be6b7a833d..6102d6186cd2 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1390,6 +1390,8 @@ VNET_DECLARE(struct pf_srchash *, pf_srchash); VNET_DECLARE(void *, pf_swi_cookie); #define V_pf_swi_cookie VNET(pf_swi_cookie) +VNET_DECLARE(struct intr_event *, pf_swi_ie); +#define V_pf_swi_ie VNET(pf_swi_ie) VNET_DECLARE(uint64_t, pf_stateid[MAXCPU]); #define V_pf_stateid VNET(pf_stateid) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 059300f6a6a7..cf2ff2ef0926 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -254,6 +254,8 @@ VNET_DEFINE_STATIC(struct pfsync_softc *, pfsyncif) = NULL; #define V_pfsyncif VNET(pfsyncif) VNET_DEFINE_STATIC(void *, pfsync_swi_cookie) = NULL; #define V_pfsync_swi_cookie VNET(pfsync_swi_cookie) +VNET_DEFINE_STATIC(struct intr_event *, pfsync_swi_ie); +#define V_pfsync_swi_ie VNET(pfsync_swi_ie) VNET_DEFINE_STATIC(struct pfsyncstats, pfsyncstats); #define V_pfsyncstats VNET(pfsyncstats) VNET_DEFINE_STATIC(int, pfsync_carp_adj) = CARP_MAXSKEW; @@ -2472,7 +2474,7 @@ vnet_pfsync_init(const void *unused __unused) V_pfsync_cloner = if_clone_simple(pfsyncname, pfsync_clone_create, pfsync_clone_destroy, 1); - error = swi_add(NULL, pfsyncname, pfsyncintr, V_pfsyncif, + error = swi_add(&V_pfsync_swi_ie, pfsyncname, pfsyncintr, V_pfsyncif, SWI_NET, INTR_MPSAFE, &V_pfsync_swi_cookie); if (error) { if_clone_detach(V_pfsync_cloner); @@ -2487,11 +2489,15 @@ VNET_SYSINIT(vnet_pfsync_init, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY, static void vnet_pfsync_uninit(const void *unused __unused) { + int ret; pfsync_pointers_uninit(); if_clone_detach(V_pfsync_cloner); - swi_remove(V_pfsync_swi_cookie); + ret = swi_remove(V_pfsync_swi_cookie); + MPASS(ret == 0); + ret = intr_event_destroy(V_pfsync_swi_ie); + MPASS(ret == 0); } VNET_SYSUNINIT(vnet_pfsync_uninit, SI_SUB_PROTO_FIREWALL, SI_ORDER_FOURTH, diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index f088f117b8e8..752e8a7eef1a 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -388,6 +388,7 @@ SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RWTUN, &pf_ioctl_maxcount, 0, "Maximum number of tables, addresses, ... in a single ioctl() call"); VNET_DEFINE(void *, pf_swi_cookie); +VNET_DEFINE(struct intr_event *, pf_swi_ie); VNET_DEFINE(uint32_t, pf_hashseed); #define V_pf_hashseed VNET(pf_hashseed) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 977f0debacaa..c930a67ecf80 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -331,7 +331,7 @@ pfattach_vnet(void) for (int i = 0; i < SCNT_MAX; i++) V_pf_status.scounters[i] = counter_u64_alloc(M_WAITOK); - if (swi_add(NULL, "pf send", pf_intr, curvnet, SWI_NET, + if (swi_add(&V_pf_swi_ie, "pf send", pf_intr, curvnet, SWI_NET, INTR_MPSAFE, &V_pf_swi_cookie) != 0) /* XXXGL: leaked all above. */ return; @@ -4670,6 +4670,7 @@ pf_load(void) static void pf_unload_vnet(void) { + int ret; V_pf_vnet_active = 0; V_pf_status.running = 0; @@ -4679,7 +4680,10 @@ pf_unload_vnet(void) shutdown_pf(); PF_RULES_WUNLOCK(); - swi_remove(V_pf_swi_cookie); + ret = swi_remove(V_pf_swi_cookie); + MPASS(ret == 0); + ret = intr_event_destroy(V_pf_swi_ie); + MPASS(ret == 0); pf_unload_vnet_purge(); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 13:15:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54163578AD9; Fri, 12 Mar 2021 13:15:24 +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 4DxmWw1Gq6z3psq; Fri, 12 Mar 2021 13:15:23 +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 78A95260783; Fri, 12 Mar 2021 14:15:21 +0100 (CET) Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . To: Konstantin Belousov Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> <3dcd63b0-fe90-2855-f349-2117ca4b6b26@selasky.org> <8fe37b5e-29a7-ffeb-fddb-3b31a6e79ab0@selasky.org> From: Hans Petter Selasky Message-ID: Date: Fri, 12 Mar 2021 14:15:02 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DxmWw1Gq6z3psq 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 13:15:24 -0000 Hi, On 3/12/21 1:00 PM, Konstantin Belousov wrote: > On Thu, Mar 11, 2021 at 08:20:05PM +0100, Hans Petter Selasky wrote: ... > And how this would change? The linux_set_current() calls are spread all > over the linuxkpi code, so > - you cannot eliminate them for interrupt thread context Regular interrupt threads typically don't use the "current" or "task structure" at all. > - they are already there anyway. For user-space, yes. > What is your point? I still believe an own UMA zone is overkill for the purpose of task_struct . We could just pre-allocate these structures into a linked list, and dequeue these for interrupt threads only. Every time a new interrupt is allocated we allocate one more of these structures beforehand, and then we use that structure back when the ITHREAD flags is set in the thread structure, similar to what you are doing, except we don't use UMA zones. >> >>> >>>> >>>> Also I don't see why we need to create a own UMA zone for these simple >>>> structures. Won't the per-CPU sysctl consume more memory than the actual >>>> task structures being allocated? >>> Dedicated UMA zone allows to gracefully solve the requirement of non-failing >>> allocation in non-sleepable context. This is much simpler and cleaner than >>> either trying to enumerate all existing ithreads or adding consumer-specific >>> controls into generic kernel facility. >>> >> >> Maybe I'm new to UMA zones. The M_USE_RESERVE can also be used with malloc() >> ? > Yes M_USE_RESERVE can be used on zones without reserve (like malloc zones), > but it would have a different meaning. On allocation failure due to low > memory, for zones with reserve, it means: > - first look at reserve, and if nothing left, you are allowed to consume > the last free page in the system > For zones without reserve, it just allows to utilize the last free page. > In other words, if you have a reserve in zone, alloc requests are guaranteed > to not fail regardless of the free memory. OK. --HPS From owner-dev-commits-src-all@freebsd.org Fri Mar 12 13:21:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B057579210; Fri, 12 Mar 2021 13:21:53 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4DxmgN5cxhz3qB5; Fri, 12 Mar 2021 13:21:52 +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)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 491CF2602EC; Fri, 12 Mar 2021 14:21:45 +0100 (CET) Subject: Re: git: d1cbe7908986 - main - Allocating the LinuxKPI current structure from an interrupt thread must be done using the M_NOWAIT flag after 1ae20f7c70ea . From: Hans Petter Selasky To: Konstantin Belousov Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202103100952.12A9qRKR040117@gitrepo.freebsd.org> <2b1739ab-000c-ca28-5a59-0a3e19ef4591@selasky.org> <5aaa5f2a-a67d-a495-7f56-a6b31c2494c7@FreeBSD.org> <3dcd63b0-fe90-2855-f349-2117ca4b6b26@selasky.org> <8fe37b5e-29a7-ffeb-fddb-3b31a6e79ab0@selasky.org> Message-ID: Date: Fri, 12 Mar 2021 14:21:27 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DxmgN5cxhz3qB5 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; ARC_NA(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[2a01:4f8:c17:6c4b::2:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a01:4f8:c17:6c4b::2:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 13:21:53 -0000 On 3/12/21 2:15 PM, Hans Petter Selasky wrote: > We could just pre-allocate these structures into a linked list, and > dequeue these for interrupt threads only. Every time a new interrupt is > allocated we allocate one more of these structures beforehand, and then > we use that structure back when the ITHREAD flags is set in the thread > structure, similar to what you are doing, except we don't use UMA zones. Let's move the discussion over to the differential revision I've created so that we can agree on a solution. --HPS From owner-dev-commits-src-all@freebsd.org Fri Mar 12 15:34:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29CFD57CA93; Fri, 12 Mar 2021 15:34:41 +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 4Dxqcd0ktGz4S0r; Fri, 12 Mar 2021 15:34:41 +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 0827E1A48E; Fri, 12 Mar 2021 15:34:41 +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 12CFYec4093956; Fri, 12 Mar 2021 15:34:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CFYeiJ093955; Fri, 12 Mar 2021 15:34:40 GMT (envelope-from git) Date: Fri, 12 Mar 2021 15:34:40 GMT Message-Id: <202103121534.12CFYeiJ093955@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: 0dfbdd9fc269 - main - linux(4): make getcwd(2) return ERANGE instead of ENOMEM 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: 0dfbdd9fc269f0438ffcc31632d35234a90584ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 15:34:41 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=0dfbdd9fc269f0438ffcc31632d35234a90584ad commit 0dfbdd9fc269f0438ffcc31632d35234a90584ad Author: Edward Tomasz Napierala AuthorDate: 2021-03-12 15:31:37 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-12 15:31:45 +0000 linux(4): make getcwd(2) return ERANGE instead of ENOMEM For native FreeBSD binaries, the return value from __getcwd(2) doesn't really matter, as the libc wrapper takes over and returns the proper errno. PR: kern/254120 Reported By: Alex S Reviewed By: kib Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29217 --- sys/compat/linux/linux_getcwd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c index c39e69c4e707..4917641be5e5 100644 --- a/sys/compat/linux/linux_getcwd.c +++ b/sys/compat/linux/linux_getcwd.c @@ -74,6 +74,8 @@ linux_getcwd(struct thread *td, struct linux_getcwd_args *uap) buf = malloc(buflen, M_TEMP, M_WAITOK); error = vn_getcwd(buf, &retbuf, &buflen); + if (error == ENOMEM) + error = ERANGE; if (error == 0) { error = copyout(retbuf, uap->buf, buflen); if (error == 0) From owner-dev-commits-src-all@freebsd.org Fri Mar 12 15:47:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6A5157CD2C; Fri, 12 Mar 2021 15:47: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 4Dxqvv4HVDz4SSM; Fri, 12 Mar 2021 15:47: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 81D051A4AF; Fri, 12 Mar 2021 15:47: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 12CFltwi007719; Fri, 12 Mar 2021 15:47:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CFltjp007718; Fri, 12 Mar 2021 15:47:55 GMT (envelope-from git) Date: Fri, 12 Mar 2021 15:47:55 GMT Message-Id: <202103121547.12CFltjp007718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 88e531f38c24 - main - autofs: best effort to maintain mounttab and mountdtab MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88e531f38c2412bf030f4e8dd563efc45b70797e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 15:47:55 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=88e531f38c2412bf030f4e8dd563efc45b70797e commit 88e531f38c2412bf030f4e8dd563efc45b70797e Author: Robert Wing AuthorDate: 2021-02-17 07:51:38 +0000 Commit: Robert Wing CommitDate: 2021-03-12 15:41:55 +0000 autofs: best effort to maintain mounttab and mountdtab When an automounted filesystem is successfully unmounted, call rpc.umntall(8) with the -k flag. rpc.umntall(8) is used to clean up /var/db/mounttab on the client and /var/db/mountdtab on the server. This is only useful for NFSv3. PR: 251906 Reviewed by: trasz Differential Revision: https://reviews.freebsd.org/D27801 --- usr.sbin/autofs/automount.c | 2 ++ usr.sbin/autofs/autounmountd.c | 3 ++- usr.sbin/autofs/common.c | 13 +++++++++++++ usr.sbin/autofs/common.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/usr.sbin/autofs/automount.c b/usr.sbin/autofs/automount.c index e28129eee5b8..cd29c910bce2 100644 --- a/usr.sbin/autofs/automount.c +++ b/usr.sbin/autofs/automount.c @@ -80,6 +80,8 @@ unmount_by_statfs(const struct statfs *sb, bool force) free(fsid_str); if (error != 0) log_warn("cannot unmount %s", sb->f_mntonname); + else + rpc_umntall(); return (error); } diff --git a/usr.sbin/autofs/autounmountd.c b/usr.sbin/autofs/autounmountd.c index 7a4f04c0b848..57375f04d743 100644 --- a/usr.sbin/autofs/autounmountd.c +++ b/usr.sbin/autofs/autounmountd.c @@ -170,7 +170,8 @@ unmount_by_fsid(const fsid_t fsid, const char *mountpoint) log_warn("cannot unmount %s (%s)", mountpoint, fsid_str); } - } + } else + rpc_umntall(); free(fsid_str); diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c index 7c8df4205a86..4581e5c4f2f9 100644 --- a/usr.sbin/autofs/common.c +++ b/usr.sbin/autofs/common.c @@ -1204,6 +1204,19 @@ lesser_daemon(void) } } +/* + * Applicable to NFSv3 only, see rpc.umntall(8). + */ +void +rpc_umntall(void) +{ + FILE *f; + + f = auto_popen("rpc.umntall", "-k", NULL); + assert(f != NULL); + auto_pclose(f); +} + int main(int argc, char **argv) { diff --git a/usr.sbin/autofs/common.h b/usr.sbin/autofs/common.h index 34257c1caeff..e68a0be5f7c8 100644 --- a/usr.sbin/autofs/common.h +++ b/usr.sbin/autofs/common.h @@ -96,6 +96,7 @@ char *defined_expand(const char *string); void defined_init(void); void defined_parse_and_add(char *def); void lesser_daemon(void); +void rpc_umntall(void); int main_automount(int argc, char **argv); int main_automountd(int argc, char **argv); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 16:46:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A49A57E0E3; Fri, 12 Mar 2021 16:46: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 4DxsCt1hfmz4WXt; Fri, 12 Mar 2021 16:46: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 1E5991AD50; Fri, 12 Mar 2021 16:46: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 12CGknUP086546; Fri, 12 Mar 2021 16:46:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CGknFp086545; Fri, 12 Mar 2021 16:46:49 GMT (envelope-from git) Date: Fri, 12 Mar 2021 16:46:49 GMT Message-Id: <202103121646.12CGknFp086545@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brad Davis Subject: git: 81c6dfbf5608 - main - release: Move the vagrant.vmx config out to its own file to match vbox MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 81c6dfbf5608caebb22ded98beb8527099c8d918 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 16:46:50 -0000 The branch main has been updated by brd: URL: https://cgit.FreeBSD.org/src/commit/?id=81c6dfbf5608caebb22ded98beb8527099c8d918 commit 81c6dfbf5608caebb22ded98beb8527099c8d918 Author: Brad Davis AuthorDate: 2021-01-26 17:02:57 +0000 Commit: Brad Davis CommitDate: 2021-03-12 16:44:42 +0000 release: Move the vagrant.vmx config out to its own file to match vbox Silly to have all these echos and makes this easier to use in other tooling. Reviewed by: gjb (re) --- release/Makefile.vagrant | 34 ++-------------------------------- release/scripts/vagrant.vmx | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/release/Makefile.vagrant b/release/Makefile.vagrant index d49eedacb6c9..afbef8f2f3bf 100644 --- a/release/Makefile.vagrant +++ b/release/Makefile.vagrant @@ -101,37 +101,7 @@ vagrant-create-virtualbox-metadata: virtualbox/box.ovf virtualbox/box.ovf: ${.CURDIR}/scripts/box.ovf cp ${.ALLSRC} virtualbox/ -vmware/vagrant.vmx: - @(cd vmware && echo '.encoding = "UTF-8"' > vagrant.vmx) - @(cd vmware && echo 'bios.bootorder = "hdd,CDROM"' >> vagrant.vmx) - @(cd vmware && echo 'checkpoint.vmstate = ""' >> vagrant.vmx) - @(cd vmware && echo 'cleanshutdown = "TRUE"' >> vagrant.vmx) - @(cd vmware && echo 'config.version = "8"' >> vagrant.vmx) - @(cd vmware && echo 'displayname = "${VAGRANT_TARGET}"' >> vagrant.vmx) - @(cd vmware && echo 'ethernet0.addresstype = "generated"' >> vagrant.vmx) - @(cd vmware && echo 'ethernet0.bsdname = "en0"' >> vagrant.vmx) - @(cd vmware && echo 'ethernet0.connectiontype = "nat"' >> vagrant.vmx) - @(cd vmware && echo 'ethernet0.displayname = "Ethernet"' >> vagrant.vmx) - @(cd vmware && echo 'ethernet0.linkstatepropagation.enable = "FALSE"' >> vagrant.vmx) - @(cd vmware && echo 'ethernet0.pcislotnumber = "33"' >> vagrant.vmx) - @(cd vmware && echo 'ethernet0.present = "TRUE"' >> vagrant.vmx) - @(cd vmware && echo 'ethernet0.virtualdev = "e1000"' >> vagrant.vmx) - @(cd vmware && echo 'ethernet0.wakeonpcktrcv = "FALSE"' >> vagrant.vmx) - @(cd vmware && echo 'floppy0.present = "FALSE"' >> vagrant.vmx) - @(cd vmware && echo 'guestos = "freebsd-64"' >> vagrant.vmx) - @(cd vmware && echo 'gui.fullscreenatpoweron = "FALSE"' >> vagrant.vmx) - @(cd vmware && echo 'gui.viewmodeatpoweron = "windowed"' >> vagrant.vmx) - @(cd vmware && echo 'memsize = "512"' >> vagrant.vmx) - @(cd vmware && echo 'sound.startconnected = "FALSE"' >> vagrant.vmx) - @(cd vmware && echo 'softpoweroff = "TRUE"' >> vagrant.vmx) - @(cd vmware && echo 'scsi0.pcislotnumber = "16"' >> vagrant.vmx) - @(cd vmware && echo 'scsi0.present = "TRUE"' >> vagrant.vmx) - @(cd vmware && echo 'scsi0.virtualdev = "lsilogic"' >> vagrant.vmx) - @(cd vmware && echo 'scsi0:0.filename = "vagrant.vmdk"' >> vagrant.vmx) - @(cd vmware && echo 'scsi0:0.present = "TRUE"' >> vagrant.vmx) - @(cd vmware && echo 'tools.synctime = "TRUE"' >> vagrant.vmx) - @(cd vmware && echo 'usb.present = "FALSE"' >> vagrant.vmx) - @(cd vmware && echo 'virtualhw.productcompatibility = "hosted"' >> vagrant.vmx) - @(cd vmware && echo 'virtualhw.version = "9"' >> vagrant.vmx) +vmware/vagrant.vmx: ${.CURDIR}/scripts/vagrant.vmx + cp ${.ALLSRC} vmware/ vagrant-create-vmware-metadata: vmware/vagrant.vmx diff --git a/release/scripts/vagrant.vmx b/release/scripts/vagrant.vmx new file mode 100644 index 000000000000..3d4a77584832 --- /dev/null +++ b/release/scripts/vagrant.vmx @@ -0,0 +1,31 @@ +.encoding = "UTF-8" +bios.bootorder = "hdd,CDROM" +checkpoint.vmstate = "" +cleanshutdown = "TRUE" +config.version = "8" +displayname = "${VAGRANT_TARGET}" +ethernet0.addresstype = "generated" +ethernet0.bsdname = "en0" +ethernet0.connectiontype = "nat" +ethernet0.displayname = "Ethernet" +ethernet0.linkstatepropagation.enable = "FALSE" +ethernet0.pcislotnumber = "33" +ethernet0.present = "TRUE" +ethernet0.virtualdev = "e1000" +ethernet0.wakeonpcktrcv = "FALSE" +floppy0.present = "FALSE" +guestos = "freebsd-64" +gui.fullscreenatpoweron = "FALSE" +gui.viewmodeatpoweron = "windowed" +memsize = "512" +sound.startconnected = "FALSE" +softpoweroff = "TRUE" +scsi0.pcislotnumber = "16" +scsi0.present = "TRUE" +scsi0.virtualdev = "lsilogic" +scsi0:0.filename = "vagrant.vmdk" +scsi0:0.present = "TRUE" +tools.synctime = "TRUE" +usb.present = "FALSE" +virtualhw.productcompatibility = "hosted" +virtualhw.version = "9" From owner-dev-commits-src-all@freebsd.org Fri Mar 12 16:46:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 779D757E056; Fri, 12 Mar 2021 16:46: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 4DxsCv1lsqz4WXw; Fri, 12 Mar 2021 16:46: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 2F5041AD51; Fri, 12 Mar 2021 16:46: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 12CGkpDe086567; Fri, 12 Mar 2021 16:46:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CGkph0086566; Fri, 12 Mar 2021 16:46:51 GMT (envelope-from git) Date: Fri, 12 Mar 2021 16:46:51 GMT Message-Id: <202103121646.12CGkph0086566@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brad Davis Subject: git: b8e12d2d5c76 - main - Improve the wording for showing the brightness level MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brd X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8e12d2d5c760dbe8058b5a5d8bfabdeff4dbe29 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 16:46:51 -0000 The branch main has been updated by brd: URL: https://cgit.FreeBSD.org/src/commit/?id=b8e12d2d5c760dbe8058b5a5d8bfabdeff4dbe29 commit b8e12d2d5c760dbe8058b5a5d8bfabdeff4dbe29 Author: Brad Davis AuthorDate: 2021-03-12 16:43:33 +0000 Commit: Brad Davis CommitDate: 2021-03-12 16:45:14 +0000 Improve the wording for showing the brightness level Reviewed by: allanjude --- usr.bin/backlight/backlight.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/backlight/backlight.8 b/usr.bin/backlight/backlight.8 index ce2d0e4b0325..adcfe159a9c1 100644 --- a/usr.bin/backlight/backlight.8 +++ b/usr.bin/backlight/backlight.8 @@ -47,8 +47,8 @@ The .Nm utility can be used to configure brightness levels for registered backlights. .Pp -If call without any option it will print the current brightness level of the first -registered backlight. +Called without any arguments it will print the current brightness level +of the first registered backlight. .Pp The options are as follows: .Bl -tag -width "-f device" From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:30:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 262DD57ED2E; Fri, 12 Mar 2021 17:30: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 4DxtBn0dMfz4Ypr; Fri, 12 Mar 2021 17:30: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 089621B9AD; Fri, 12 Mar 2021 17:30: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 12CHUuux051535; Fri, 12 Mar 2021 17:30:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHUu9g051534; Fri, 12 Mar 2021 17:30:56 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:30:56 GMT Message-Id: <202103121730.12CHUu9g051534@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e46427de625a - stable/13 - acpi: Make nexus_acpi quiet on amd64 and i386 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e46427de625a16001c2cc678f4f562e12c6b74bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:30:57 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e46427de625a16001c2cc678f4f562e12c6b74bc commit e46427de625a16001c2cc678f4f562e12c6b74bc Author: Mark Johnston AuthorDate: 2021-03-05 17:53:30 +0000 Commit: Mark Johnston CommitDate: 2021-03-12 17:20:37 +0000 acpi: Make nexus_acpi quiet on amd64 and i386 Otherwise during attach newbus prints "nexus0", which is not very useful. The generic nexus device is already quiet, as is nexus_acpi on arm64. Sponsored by: The FreeBSD Foundation (cherry picked from commit 732b69c9f9c84408e7e680a93ab91ce76ffef2ce) --- sys/amd64/acpica/acpi_machdep.c | 2 +- sys/i386/acpica/acpi_machdep.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/amd64/acpica/acpi_machdep.c b/sys/amd64/acpica/acpi_machdep.c index 60e470d14cbb..7d8b303f6f16 100644 --- a/sys/amd64/acpica/acpi_machdep.c +++ b/sys/amd64/acpica/acpi_machdep.c @@ -262,7 +262,7 @@ nexus_acpi_probe(device_t dev) error = acpi_identify(); if (error) return (error); - + device_quiet(dev); return (BUS_PROBE_DEFAULT); } diff --git a/sys/i386/acpica/acpi_machdep.c b/sys/i386/acpica/acpi_machdep.c index 63efe4f520fd..e8810ac88009 100644 --- a/sys/i386/acpica/acpi_machdep.c +++ b/sys/i386/acpica/acpi_machdep.c @@ -280,7 +280,7 @@ nexus_acpi_probe(device_t dev) error = acpi_identify(); if (error) return (error); - + device_quiet(dev); return (BUS_PROBE_DEFAULT); } From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:30:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E41D57EF9A; Fri, 12 Mar 2021 17:30: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 4DxtBp0th5z4YvQ; Fri, 12 Mar 2021 17:30: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 119001B7C6; Fri, 12 Mar 2021 17:30: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 12CHUwcE051555; Fri, 12 Mar 2021 17:30:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHUwiu051554; Fri, 12 Mar 2021 17:30:58 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:30:58 GMT Message-Id: <202103121730.12CHUwiu051554@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5e7c99c005b3 - stable/13 - ktls: Hide initialization message behind bootverbose 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5e7c99c005b34f96ec0e5f8ad43935c87328291a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:30:58 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5e7c99c005b34f96ec0e5f8ad43935c87328291a commit 5e7c99c005b34f96ec0e5f8ad43935c87328291a Author: Mark Johnston AuthorDate: 2021-03-05 18:11:02 +0000 Commit: Mark Johnston CommitDate: 2021-03-12 17:20:47 +0000 ktls: Hide initialization message behind bootverbose We don't typically print anything when a subsystem initializes itself, and KTLS is currently disabled by default anyway. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29097 (cherry picked from commit 89b650872bba2e4bfbc94a200946b461ef69ae22) --- sys/kern/uipc_ktls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 26912e410239..a648d37cd60f 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -421,7 +421,8 @@ ktls_init(void *dummy __unused) } } - printf("KTLS: Initialized %d threads\n", ktls_number_threads); + if (bootverbose) + printf("KTLS: Initialized %d threads\n", ktls_number_threads); } SYSINIT(ktls, SI_SUB_SMP + 1, SI_ORDER_ANY, ktls_init, NULL); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:30:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E53B57EBC5; Fri, 12 Mar 2021 17:30: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 4DxtBq2c7lz4YyC; Fri, 12 Mar 2021 17:30: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 499701B9AE; Fri, 12 Mar 2021 17:30: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 12CHUxGc051576; Fri, 12 Mar 2021 17:30:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHUxDk051575; Fri, 12 Mar 2021 17:30:59 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:30:59 GMT Message-Id: <202103121730.12CHUxDk051575@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 2b0aa5833c26 - stable/13 - netmap: Stop printing a line to the dmesg in netmap_init() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b0aa5833c26b8a97f020ac39451de247ac6b4e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:30:59 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2b0aa5833c26b8a97f020ac39451de247ac6b4e9 commit 2b0aa5833c26b8a97f020ac39451de247ac6b4e9 Author: Mark Johnston AuthorDate: 2021-03-05 23:07:47 +0000 Commit: Mark Johnston CommitDate: 2021-03-12 17:20:59 +0000 netmap: Stop printing a line to the dmesg in netmap_init() netmap is compiled into the kernel by default so initialization was always reported, and netmap uses a formatting convention not used in the rest of the kernel. Reviewed by: vmaffione Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29099 (cherry picked from commit fef845097190f0ecb783d6c75a9398c4e4a4c0e1) --- sys/dev/netmap/netmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index b711e0d2497e..f37900712046 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -4347,7 +4347,9 @@ netmap_init(void) if (error) goto fail; +#if !defined(__FreeBSD__) || defined(KLD_MODULE) nm_prinf("netmap: loaded module"); +#endif return (0); fail: netmap_fini(); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:31:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F50457ECCA; Fri, 12 Mar 2021 17:31: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 4DxtBr30j4z4YmJ; Fri, 12 Mar 2021 17:31: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 57C251B4D6; Fri, 12 Mar 2021 17:31: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 12CHV0DK051598; Fri, 12 Mar 2021 17:31:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHV0VO051597; Fri, 12 Mar 2021 17:31:00 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:31:00 GMT Message-Id: <202103121731.12CHV0VO051597@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9788aa5e6bdb - stable/13 - opencrypto: Make cryptosoft attach silently 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9788aa5e6bdbe15dce27c647aa3a89de4a7031c0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:31:00 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9788aa5e6bdbe15dce27c647aa3a89de4a7031c0 commit 9788aa5e6bdbe15dce27c647aa3a89de4a7031c0 Author: Mark Johnston AuthorDate: 2021-03-05 18:11:25 +0000 Commit: Mark Johnston CommitDate: 2021-03-12 17:21:09 +0000 opencrypto: Make cryptosoft attach silently cryptosoft is always present and doesn't print any useful information when it attaches. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29098 (cherry picked from commit 4fc60fa9294f82c7f4e1a0e71f9a17794124217f) --- sys/opencrypto/cryptosoft.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index e5a1139039d0..60d1f60d6cc1 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1453,6 +1453,7 @@ static int swcr_probe(device_t dev) { device_set_desc(dev, "software crypto"); + device_quiet(dev); return (BUS_PROBE_NOWILDCARD); } From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:36:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B7C557F1F5; Fri, 12 Mar 2021 17:36: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 4DxtK136cKz4Zp6; Fri, 12 Mar 2021 17:36: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 534C21BB24; Fri, 12 Mar 2021 17:36: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 12CHaLsv052592; Fri, 12 Mar 2021 17:36:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHaLwi052591; Fri, 12 Mar 2021 17:36:21 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:36:21 GMT Message-Id: <202103121736.12CHaLwi052591@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: 34cc08e33698 - main - Save all fpcr/fpsr bits in the AArch64 fenv_t 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: 34cc08e336987a8ebc316595e3f552a4c09f1fd4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:36:21 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=34cc08e336987a8ebc316595e3f552a4c09f1fd4 commit 34cc08e336987a8ebc316595e3f552a4c09f1fd4 Author: Alex Richardson AuthorDate: 2021-03-12 17:01:37 +0000 Commit: Alex Richardson CommitDate: 2021-03-12 17:01:41 +0000 Save all fpcr/fpsr bits in the AArch64 fenv_t The existing code masked off all bits that it didn't know about. To be future-proof, we should save and restore the entire fpcr/fpsr registers. Additionally, the existing fesetenv() was incorrectly setting the rounding mode in fpsr instead of fpcr. This patch stores fpcr in the high 32 bits of fenv_t and fpsr in the low bits instead of trying to interleave them in a single 32-bit field. Technically, this is an ABI break if you re-compile parts of your code or pass a fenv_t between DSOs that were compiled with different versions of fenv.h. However, I believe we should fix this since the existing code was broken and passing fenv_t across DSOs should rarely happen. Reviewed By: andrew Differential Revision: https://reviews.freebsd.org/D29160 --- lib/msun/aarch64/fenv.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/msun/aarch64/fenv.h b/lib/msun/aarch64/fenv.h index 2bd29877e5dc..2a55db3a9545 100644 --- a/lib/msun/aarch64/fenv.h +++ b/lib/msun/aarch64/fenv.h @@ -35,6 +35,7 @@ #define __fenv_static static #endif +/* The high 32 bits contain fpcr, low 32 contain fpsr. */ typedef __uint64_t fenv_t; typedef __uint64_t fexcept_t; @@ -156,13 +157,12 @@ fesetround(int __round) __fenv_static inline int fegetenv(fenv_t *__envp) { - fenv_t __r; - - __mrs_fpcr(__r); - *__envp = __r & _ENABLE_MASK; + __uint64_t fpcr; + __uint64_t fpsr; - __mrs_fpsr(__r); - *__envp |= __r & (FE_ALL_EXCEPT | (_ROUND_MASK << _ROUND_SHIFT)); + __mrs_fpcr(fpcr); + __mrs_fpsr(fpsr); + *__envp = fpsr | (fpcr << 32); return (0); } @@ -173,12 +173,12 @@ feholdexcept(fenv_t *__envp) fenv_t __r; __mrs_fpcr(__r); - *__envp = __r & _ENABLE_MASK; + *__envp = __r << 32; __r &= ~(_ENABLE_MASK); __msr_fpcr(__r); __mrs_fpsr(__r); - *__envp |= __r & (FE_ALL_EXCEPT | (_ROUND_MASK << _ROUND_SHIFT)); + *__envp |= (__uint32_t)__r; __r &= ~(_ENABLE_MASK); __msr_fpsr(__r); return (0); @@ -188,8 +188,8 @@ __fenv_static inline int fesetenv(const fenv_t *__envp) { - __msr_fpcr((*__envp) & _ENABLE_MASK); - __msr_fpsr((*__envp) & (FE_ALL_EXCEPT | (_ROUND_MASK << _ROUND_SHIFT))); + __msr_fpcr((*__envp) >> 32); + __msr_fpsr((fenv_t)(__uint32_t)*__envp); return (0); } From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:36:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAD6C57F2A5; Fri, 12 Mar 2021 17:36: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 4DxtK23p5cz4ZcC; Fri, 12 Mar 2021 17:36: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 73C561BCF8; Fri, 12 Mar 2021 17:36: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 12CHaMUV052614; Fri, 12 Mar 2021 17:36:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHaMNh052613; Fri, 12 Mar 2021 17:36:22 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:36:22 GMT Message-Id: <202103121736.12CHaMNh052613@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: 8cf5812af4b7 - main - capsicum-test: Update for O_BENEATH removal 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: 8cf5812af4b7f4933983822ff8e1e9185818fbef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:36:22 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=8cf5812af4b7f4933983822ff8e1e9185818fbef commit 8cf5812af4b7f4933983822ff8e1e9185818fbef Author: Alex Richardson AuthorDate: 2021-03-12 17:12:10 +0000 Commit: Alex Richardson CommitDate: 2021-03-12 17:12:10 +0000 capsicum-test: Update for O_BENEATH removal Update the tests to check O_RESOLVE_BENEATH instead. If this looks reasonable, I'll try to upstream this change. This keeps a compat fallback for O_BENEATH since the Linux port still has/had O_BENEATH with "no .., no absolute paths" semantics. Test Plan: `/usr/tests/sys/capsicum/capsicum-test -u 977` passes and runs the O_RESOLVE_BENEATH tests. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D29016 --- contrib/capsicum-test/openat.cc | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/contrib/capsicum-test/openat.cc b/contrib/capsicum-test/openat.cc index 5447558cde89..e3f0c2a731f8 100644 --- a/contrib/capsicum-test/openat.cc +++ b/contrib/capsicum-test/openat.cc @@ -341,22 +341,26 @@ FORK_TEST_F(OpenatTest, InCapabilityMode) { EXPECT_OPENAT_FAIL_TRAVERSAL(sub_fd_, "/etc/passwd", O_RDONLY); } -#ifdef O_BENEATH +#if !defined(O_RESOLVE_BENEATH) && defined(O_BENEATH) +#define O_RESOLVE_BENEATH O_BENEATH +#endif + +#ifdef O_RESOLVE_BENEATH TEST_F(OpenatTest, WithFlag) { - CheckPolicing(O_BENEATH); + CheckPolicing(O_RESOLVE_BENEATH); // Check with AT_FDCWD. - EXPECT_OPEN_OK(openat(AT_FDCWD, "topfile", O_RDONLY|O_BENEATH)); - EXPECT_OPEN_OK(openat(AT_FDCWD, "subdir/bottomfile", O_RDONLY|O_BENEATH)); + EXPECT_OPEN_OK(openat(AT_FDCWD, "topfile", O_RDONLY|O_RESOLVE_BENEATH)); + EXPECT_OPEN_OK(openat(AT_FDCWD, "subdir/bottomfile", O_RDONLY|O_RESOLVE_BENEATH)); - // Can't open paths starting with "/" with O_BENEATH specified. - EXPECT_OPENAT_FAIL_TRAVERSAL(AT_FDCWD, "/etc/passwd", O_RDONLY|O_BENEATH); - EXPECT_OPENAT_FAIL_TRAVERSAL(dir_fd_, "/etc/passwd", O_RDONLY|O_BENEATH); - EXPECT_OPENAT_FAIL_TRAVERSAL(sub_fd_, "/etc/passwd", O_RDONLY|O_BENEATH); + // Can't open paths starting with "/" with O_RESOLVE_BENEATH specified. + EXPECT_OPENAT_FAIL_TRAVERSAL(AT_FDCWD, "/etc/passwd", O_RDONLY|O_RESOLVE_BENEATH); + EXPECT_OPENAT_FAIL_TRAVERSAL(dir_fd_, "/etc/passwd", O_RDONLY|O_RESOLVE_BENEATH); + EXPECT_OPENAT_FAIL_TRAVERSAL(sub_fd_, "/etc/passwd", O_RDONLY|O_RESOLVE_BENEATH); } FORK_TEST_F(OpenatTest, WithFlagInCapabilityMode) { EXPECT_OK(cap_enter()); // Enter capability mode - CheckPolicing(O_BENEATH); + CheckPolicing(O_RESOLVE_BENEATH); } #endif From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:36:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E866157F040; Fri, 12 Mar 2021 17:36: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 4DxtK34xjRz4ZWY; Fri, 12 Mar 2021 17:36: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 97B351BD0B; Fri, 12 Mar 2021 17:36: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 12CHaNd6052633; Fri, 12 Mar 2021 17:36:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHaNXr052632; Fri, 12 Mar 2021 17:36:23 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:36:23 GMT Message-Id: <202103121736.12CHaNXr052632@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: fe525d3f9166 - main - Allow using sanitizers for ssp tests with out-of-tree compiler 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: fe525d3f916602ddac3286641dab8f5e274daa44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:36:24 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=fe525d3f916602ddac3286641dab8f5e274daa44 commit fe525d3f916602ddac3286641dab8f5e274daa44 Author: Alex Richardson AuthorDate: 2021-03-12 17:15:00 +0000 Commit: Alex Richardson CommitDate: 2021-03-12 17:15:33 +0000 Allow using sanitizers for ssp tests with out-of-tree compiler With an out-of-tree Clang, we can use the -resource-dir flag when linking to point it at the runtime libraries from the current SYSROOT. This moves the path to the clang-internal library directory to a separate .mk file that can be used by Makefiles that want to find the sanitizer libraries. I intend to re-use this .mk file for my upcoming changes that allow building the entire base system with ASAN/UBSAN/MSAN. Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D28852 --- lib/libc/tests/ssp/Makefile | 27 ++++++++++++--------------- lib/libclang_rt/Makefile.inc | 12 ++---------- lib/libclang_rt/compiler-rt-vars.mk | 24 ++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile index 655130ab309d..452c57246e39 100644 --- a/lib/libc/tests/ssp/Makefile +++ b/lib/libc/tests/ssp/Makefile @@ -6,9 +6,10 @@ MK_WERROR= no WARNS?= 2 CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector -.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc" -# Only use -fsanitize=bounds when using the in-tree compiler. Otherwise -# we may link to a sanitizer library targeted at a newer kernel/libc. +.if ${COMPILER_TYPE} == "clang" +# Only use -fsanitize=bounds when using clang. Otherwise we are not able to +# override the sanitizer runtime libraries to be the ones installed on the +# target system. CFLAGS.h_raw+= -fsanitize=bounds .elif ${COMPILER_TYPE} == "gcc" CFLAGS.h_raw+= --param ssp-buffer-size=1 @@ -25,24 +26,20 @@ PROGS+= h_getcwd PROGS+= h_memcpy PROGS+= h_memmove PROGS+= h_memset -# This testcase doesn't run properly when not compiled with -fsantize=bounds -# with clang, which is currently contingent on a compiler_rt update -# # XXX: the h_raw/h_read testcases don't cause a SIGABRT with in-tree gcc right # now on amd64 when it trips the stack bounds specified in t_ssp.sh . This # probably needs to be fixed as it's currently hardcoded. -# -# sanitizer is not tested or supported for ARM right now. sbruno -.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc" && !defined(_SKIP_BUILD) && \ +.if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \ (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw") -.if !defined(_CLANG_RESOURCE_DIR) -_CLANG_RESOURCE_DIR!= ${CC:N${CCACHE_BIN}} -print-resource-dir -.export _CLANG_RESOURCE_DIR -.endif -_libclang_rt_arch= ${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/} -_libclang_rt_ubsan= ${_CLANG_RESOURCE_DIR}/lib/freebsd/libclang_rt.ubsan_standalone-${_libclang_rt_arch}.a +.include "${SRCTOP}/lib/libclang_rt/compiler-rt-vars.mk" +_libclang_rt_ubsan= ${SYSROOT}${SANITIZER_LIBDIR}/libclang_rt.ubsan_standalone-${CRTARCH}.a .if exists(${_libclang_rt_ubsan}) PROGS+= h_raw +LDADD.h_raw+= ${SANITIZER_LDFLAGS} +.else +.if make(all) +.info "Could not find runtime library ${_libclang_rt_ubsan}, skipping h_raw" +.endif .endif .endif PROGS+= h_read diff --git a/lib/libclang_rt/Makefile.inc b/lib/libclang_rt/Makefile.inc index 01bfd72b5a7e..946d3f4c77a7 100644 --- a/lib/libclang_rt/Makefile.inc +++ b/lib/libclang_rt/Makefile.inc @@ -2,20 +2,12 @@ .include -# armv[67] is a bit special since we allow a soft-floating version via -# CPUTYPE matching *soft*. This variant may not actually work though. -.if ${MACHINE_ARCH:Marmv[67]*} != "" && \ - (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") -CRTARCH?= armhf -.else -CRTARCH?= ${MACHINE_ARCH:C/amd64/x86_64/} -.endif CRTSRC= ${SRCTOP}/contrib/llvm-project/compiler-rt +.include "compiler-rt-vars.mk" .PATH: ${CRTSRC}/lib -CLANGDIR= /usr/lib/clang/11.0.1 -LIBDIR= ${CLANGDIR}/lib/freebsd +LIBDIR= ${SANITIZER_LIBDIR} SHLIBDIR= ${LIBDIR} NO_PIC= diff --git a/lib/libclang_rt/compiler-rt-vars.mk b/lib/libclang_rt/compiler-rt-vars.mk new file mode 100644 index 000000000000..17424785c372 --- /dev/null +++ b/lib/libclang_rt/compiler-rt-vars.mk @@ -0,0 +1,24 @@ +CLANG_SUBDIR=clang/11.0.1 +CLANGDIR= /usr/lib/${CLANG_SUBDIR} +SANITIZER_LIBDIR= ${CLANGDIR}/lib/freebsd + +# armv[67] is a bit special since we allow a soft-floating version via +# CPUTYPE matching *soft*. This variant may not actually work though. +.if ${MACHINE_ARCH:Marmv[67]*} != "" && \ + (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") +CRTARCH?= armhf +.else +CRTARCH?= ${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/} +.endif + +.if ${COMPILER_TYPE} == "clang" +# The only way to set the path to the sanitizer libraries with clang is to +# override the resource directory. +# Note: lib/freebsd is automatically appended to the -resource-dir value. +SANITIZER_LDFLAGS= -resource-dir=${SYSROOT}${CLANGDIR} +# Also set RPATH to ensure that the dynamically linked runtime libs are found. +SANITIZER_LDFLAGS+= -Wl,--enable-new-dtags +SANITIZER_LDFLAGS+= -Wl,-rpath,${SANITIZER_LIBDIR} +.else +.error "Unknown link flags for -fsanitize=... COMPILER_TYPE=${COMPILER_TYPE}" +.endif From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:36:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43A2457F400; Fri, 12 Mar 2021 17:36: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 4DxtK769S7z4Zw3; Fri, 12 Mar 2021 17:36: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 D97861BD0C; Fri, 12 Mar 2021 17:36: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 12CHaOFX052655; Fri, 12 Mar 2021 17:36:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHaOkI052654; Fri, 12 Mar 2021 17:36:24 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:36:24 GMT Message-Id: <202103121736.12CHaOkI052654@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: 65f4ff4e68af - main - tests/sys/netgraph/ng_macfilter_test: Fix invalid TAP output 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: 65f4ff4e68afc3867781dfc8cd4faf2a8be1c74f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:36:31 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=65f4ff4e68afc3867781dfc8cd4faf2a8be1c74f commit 65f4ff4e68afc3867781dfc8cd4faf2a8be1c74f Author: Alex Richardson AuthorDate: 2021-03-12 17:35:24 +0000 Commit: Alex Richardson CommitDate: 2021-03-12 17:35:26 +0000 tests/sys/netgraph/ng_macfilter_test: Fix invalid TAP output This should allow the test to pass in Jenkins. Testing it locally now reports "passed" instead of "invalid TAP data". While touching this file also fix some shellcheck warnings that were pointed out by my IDE. Reviewed By: lwhsu, afedorov Differential Revision: https://reviews.freebsd.org/D29054 --- tests/sys/netgraph/ng_macfilter_test.sh | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/sys/netgraph/ng_macfilter_test.sh b/tests/sys/netgraph/ng_macfilter_test.sh index 56e201094bcc..269de3e130aa 100755 --- a/tests/sys/netgraph/ng_macfilter_test.sh +++ b/tests/sys/netgraph/ng_macfilter_test.sh @@ -45,7 +45,7 @@ find_iface () { loaded_modules='' load_modules () { - for kmod in $*; do + for kmod in "$@"; do if ! kldstat -q -m $kmod; then test_comment "Loading $kmod..." kldload $kmod @@ -96,16 +96,16 @@ TSTNR=0 TSTFAILS=0 TSTSUCCS=0 -_test_next () { TSTNR=$(($TSTNR + 1)); } -_test_succ () { TSTSUCCS=$(($TSTSUCCS + 1)); } -_test_fail () { TSTFAILS=$(($TSTFAILS + 1)); } +_test_next () { TSTNR=$((TSTNR + 1)); } +_test_succ () { TSTSUCCS=$((TSTSUCCS + 1)); } +_test_fail () { TSTFAILS=$((TSTFAILS + 1)); } test_cnt () { echo "1..${1:-$TSTNR}"; } test_title () { local msg="$1" printf '### %s ' "$msg" - printf '#%.0s' `seq $((80 - ${#msg} - 5))` + printf '#%.0s' $(seq $((80 - ${#msg} - 5))) printf "\n" } test_comment () { echo "# $1"; } @@ -229,7 +229,8 @@ trap 'cleanup' EXIT created_hooks=$(gethooks) rc=0 -test_cnt +# Update this number when adding new tests +test_cnt 46 ################################################################################ @@ -244,12 +245,12 @@ test_failure "duplicate connect of default hook" ################################################################################ test_title "Test: Add and remove hooks" -ngctl connect MF: O2M: xxx1 many$(($HOOKS + 1)) -test_success "connect MF:xxx1 to O2M:many$(($HOOKS + 1))" -ngctl connect MF: O2M: xxx2 many$(($HOOKS + 2)) -test_success "connect MF:xxx2 to O2M:many$(($HOOKS + 2))" -ngctl connect MF: O2M: xxx3 many$(($HOOKS + 3)) -test_success "connect MF:xxx3 to O2M:many$(($HOOKS + 3))" +ngctl connect MF: O2M: xxx1 many$((HOOKS + 1)) +test_success "connect MF:xxx1 to O2M:many$((HOOKS + 1))" +ngctl connect MF: O2M: xxx2 many$((HOOKS + 2)) +test_success "connect MF:xxx2 to O2M:many$((HOOKS + 2))" +ngctl connect MF: O2M: xxx3 many$((HOOKS + 3)) +test_success "connect MF:xxx3 to O2M:many$((HOOKS + 3))" hooks=$(gethooks) test_eq $created_hooks:xxx1:xxx2:xxx3 $hooks 'hooks after adding xxx1-3' @@ -273,7 +274,7 @@ test_title "Test: Add many hooks" added_hooks="" for i in $(seq 10 1 $HOOKSADD); do added_hooks="$added_hooks:xxx$i" - ngctl connect MF: O2M: xxx$i many$(($HOOKS + $i)) + ngctl connect MF: O2M: xxx$i many$((HOOKS + i)) done hooks=$(gethooks) test_eq $created_hooks$added_hooks $hooks 'hooks after adding many hooks' @@ -291,21 +292,21 @@ test_bail_on_fail test_title "Test: Adding many MACs..." I=1 for i in $(seq $ITERATIONS | sort -R); do - test_comment "Iteration $I/$iterations..." + test_comment "Iteration $I/$ITERATIONS..." for j in $(seq 0 1 $SUBITERATIONS); do test $i = 2 && edge='out2' || edge='out1' ether=$(genmac $j $i) ngctl msg MF: 'direct' "{ hookname=\"$edge\" ether=$ether }" done - I=$(($I + 1)) + I=$((I + 1)) done n=$(countmacs out1) -n2=$(( ( $ITERATIONS - 1 ) * ( $SUBITERATIONS + 1 ) )) +n2=$(( ( ITERATIONS - 1 ) * ( SUBITERATIONS + 1 ) )) test_eq $n $n2 'MACs in table for out1' n=$(countmacs out2) -n2=$(( 1 * ( $SUBITERATIONS + 1 ) )) +n2=$(( 1 * ( SUBITERATIONS + 1 ) )) test_eq $n $n2 'MACs in table for out2' n=$(countmacs out3) n2=0 @@ -324,10 +325,10 @@ for i in $(seq $ITERATIONS); do done n=$(countmacs out1) -n2=$(( ( $ITERATIONS - 1 ) * ( $SUBITERATIONS + 1 - 1 ) )) +n2=$(( ( ITERATIONS - 1 ) * ( SUBITERATIONS + 1 - 1 ) )) test_eq $n $n2 'MACs in table for out1' n=$(countmacs out2) -n2=$(( 1 * ( $SUBITERATIONS + 1 - 1 ) )) +n2=$(( 1 * ( SUBITERATIONS + 1 - 1 ) )) test_eq $n $n2 'MACs in table for out2' n=$(countmacs out3) n2=$ITERATIONS @@ -340,7 +341,7 @@ test_bail_on_fail test_title "Test: Removing all MACs one by one..." I=1 for i in $(seq $ITERATIONS | sort -R); do - test_comment "Iteration $I/$iterations..." + test_comment "Iteration $I/$ITERATIONS..." for j in $(seq 0 1 $SUBITERATIONS | sort -R); do edge="default" ether=$(genmac $j $i) @@ -360,7 +361,7 @@ test_bail_on_fail test_title "Test: Randomly adding MACs on random hooks..." rm -f $entries_lst for i in $(seq $ITERATIONS); do - test_comment "Iteration $i/$iterations..." + test_comment "Iteration $i/$ITERATIONS..." for j in $(seq 0 1 $SUBITERATIONS | sort -R); do edge=$(randomedge) ether=$(genmac $j $i) @@ -390,7 +391,7 @@ test_bail_on_fail test_title "Test: Randomly changing MAC assignments..." rm -f $entries2_lst for i in $(seq $ITERATIONS); do - test_comment "Iteration $i/$iterations..." + test_comment "Iteration $i/$ITERATIONS..." cat $entries_lst | while read ether edge; do edge2=$(randomedge) @@ -425,6 +426,5 @@ test_bail_on_fail ################################################################################ -test_cnt exit 0 From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:49:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B828357F8C0; Fri, 12 Mar 2021 17:49: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 4Dxtc34rB6z4c4V; Fri, 12 Mar 2021 17:49: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 952081B96B; Fri, 12 Mar 2021 17:49: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 12CHnNYg066632; Fri, 12 Mar 2021 17:49:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHnNeS066631; Fri, 12 Mar 2021 17:49:23 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:49:23 GMT Message-Id: <202103121749.12CHnNeS066631@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: 92211458689b - main - amd64: Only update fsbase/gsbase in pcb for curthread. 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: 92211458689b448cda52a659f9d192fef5a9dd50 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:49:23 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=92211458689b448cda52a659f9d192fef5a9dd50 commit 92211458689b448cda52a659f9d192fef5a9dd50 Author: John Baldwin AuthorDate: 2021-03-12 17:45:18 +0000 Commit: John Baldwin CommitDate: 2021-03-12 17:45:18 +0000 amd64: Only update fsbase/gsbase in pcb for curthread. Before the pcb is copied to the new thread during cpu_fork() and cpu_copy_thread(), the kernel re-reads the current register values in case they are stale. This is done by setting PCB_FULL_IRET in pcb_flags. This works fine for user threads, but the creation of kernel processes and kernel threads do not follow the normal synchronization rules for pcb_flags. Specifically, new kernel processes are always forked from thread0, not from curthread, so adjusting pcb_flags via a simple instruction without the LOCK prefix can race with thread0 running on another CPU. Similarly, kthread_add() clones from the first thread in the relevant kernel process, not from curthread. In practice, Netflix encountered a panic where the pcb_flags in the first kthread of the KTLS process were trashed due to update_pcb_bases() in cpu_copy_thread() running from thread0 to create one of the other KTLS threads racing with the first KTLS kthread calling fpu_kern_thread() on another CPU. In the panicking case, the write to update pcb_flags in fpu_kern_thread() was lost triggering an "Unregistered use of FPU in kernel" panic when the first KTLS kthread later tried to use the FPU. Reported by: gallatin Discussed with: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29023 --- sys/amd64/amd64/vm_machdep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 1d9eacd8a8b8..76f7f400dd9c 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -166,7 +166,8 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Ensure that td1's pcb is up to date. */ fpuexit(td1); - update_pcb_bases(td1->td_pcb); + if (td1 == curthread) + update_pcb_bases(td1->td_pcb); /* Point the stack and pcb to the actual location */ set_top_of_stack_td(td2); @@ -568,7 +569,8 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Those not loaded individually below get their default * values here. */ - update_pcb_bases(td0->td_pcb); + if (td0 == curthread) + update_pcb_bases(td0->td_pcb); bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | PCB_KERNFPU); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:49:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8BCD57F6D6; Fri, 12 Mar 2021 17:49: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 4Dxtc45Grjz4c4W; Fri, 12 Mar 2021 17:49: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 A867B1B96C; Fri, 12 Mar 2021 17:49: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 12CHnO2s066654; Fri, 12 Mar 2021 17:49:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHnOXT066653; Fri, 12 Mar 2021 17:49:24 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:49:24 GMT Message-Id: <202103121749.12CHnOXT066653@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: 704547ce1ca5 - main - amd64: Cleanups to setting TLS registers for Linux binaries. 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: 704547ce1ca56e1123048cd152ed4e468d41d703 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:49:24 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=704547ce1ca56e1123048cd152ed4e468d41d703 commit 704547ce1ca56e1123048cd152ed4e468d41d703 Author: John Baldwin AuthorDate: 2021-03-12 17:47:31 +0000 Commit: John Baldwin CommitDate: 2021-03-12 17:47:31 +0000 amd64: Cleanups to setting TLS registers for Linux binaries. - Use update_pcb_bases() when updating FS or GS base addresses to permit use of FSBASE and GSBASE in Linux processes. This also sets PCB_FULL_IRET. linux32 was setting PCB_32BIT which should be a no-op (exec sets it). - Remove write-only variables to construct unused segment descriptors for linux32. Reviewed by: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29026 --- sys/amd64/linux/linux_machdep.c | 5 +++-- sys/amd64/linux32/linux32_machdep.c | 21 ++------------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index e44f5c320c39..01b730c2b19c 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -251,7 +251,7 @@ linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) switch (args->code) { case LINUX_ARCH_SET_GS: if (args->addr < VM_MAXUSER_ADDRESS) { - set_pcb_flags(pcb, PCB_FULL_IRET); + update_pcb_bases(pcb); pcb->pcb_gsbase = args->addr; td->td_frame->tf_gs = _ugssel; error = 0; @@ -260,7 +260,7 @@ linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) break; case LINUX_ARCH_SET_FS: if (args->addr < VM_MAXUSER_ADDRESS) { - set_pcb_flags(pcb, PCB_FULL_IRET); + update_pcb_bases(pcb); pcb->pcb_fsbase = args->addr; td->td_frame->tf_fs = _ufssel; error = 0; @@ -290,6 +290,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) return (EPERM); pcb = td->td_pcb; + update_pcb_bases(pcb); pcb->pcb_fsbase = (register_t)desc; td->td_frame->tf_fs = _ufssel; diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 1883b18eeb60..fde180d74d73 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -394,11 +394,9 @@ linux_old_select(struct thread *td, struct linux_old_select_args *args) int linux_set_cloned_tls(struct thread *td, void *desc) { - struct user_segment_descriptor sd; struct l_user_desc info; struct pcb *pcb; int error; - int a[2]; error = copyin(desc, &info, sizeof(struct l_user_desc)); if (error) { @@ -410,14 +408,10 @@ linux_set_cloned_tls(struct thread *td, void *desc) if (error) linux_msg(td, "set_cloned_tls copyout info failed!"); - a[0] = LINUX_LDT_entry_a(&info); - a[1] = LINUX_LDT_entry_b(&info); - - memcpy(&sd, &a, sizeof(a)); pcb = td->td_pcb; + update_pcb_bases(pcb); pcb->pcb_gsbase = (register_t)info.base_addr; td->td_frame->tf_gs = GSEL(GUGS32_SEL, SEL_UPL); - set_pcb_flags(pcb, PCB_32BIT); } return (error); @@ -668,9 +662,7 @@ linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args) { struct l_user_desc info; - struct user_segment_descriptor sd; struct pcb *pcb; - int a[2]; int error; error = copyin(args->desc, &info, sizeof(struct l_user_desc)); @@ -721,18 +713,9 @@ linux_set_thread_area(struct thread *td, if (error) return (error); - if (LINUX_LDT_empty(&info)) { - a[0] = 0; - a[1] = 0; - } else { - a[0] = LINUX_LDT_entry_a(&info); - a[1] = LINUX_LDT_entry_b(&info); - } - - memcpy(&sd, &a, sizeof(a)); pcb = td->td_pcb; + update_pcb_bases(pcb); pcb->pcb_gsbase = (register_t)info.base_addr; - set_pcb_flags(pcb, PCB_32BIT); update_gdt_gsbase(td, info.base_addr); return (0); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:49:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BD0D57FA2E; Fri, 12 Mar 2021 17:49: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 4Dxtc572Sgz4c9L; Fri, 12 Mar 2021 17:49: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 C44C71B96D; Fri, 12 Mar 2021 17:49: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 12CHnPaT066673; Fri, 12 Mar 2021 17:49:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHnPuc066672; Fri, 12 Mar 2021 17:49:25 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:49:25 GMT Message-Id: <202103121749.12CHnPuc066672@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: 755efb8d8fca - main - x86: Copy the FPU/XSAVE state from the creating thread to new threads. 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: 755efb8d8fcacc6607bc46469750d78497f89378 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:49:26 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=755efb8d8fcacc6607bc46469750d78497f89378 commit 755efb8d8fcacc6607bc46469750d78497f89378 Author: John Baldwin AuthorDate: 2021-03-12 17:47:41 +0000 Commit: John Baldwin CommitDate: 2021-03-12 17:47:41 +0000 x86: Copy the FPU/XSAVE state from the creating thread to new threads. POSIX states that new threads created via pthread_create() should inherit the "floating point environment" from the creating thread. Discussed with: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29204 --- sys/amd64/amd64/vm_machdep.c | 10 ++++++---- sys/i386/i386/vm_machdep.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 76f7f400dd9c..f10d0339a65a 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -564,16 +564,18 @@ cpu_copy_thread(struct thread *td, struct thread *td0) pcb2 = td->td_pcb; + /* Ensure that td0's pcb is up to date. */ + fpuexit(td0); + if (td0 == curthread) + update_pcb_bases(td0->td_pcb); + /* * Copy the upcall pcb. This loads kernel regs. * Those not loaded individually below get their default * values here. */ - if (td0 == curthread) - update_pcb_bases(td0->td_pcb); bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU); + clear_pcb_flags(pcb2, PCB_KERNFPU); pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, cpu_max_ext_state_size); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index d3182cb224bf..502de6e7f38f 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -428,14 +428,21 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* Point the pcb to the top of the stack. */ pcb2 = td->td_pcb; + /* Ensure that td0's pcb is up to date. */ + if (td0 == curthread) + td0->td_pcb->pcb_gs = rgs(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td0) + npxsave(td0->td_pcb->pcb_save); + critical_exit(); + /* * Copy the upcall pcb. This loads kernel regs. * Those not loaded individually below get their default * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX); + pcb2->pcb_flags &= ~PCB_KERNNPX; pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, cpu_max_ext_state_size); @@ -463,7 +470,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */ pcb2->pcb_ebx = (int)td; /* trampoline arg */ pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - pcb2->pcb_gs = rgs(); /* * If we didn't copy the pcb, we'd need to do the following registers: * pcb2->pcb_cr3: cloned above. From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:49:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB96157FA93; Fri, 12 Mar 2021 17:49: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 4DxtcD0k9hz4c7h; Fri, 12 Mar 2021 17:49: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 7EF5D1BE1C; Fri, 12 Mar 2021 17:49: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 12CHnVPZ066779; Fri, 12 Mar 2021 17:49:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHnVFc066778; Fri, 12 Mar 2021 17:49:31 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:49:31 GMT Message-Id: <202103121749.12CHnVFc066778@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: 40d593d17eb6 - main - x86: Update some stale comments in cpu_fork() and 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: 40d593d17eb6d70ea717d6546a16794858944176 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:49:33 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=40d593d17eb6d70ea717d6546a16794858944176 commit 40d593d17eb6d70ea717d6546a16794858944176 Author: John Baldwin AuthorDate: 2021-03-12 17:48:49 +0000 Commit: John Baldwin CommitDate: 2021-03-12 17:48:49 +0000 x86: Update some stale comments in cpu_fork() and cpu_copy_thread(). Neither of these routines allocate stacks. Reviewed by: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29227 --- sys/amd64/amd64/vm_machdep.c | 6 ++++-- sys/i386/i386/vm_machdep.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 6e60f2b3faff..a17ddd4ba6d8 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -198,7 +198,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); /* - * Create a new fresh stack for the new process. * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. */ @@ -606,7 +605,10 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* - * Create a new fresh stack for the new thread. + * Copy user general-purpose registers. + * + * Some of these registers are rewritten by cpu_set_upcall() + * and linux_set_upcall_kse(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 471128e1713d..5947ae5a6d15 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -205,7 +205,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); /* - * Create a new fresh stack for the new process. * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. * The -VM86_STACK_SPACE (-16) is so we can expand the trapframe @@ -473,7 +472,10 @@ cpu_copy_thread(struct thread *td, struct thread *td0) } /* - * Create a new fresh stack for the new thread. + * Copy user general-purpose registers. + * + * Some of these registers are rewritten by cpu_set_upcall() + * and linux_set_upcall_kse(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:49:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3804457F9A5; Fri, 12 Mar 2021 17:49: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 4Dxtc75bNBz4bxB; Fri, 12 Mar 2021 17:49: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 EDDD41BB5B; Fri, 12 Mar 2021 17:49: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 12CHnQAw066695; Fri, 12 Mar 2021 17:49:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHnQlV066694; Fri, 12 Mar 2021 17:49:26 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:49:26 GMT Message-Id: <202103121749.12CHnQlV066694@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: 645b15e558dc - main - Remove unused wrappers around kproc_create() and kproc_exit(). 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: 645b15e558dc102ff70a6332b1d0b0aa733fd2bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:49:29 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=645b15e558dc102ff70a6332b1d0b0aa733fd2bb commit 645b15e558dc102ff70a6332b1d0b0aa733fd2bb Author: John Baldwin AuthorDate: 2021-03-12 17:47:58 +0000 Commit: John Baldwin CommitDate: 2021-03-12 17:47:58 +0000 Remove unused wrappers around kproc_create() and kproc_exit(). Reviewed by: imp, kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29205 --- sys/dev/mpr/mprvar.h | 4 ---- sys/dev/mps/mpsvar.h | 4 ---- 2 files changed, 8 deletions(-) diff --git a/sys/dev/mpr/mprvar.h b/sys/dev/mpr/mprvar.h index ce755188d706..5abcdd5d4299 100644 --- a/sys/dev/mpr/mprvar.h +++ b/sys/dev/mpr/mprvar.h @@ -913,10 +913,6 @@ int mprsas_send_reset(struct mpr_softc *sc, struct mpr_command *tm, SYSCTL_DECL(_hw_mpr); /* Compatibility shims for different OS versions */ -#define mpr_kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ - kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) -#define mpr_kproc_exit(arg) kproc_exit(arg) - #if defined(CAM_PRIORITY_XPT) #define MPR_PRIORITY_XPT CAM_PRIORITY_XPT #else diff --git a/sys/dev/mps/mpsvar.h b/sys/dev/mps/mpsvar.h index 2029b570c01d..6e6c9fd28c2b 100644 --- a/sys/dev/mps/mpsvar.h +++ b/sys/dev/mps/mpsvar.h @@ -831,10 +831,6 @@ int mpssas_send_reset(struct mps_softc *sc, struct mps_command *tm, SYSCTL_DECL(_hw_mps); /* Compatibility shims for different OS versions */ -#define mps_kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ - kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) -#define mps_kproc_exit(arg) kproc_exit(arg) - #if defined(CAM_PRIORITY_XPT) #define MPS_PRIORITY_XPT CAM_PRIORITY_XPT #else From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:49:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB63657FA31; Fri, 12 Mar 2021 17:49: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 4DxtcB4XD3z4c7X; Fri, 12 Mar 2021 17:49: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 723D21BB5E; Fri, 12 Mar 2021 17:49: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 12CHnUwd066757; Fri, 12 Mar 2021 17:49:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHnU0f066756; Fri, 12 Mar 2021 17:49:30 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:49:30 GMT Message-Id: <202103121749.12CHnU0f066756@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: c7b021352332 - main - x86: Always use clean FPU and segment base state for new kthreads. 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: c7b021352332a2f79907d68f971849f74b73e1c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:49:32 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c7b021352332a2f79907d68f971849f74b73e1c6 commit c7b021352332a2f79907d68f971849f74b73e1c6 Author: John Baldwin AuthorDate: 2021-03-12 17:48:36 +0000 Commit: John Baldwin CommitDate: 2021-03-12 17:48:36 +0000 x86: Always use clean FPU and segment base state for new kthreads. Reviewed by: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29208 --- sys/amd64/amd64/vm_machdep.c | 46 +++++++++++++++++++++++++--------- sys/i386/i386/sys_machdep.c | 6 +++-- sys/i386/i386/vm_machdep.c | 59 +++++++++++++++++++++++++++++++------------- 3 files changed, 81 insertions(+), 30 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index f10d0339a65a..6e60f2b3faff 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -164,10 +164,12 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date. */ - fpuexit(td1); - if (td1 == curthread) + /* Ensure that td1's pcb is up to date for user processes. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + fpuexit(td1); update_pcb_bases(td1->td_pcb); + } /* Point the stack and pcb to the actual location */ set_top_of_stack_td(td2); @@ -178,8 +180,18 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Properly initialize pcb_save */ pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); + + /* Kernel processes start with clean FPU and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_fsbase = 0; + pcb2->pcb_gsbase = 0; + clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | + PCB_KERNFPU | PCB_KERNFPU_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; @@ -564,10 +576,12 @@ cpu_copy_thread(struct thread *td, struct thread *td0) pcb2 = td->td_pcb; - /* Ensure that td0's pcb is up to date. */ - fpuexit(td0); - if (td0 == curthread) + /* Ensure that td0's pcb is up to date for user threads. */ + if ((td->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td0 == curthread); + fpuexit(td0); update_pcb_bases(td0->td_pcb); + } /* * Copy the upcall pcb. This loads kernel regs. @@ -575,12 +589,22 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - clear_pcb_flags(pcb2, PCB_KERNFPU); pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); + + /* Kernel threads start with clean FPU and segment bases. */ + if ((td->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_fsbase = 0; + pcb2->pcb_gsbase = 0; + clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | + PCB_KERNFPU | PCB_KERNFPU_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); + bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, + cpu_max_ext_state_size); + } set_pcb_flags_raw(pcb2, PCB_FULL_IRET); + /* * Create a new fresh stack for the new thread. */ diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index 3f650b65e160..a0a1c273f467 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -108,7 +108,8 @@ set_fsbase(struct thread *td, uint32_t base) fill_based_sd(&sd, base); critical_enter(); td->td_pcb->pcb_fsd = sd; - PCPU_GET(fsgs_gdt)[0] = sd; + if (td == curthread) + PCPU_GET(fsgs_gdt)[0] = sd; critical_exit(); } @@ -120,7 +121,8 @@ set_gsbase(struct thread *td, uint32_t base) fill_based_sd(&sd, base); critical_enter(); td->td_pcb->pcb_gsd = sd; - PCPU_GET(fsgs_gdt)[1] = sd; + if (td == curthread) + PCPU_GET(fsgs_gdt)[1] = sd; critical_exit(); } diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 502de6e7f38f..471128e1713d 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -167,13 +167,15 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date. */ - if (td1 == curthread) + /* Ensure that td1's pcb is up to date for user processes. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); td1->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td1) - npxsave(td1->td_pcb->pcb_save); - critical_exit(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td1) + npxsave(td1->td_pcb->pcb_save); + critical_exit(); + } /* Point the pcb to the top of the stack */ pcb2 = get_pcb_td(td2); @@ -184,8 +186,19 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) /* Properly initialize pcb_save */ pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); + + /* Kernel processes start with clean NPX and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_gs = _udatasel; + set_fsbase(td2, 0); + set_gsbase(td2, 0); + pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | + PCB_KERNNPX | PCB_KERNNPX_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; @@ -428,13 +441,15 @@ cpu_copy_thread(struct thread *td, struct thread *td0) /* Point the pcb to the top of the stack. */ pcb2 = td->td_pcb; - /* Ensure that td0's pcb is up to date. */ - if (td0 == curthread) + /* Ensure that td0's pcb is up to date for user threads. */ + if ((td->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td0 == curthread); td0->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td0) - npxsave(td0->td_pcb->pcb_save); - critical_exit(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td0) + npxsave(td0->td_pcb->pcb_save); + critical_exit(); + } /* * Copy the upcall pcb. This loads kernel regs. @@ -442,10 +457,20 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * values here. */ bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_flags &= ~PCB_KERNNPX; pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); + + /* Kernel threads start with clean NPX and segment bases. */ + if ((td->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_gs = _udatasel; + set_fsbase(td, 0); + set_gsbase(td, 0); + pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | + PCB_KERNNPX | PCB_KERNNPX_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); + bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, + cpu_max_ext_state_size); + } /* * Create a new fresh stack for the new thread. From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:49:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E81AE57F8D3; Fri, 12 Mar 2021 17:49: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 4Dxtc947pVz4c2h; Fri, 12 Mar 2021 17:49: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 4425D1BB5D; Fri, 12 Mar 2021 17:49: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 12CHnTdR066736; Fri, 12 Mar 2021 17:49:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHnTJF066734; Fri, 12 Mar 2021 17:49:29 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:49:29 GMT Message-Id: <202103121749.12CHnTJF066734@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: 640d54045bdb - main - Set TDP_KTHREAD before calling cpu_fork() and 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: 640d54045bdbf894ae3c75cd9818c29fc2f6e5e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:49:30 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=640d54045bdbf894ae3c75cd9818c29fc2f6e5e7 commit 640d54045bdbf894ae3c75cd9818c29fc2f6e5e7 Author: John Baldwin AuthorDate: 2021-03-12 17:48:20 +0000 Commit: John Baldwin CommitDate: 2021-03-12 17:48:20 +0000 Set TDP_KTHREAD before calling cpu_fork() and cpu_copy_thread(). This permits these routines to use special logic for initializing MD kthread state. For the kproc case, this required moving the logic to set these flags from kproc_create() into do_fork(). Reviewed by: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29207 --- sys/kern/kern_fork.c | 12 ++++++++++-- sys/kern/kern_kthread.c | 17 +++++------------ sys/sys/proc.h | 1 + 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 870ae494de5d..3da8205d8ab0 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -497,9 +497,12 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * } else { sigacts_copy(newsigacts, p1->p_sigacts); p2->p_sigacts = newsigacts; - if ((fr->fr_flags2 & FR2_DROPSIG_CAUGHT) != 0) { + if ((fr->fr_flags2 & (FR2_DROPSIG_CAUGHT | FR2_KPROC)) != 0) { mtx_lock(&p2->p_sigacts->ps_mtx); - sig_drop_caught(p2); + if ((fr->fr_flags2 & FR2_DROPSIG_CAUGHT) != 0) + sig_drop_caught(p2); + if ((fr->fr_flags2 & FR2_KPROC) != 0) + p2->p_sigacts->ps_flag |= PS_NOCLDWAIT; mtx_unlock(&p2->p_sigacts->ps_mtx); } } @@ -511,6 +514,11 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * else p2->p_sigparent = SIGCHLD; + if ((fr->fr_flags2 & FR2_KPROC) != 0) { + p2->p_flag |= P_SYSTEM | P_KPROC; + td2->td_pflags |= TDP_KTHREAD; + } + p2->p_textvp = p1->p_textvp; p2->p_fd = fd; p2->p_fdtol = fdtol; diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index d049a099847c..32832bde2f53 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -95,6 +95,7 @@ kproc_create(void (*func)(void *), void *arg, bzero(&fr, sizeof(fr)); fr.fr_flags = RFMEM | RFFDG | RFPROC | RFSTOPPED | flags; + fr.fr_flags2 = FR2_KPROC; fr.fr_pages = pages; fr.fr_procp = &p2; error = fork1(&thread0, &fr); @@ -105,21 +106,11 @@ kproc_create(void (*func)(void *), void *arg, if (newpp != NULL) *newpp = p2; - /* this is a non-swapped system process */ - PROC_LOCK(p2); - td = FIRST_THREAD_IN_PROC(p2); - p2->p_flag |= P_SYSTEM | P_KPROC; - td->td_pflags |= TDP_KTHREAD; - mtx_lock(&p2->p_sigacts->ps_mtx); - p2->p_sigacts->ps_flag |= PS_NOCLDWAIT; - mtx_unlock(&p2->p_sigacts->ps_mtx); - PROC_UNLOCK(p2); - /* set up arg0 for 'ps', et al */ va_start(ap, fmt); vsnprintf(p2->p_comm, sizeof(p2->p_comm), fmt, ap); va_end(ap); - /* set up arg0 for 'ps', et al */ + td = FIRST_THREAD_IN_PROC(p2); va_start(ap, fmt); vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap); va_end(ap); @@ -295,12 +286,14 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p, TSTHREAD(newtd, newtd->td_name); newtd->td_proc = p; /* needed for cpu_copy_thread */ + newtd->td_pflags |= TDP_KTHREAD; + /* might be further optimized for kthread */ cpu_copy_thread(newtd, oldtd); + /* put the designated function(arg) as the resume context */ cpu_fork_kthread_handler(newtd, func, arg); - newtd->td_pflags |= TDP_KTHREAD; thread_cow_get_proc(newtd, p); /* this code almost the same as create_thread() in kern_thr.c */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 0073fee2a42e..d51ad1093833 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1055,6 +1055,7 @@ struct fork_req { int fr_flags2; #define FR2_DROPSIG_CAUGHT 0x00000001 /* Drop caught non-DFL signals */ #define FR2_SHARE_PATHS 0x00000002 /* Invert sense of RFFDG for paths */ +#define FR2_KPROC 0x00000004 /* Create a kernel process */ }; /* From owner-dev-commits-src-all@freebsd.org Fri Mar 12 17:49:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7FDA57F746; Fri, 12 Mar 2021 17:49: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 4Dxtc84sLYz4brD; Fri, 12 Mar 2021 17:49: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 1FC351BB5C; Fri, 12 Mar 2021 17:49: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 12CHnSex066717; Fri, 12 Mar 2021 17:49:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CHnRZd066716; Fri, 12 Mar 2021 17:49:27 GMT (envelope-from git) Date: Fri, 12 Mar 2021 17:49:27 GMT Message-Id: <202103121749.12CHnRZd066716@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: 5a50eb6585ef - main - Don't pass RFPROC to kproc_create(), it is redundant. 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: 5a50eb6585ef8d1a40c8086bab8639cc56f00df9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 17:49:31 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5a50eb6585ef8d1a40c8086bab8639cc56f00df9 commit 5a50eb6585ef8d1a40c8086bab8639cc56f00df9 Author: John Baldwin AuthorDate: 2021-03-12 17:48:10 +0000 Commit: John Baldwin CommitDate: 2021-03-12 17:48:10 +0000 Don't pass RFPROC to kproc_create(), it is redundant. Reviewed by: tuexen, kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29206 --- sys/netinet/sctp_bsd_addr.c | 2 +- sys/netinet/sctp_pcb.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/sctp_bsd_addr.c b/sys/netinet/sctp_bsd_addr.c index aad84f71a678..2a00885d8ddd 100644 --- a/sys/netinet/sctp_bsd_addr.c +++ b/sys/netinet/sctp_bsd_addr.c @@ -108,7 +108,7 @@ sctp_startup_iterator(void) kproc_create(sctp_iterator_thread, (void *)NULL, &sctp_it_ctl.thread_proc, - RFPROC, + 0, SCTP_KTHREAD_PAGES, SCTP_KTRHEAD_NAME); } diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 4d09ad3a7353..f4264ab387f1 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -5678,7 +5678,7 @@ sctp_startup_mcore_threads(void) (void)kproc_create(sctp_mcore_thread, (void *)&sctp_mcore_workers[cpu], &sctp_mcore_workers[cpu].thread_proc, - RFPROC, + 0, SCTP_KTHREAD_PAGES, SCTP_MCORE_NAME); } From owner-dev-commits-src-all@freebsd.org Fri Mar 12 18:16:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9455E5A8C05; Fri, 12 Mar 2021 18: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 4DxvBm3c8mz4fbv; Fri, 12 Mar 2021 18: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 6EA841C58B; Fri, 12 Mar 2021 18: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 12CIG0vo005819; Fri, 12 Mar 2021 18: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 12CIG0Ih005818; Fri, 12 Mar 2021 18:16:00 GMT (envelope-from git) Date: Fri, 12 Mar 2021 18:16:00 GMT Message-Id: <202103121816.12CIG0Ih005818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: fe6b360a6293 - stable/13 - MFC jail: Improve locking when removing prisons 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/stable/13 X-Git-Reftype: branch X-Git-Commit: fe6b360a62931eaea450ab9ac9b41daac5996e51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 18:16:00 -0000 The branch stable/13 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=fe6b360a62931eaea450ab9ac9b41daac5996e51 commit fe6b360a62931eaea450ab9ac9b41daac5996e51 Author: Jamie Gritton AuthorDate: 2021-02-20 22:38:58 +0000 Commit: Jamie Gritton CommitDate: 2021-03-12 18:15:13 +0000 MFC jail: Improve locking when removing prisons Change the flow of prison_deref() so it doesn't let go of allprison_lock until it's completely done using it (except for a possible drop as part of an upgrade on its first try). Differential Revision: https://reviews.freebsd.org/D28458 (cherry picked from commit 6e1d1bfcac77603541706807803a198c6d954d7c) --- sys/kern/kern_jail.c | 69 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 90ab69a372d2..65201eb12951 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -2793,11 +2793,17 @@ prison_complete(void *context, int pending) static void prison_deref(struct prison *pr, int flags) { - struct prison *ppr, *tpr; + struct prisonlist freeprison; + struct prison *rpr, *tpr; int lastref, lasturef; + TAILQ_INIT(&freeprison); if (!(flags & PD_LOCKED)) mtx_lock(&pr->pr_mtx); + /* + * Release this prison as requested, which may cause its parent + * to be released, and then maybe its grandparent, etc. + */ for (;;) { if (flags & PD_DEUREF) { KASSERT(refcount_load(&pr->pr_uref) > 0, @@ -2840,56 +2846,63 @@ prison_deref(struct prison *pr, int flags) mtx_unlock(&pr->pr_mtx); } - /* If the prison still has references, nothing else to do. */ - if (!lastref) { - if (flags & PD_LIST_SLOCKED) - sx_sunlock(&allprison_lock); - else if (flags & PD_LIST_XLOCKED) - sx_xunlock(&allprison_lock); - return; - } + if (!lastref) + break; if (flags & PD_LIST_SLOCKED) { if (!sx_try_upgrade(&allprison_lock)) { sx_sunlock(&allprison_lock); sx_xlock(&allprison_lock); } + flags &= ~PD_LIST_SLOCKED; } else if (!(flags & PD_LIST_XLOCKED)) sx_xlock(&allprison_lock); + flags |= PD_LIST_XLOCKED; TAILQ_REMOVE(&allprison, pr, pr_list); LIST_REMOVE(pr, pr_sibling); - ppr = pr->pr_parent; - for (tpr = ppr; tpr != NULL; tpr = tpr->pr_parent) + TAILQ_INSERT_TAIL(&freeprison, pr, pr_list); + for (tpr = pr->pr_parent; tpr != NULL; tpr = tpr->pr_parent) tpr->pr_childcount--; + + /* Removing a prison frees a reference on its parent. */ + pr = pr->pr_parent; + mtx_lock(&pr->pr_mtx); + flags |= PD_DEREF | PD_DEUREF; + } + + /* Release all the prison locks. */ + if (flags & PD_LIST_SLOCKED) + sx_sunlock(&allprison_lock); + else if (flags & PD_LIST_XLOCKED) sx_xunlock(&allprison_lock); + /* + * Finish removing any unreferenced prisons, which couldn't happen + * while allprison_lock was held (to avoid a LOR on vrele). + */ + TAILQ_FOREACH_SAFE(rpr, &freeprison, pr_list, tpr) { #ifdef VIMAGE - if (pr->pr_vnet != ppr->pr_vnet) - vnet_destroy(pr->pr_vnet); + if (rpr->pr_vnet != rpr->pr_parent->pr_vnet) + vnet_destroy(rpr->pr_vnet); #endif - if (pr->pr_root != NULL) - vrele(pr->pr_root); - mtx_destroy(&pr->pr_mtx); + if (rpr->pr_root != NULL) + vrele(rpr->pr_root); + mtx_destroy(&rpr->pr_mtx); #ifdef INET - free(pr->pr_ip4, M_PRISON); + free(rpr->pr_ip4, M_PRISON); #endif #ifdef INET6 - free(pr->pr_ip6, M_PRISON); + free(rpr->pr_ip6, M_PRISON); #endif - if (pr->pr_cpuset != NULL) - cpuset_rel(pr->pr_cpuset); - osd_jail_exit(pr); + if (rpr->pr_cpuset != NULL) + cpuset_rel(rpr->pr_cpuset); + osd_jail_exit(rpr); #ifdef RACCT if (racct_enable) - prison_racct_detach(pr); + prison_racct_detach(rpr); #endif - free(pr, M_PRISON); - - /* Removing a prison frees a reference on its parent. */ - pr = ppr; - mtx_lock(&pr->pr_mtx); - flags = PD_DEREF | PD_DEUREF; + free(rpr, M_PRISON); } } From owner-dev-commits-src-all@freebsd.org Fri Mar 12 18:31:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC14C5A9272; Fri, 12 Mar 2021 18:31: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 4DxvXx5xVkz4h1f; Fri, 12 Mar 2021 18:31: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 BE9981C79C; Fri, 12 Mar 2021 18:31: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 12CIVjAp029984; Fri, 12 Mar 2021 18:31:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CIVje0029983; Fri, 12 Mar 2021 18:31:45 GMT (envelope-from git) Date: Fri, 12 Mar 2021 18:31:45 GMT Message-Id: <202103121831.12CIVje0029983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: ad259c473dc6 - stable/13 - MFC jail: Change the locking around pr_ref and pr_uref 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/stable/13 X-Git-Reftype: branch X-Git-Commit: ad259c473dc645725225cfda307323de48c87051 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 18:31:45 -0000 The branch stable/13 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=ad259c473dc645725225cfda307323de48c87051 commit ad259c473dc645725225cfda307323de48c87051 Author: Jamie Gritton AuthorDate: 2021-02-21 18:55:44 +0000 Commit: Jamie Gritton CommitDate: 2021-03-12 18:30:06 +0000 MFC jail: Change the locking around pr_ref and pr_uref Require both the prison mutex and allprison_lock when pr_ref or pr_uref go to/from zero. Adding a non-first or removing a non-last reference remain lock-free. This means that a shared hold on allprison_lock is sufficient for prison_isalive() to be useful, which removes a number of cases of lock/check/unlock on the prison mutex. Expand the locking in kern_jail_set() to keep allprison_lock held exclusive until the new prison is valid, thus making invalid prisons invisible to any thread holding allprison_lock (except of course the one creating or destroying the prison). This renders prison_isvalid() nearly redundant, now used only in asserts. Differential Revision: https://reviews.freebsd.org/D28419 Differential Revision: https://reviews.freebsd.org/D28458 (cherry picked from commit f7496dcab0360a74bfb00cd6118f66323fffda61) MFC jail: fix build after the previous commit Noted by: Michael Butler (cherry picked from commit ee9b37ae5c115c41835119bb5c9d2e14c83abd65) --- sys/kern/kern_jail.c | 423 ++++++++++++++++++++++++------------------------- sys/kern/sysv_msg.c | 2 +- sys/kern/sysv_sem.c | 2 +- sys/kern/sysv_shm.c | 2 +- sys/kern/uipc_mqueue.c | 35 ++-- sys/sys/jail.h | 3 +- 6 files changed, 232 insertions(+), 235 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 65201eb12951..342af50462f2 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -137,9 +137,11 @@ LIST_HEAD(, prison_racct) allprison_racct; int lastprid = 0; static int get_next_prid(struct prison **insprp); -static int do_jail_attach(struct thread *td, struct prison *pr); +static int do_jail_attach(struct thread *td, struct prison *pr, int drflags); static void prison_complete(void *context, int pending); static void prison_deref(struct prison *pr, int flags); +static int prison_lock_xlock(struct prison *pr, int flags); +static void prison_free_not_last(struct prison *pr); static void prison_set_allow_locked(struct prison *pr, unsigned flag, int enable); static char *prison_path(struct prison *pr1, struct prison *pr2); @@ -1006,18 +1008,15 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * where it can be inserted later. */ TAILQ_FOREACH(inspr, &allprison, pr_list) { - if (inspr->pr_id == jid) { - mtx_lock(&inspr->pr_mtx); - if (prison_isvalid(inspr)) { - pr = inspr; - drflags |= PD_LOCKED; - inspr = NULL; - } else - mtx_unlock(&inspr->pr_mtx); - break; - } + if (inspr->pr_id < jid) + continue; if (inspr->pr_id > jid) break; + pr = inspr; + mtx_lock(&pr->pr_mtx); + drflags |= PD_LOCKED; + inspr = NULL; + break; } if (pr != NULL) { ppr = pr->pr_parent; @@ -1041,13 +1040,15 @@ 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 (!prison_isalive(pr)) { + } + if (!prison_isalive(pr)) { if (!(flags & JAIL_DYING)) { error = ENOENT; vfs_opterror(opts, "jail %d is dying", jid); goto done_deref; - } else if ((flags & JAIL_ATTACH) || + } + if ((flags & JAIL_ATTACH) || (pr_flags & PR_PERSIST)) { /* * A dying jail might be resurrected @@ -1121,12 +1122,10 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) if (namelc[0] != '\0') { pnamelen = (ppr == &prison0) ? 0 : strlen(ppr->pr_name) + 1; - name_again: deadpr = NULL; FOREACH_PRISON_CHILD(ppr, tpr) { if (tpr != pr && !strcmp(tpr->pr_name + pnamelen, namelc)) { - mtx_lock(&tpr->pr_mtx); if (prison_isalive(tpr)) { if (pr == NULL && cuflags != JAIL_CREATE) { @@ -1135,6 +1134,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * for updates. */ pr = tpr; + mtx_lock(&pr->pr_mtx); drflags |= PD_LOCKED; break; } @@ -1144,28 +1144,22 @@ 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); goto done_deref; } if (pr == NULL && - cuflags != JAIL_CREATE && - prison_isvalid(tpr)) + cuflags != JAIL_CREATE) { deadpr = tpr; - mtx_unlock(&tpr->pr_mtx); + } } } /* 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 (!prison_isvalid(deadpr)) { - mtx_unlock(&deadpr->pr_mtx); - goto name_again; - } pr = deadpr; + mtx_lock(&pr->pr_mtx); drflags |= PD_LOCKED; } else if (cuflags == JAIL_UPDATE) { error = ENOENT; @@ -1199,19 +1193,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) vfs_opterror(opts, "prison limit exceeded"); goto done_deref; } - mtx_lock(&ppr->pr_mtx); - if (!prison_isvalid(ppr)) { - mtx_unlock(&ppr->pr_mtx); - error = ENOENT; - vfs_opterror(opts, "jail \"%s\" not found", - prison_name(mypr, ppr)); - goto done_deref; - } prison_hold(ppr); - if (refcount_acquire(&ppr->pr_uref)) - mtx_unlock(&ppr->pr_mtx); - else { + if (!refcount_acquire_if_not_zero(&ppr->pr_uref)) { /* This brings the parent back to life. */ + mtx_lock(&ppr->pr_mtx); + refcount_acquire(&ppr->pr_uref); mtx_unlock(&ppr->pr_mtx); error = osd_jail_call(ppr, PR_METHOD_CREATE, opts); if (error) { @@ -1219,7 +1205,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) drflags |= PD_DEREF | PD_DEUREF; goto done_deref; } - } + } if (jid == 0 && (jid = get_next_prid(&inspr)) == 0) { error = EAGAIN; @@ -1230,6 +1216,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } pr = malloc(sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO); + refcount_init(&pr->pr_ref, 0); + refcount_init(&pr->pr_uref, 0); LIST_INIT(&pr->pr_children); mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK); TASK_INIT(&pr->pr_task, 0, prison_complete, pr); @@ -1452,7 +1440,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #ifdef VIMAGE (tpr != tppr && (tpr->pr_flags & PR_VNET)) || #endif - refcount_load(&tpr->pr_uref) == 0) { + !prison_isalive(tpr)) { descend = 0; continue; } @@ -1520,7 +1508,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #ifdef VIMAGE (tpr != tppr && (tpr->pr_flags & PR_VNET)) || #endif - refcount_load(&tpr->pr_uref) == 0) { + !prison_isalive(tpr)) { descend = 0; continue; } @@ -1759,8 +1747,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_ref); drflags |= PD_DEUREF; + prison_free_not_last(pr); } } pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; @@ -1824,8 +1812,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #endif /* Let the modules do their work. */ - sx_downgrade(&allprison_lock); - drflags = (drflags & ~PD_LIST_XLOCKED) | PD_LIST_SLOCKED; if (born) { error = osd_jail_call(pr, PR_METHOD_CREATE, opts); if (error) { @@ -1842,9 +1828,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) /* Attach this process to the prison if requested. */ if (flags & JAIL_ATTACH) { - mtx_lock(&pr->pr_mtx); - error = do_jail_attach(td, pr); - drflags &= ~PD_LIST_SLOCKED; + error = do_jail_attach(td, pr, prison_lock_xlock(pr, drflags)); + drflags &= ~(PD_LOCKED | PD_LIST_XLOCKED); if (error) { if (created) { /* do_jail_attach has removed the prison. */ @@ -1857,9 +1842,9 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #ifdef RACCT if (racct_enable && !created) { - if (drflags & PD_LIST_SLOCKED) { - sx_sunlock(&allprison_lock); - drflags &= ~PD_LIST_SLOCKED; + if (drflags & PD_LIST_XLOCKED) { + sx_xunlock(&allprison_lock); + drflags &= ~PD_LIST_XLOCKED; } prison_racct_modify(pr); } @@ -1874,8 +1859,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * not be publicly visible). */ if (pr_flags & PR_PERSIST) { - mtx_lock(&pr->pr_mtx); - drflags |= PD_LOCKED; + drflags = prison_lock_xlock(pr, drflags); refcount_acquire(&pr->pr_ref); refcount_acquire(&pr->pr_uref); } else { @@ -1952,13 +1936,8 @@ get_next_prid(struct prison **insprp) TAILQ_FOREACH(inspr, &allprison, pr_list) { if (inspr->pr_id < jid) continue; - 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 - * same ID. - */ + if (inspr->pr_id > jid) { + /* Found an opening. */ maxid = 0; break; } @@ -2047,18 +2026,14 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) error = vfs_copyopt(opts, "lastjid", &jid, sizeof(jid)); if (error == 0) { TAILQ_FOREACH(pr, &allprison, pr_list) { - if (pr->pr_id > jid && prison_ischild(mypr, pr)) { + if (pr->pr_id > jid && + ((flags & JAIL_DYING) || prison_isalive(pr)) && + prison_ischild(mypr, pr)) { mtx_lock(&pr->pr_mtx); - if ((flags & JAIL_DYING) - ? prison_isvalid(pr) : prison_isalive(pr)) - break; - mtx_unlock(&pr->pr_mtx); + drflags |= PD_LOCKED; + goto found_prison; } } - if (pr != NULL) { - drflags |= PD_LOCKED; - goto found_prison; - } error = ENOENT; vfs_opterror(opts, "no jail after %d", jid); goto done; @@ -2314,7 +2289,7 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) int sys_jail_remove(struct thread *td, struct jail_remove_args *uap) { - struct prison *pr, *cpr, *lpr, *tpr; + struct prison *pr, *cpr, *lpr; int descend, error; error = priv_check(td, PRIV_JAIL_REMOVE); @@ -2334,21 +2309,13 @@ sys_jail_remove(struct thread *td, struct jail_remove_args *uap) mtx_unlock(&pr->pr_mtx); lpr = NULL; FOREACH_PRISON_DESCENDANT(pr, cpr, descend) { - mtx_lock(&cpr->pr_mtx); - if (prison_isvalid(cpr)) { - tpr = cpr; - prison_hold(cpr); - } else { - /* Already removed - do not do it again. */ - tpr = NULL; - } - mtx_unlock(&cpr->pr_mtx); + prison_hold(cpr); if (lpr != NULL) { mtx_lock(&lpr->pr_mtx); prison_remove_one(lpr); sx_xlock(&allprison_lock); } - lpr = tpr; + lpr = cpr; } if (lpr != NULL) { mtx_lock(&lpr->pr_mtx); @@ -2377,8 +2344,8 @@ prison_remove_one(struct prison *pr) /* If the prison was persistent, it is not anymore. */ if (pr->pr_flags & PR_PERSIST) { - refcount_release(&pr->pr_ref); drflags |= PD_DEUREF; + prison_free_not_last(pr); pr->pr_flags &= ~PR_PERSIST; } @@ -2428,14 +2395,7 @@ sys_jail_attach(struct thread *td, struct jail_attach_args *uap) if (error) return (error); - /* - * Start with exclusive hold on allprison_lock to ensure that a possible - * PR_METHOD_REMOVE call isn't concurrent with jail_set or jail_remove. - * But then immediately downgrade it since we don't need to stop - * readers. - */ - sx_xlock(&allprison_lock); - sx_downgrade(&allprison_lock); + sx_slock(&allprison_lock); pr = prison_find_child(td->td_ucred->cr_prison, uap->jid); if (pr == NULL) { sx_sunlock(&allprison_lock); @@ -2449,16 +2409,18 @@ sys_jail_attach(struct thread *td, struct jail_attach_args *uap) return (EINVAL); } - return (do_jail_attach(td, pr)); + return (do_jail_attach(td, pr, PD_LOCKED | PD_LIST_SLOCKED)); } static int -do_jail_attach(struct thread *td, struct prison *pr) +do_jail_attach(struct thread *td, struct prison *pr, int drflags) { struct proc *p; struct ucred *newcred, *oldcred; int error; + mtx_assert(&pr->pr_mtx, MA_OWNED); + sx_assert(&allprison_lock, SX_LOCKED); /* * XXX: Note that there is a slight race here if two threads * in the same privileged process attempt to attach to two @@ -2469,15 +2431,18 @@ do_jail_attach(struct thread *td, struct prison *pr) */ refcount_acquire(&pr->pr_ref); refcount_acquire(&pr->pr_uref); + drflags |= PD_DEREF | PD_DEUREF; mtx_unlock(&pr->pr_mtx); + drflags &= ~PD_LOCKED; /* Let modules do whatever they need to prepare for attaching. */ error = osd_jail_call(pr, PR_METHOD_ATTACH, td); if (error) { - prison_deref(pr, PD_DEREF | PD_DEUREF | PD_LIST_SLOCKED); + prison_deref(pr, drflags); return (error); } - sx_sunlock(&allprison_lock); + sx_unlock(&allprison_lock); + drflags &= ~(PD_LIST_SLOCKED | PD_LIST_XLOCKED); /* * Reparent the newly attached process to this jail. @@ -2513,7 +2478,7 @@ do_jail_attach(struct thread *td, struct prison *pr) rctl_proc_ucred_changed(p, newcred); crfree(newcred); #endif - prison_deref(oldcred->cr_prison, PD_DEREF | PD_DEUREF); + prison_deref(oldcred->cr_prison, drflags); crfree(oldcred); /* @@ -2533,8 +2498,9 @@ do_jail_attach(struct thread *td, struct prison *pr) e_revert_osd: /* Tell modules this thread is still in its old jail after all. */ sx_slock(&allprison_lock); + drflags |= PD_LIST_SLOCKED; (void)osd_jail_call(td->td_ucred->cr_prison, PR_METHOD_ATTACH, td); - prison_deref(pr, PD_DEREF | PD_DEUREF | PD_LIST_SLOCKED); + prison_deref(pr, drflags); return (error); } @@ -2548,19 +2514,13 @@ prison_find(int prid) sx_assert(&allprison_lock, SX_LOCKED); TAILQ_FOREACH(pr, &allprison, pr_list) { - if (pr->pr_id == prid) { - mtx_lock(&pr->pr_mtx); - if (prison_isvalid(pr)) - return (pr); - /* - * Any active prison with the same ID would have - * been inserted before a dead one. - */ - mtx_unlock(&pr->pr_mtx); - break; - } + if (pr->pr_id < prid) + continue; if (pr->pr_id > prid) break; + KASSERT(prison_isvalid(pr), ("Found invalid prison %p", pr)); + mtx_lock(&pr->pr_mtx); + return (pr); } return (NULL); } @@ -2577,10 +2537,10 @@ prison_find_child(struct prison *mypr, int prid) sx_assert(&allprison_lock, SX_LOCKED); FOREACH_PRISON_DESCENDANT(mypr, pr, descend) { if (pr->pr_id == prid) { + KASSERT(prison_isvalid(pr), + ("Found invalid prison %p", pr)); mtx_lock(&pr->pr_mtx); - if (prison_isvalid(pr)) - return (pr); - mtx_unlock(&pr->pr_mtx); + return (pr); } } return (NULL); @@ -2598,26 +2558,21 @@ prison_find_name(struct prison *mypr, const char *name) sx_assert(&allprison_lock, SX_LOCKED); mylen = (mypr == &prison0) ? 0 : strlen(mypr->pr_name) + 1; - again: deadpr = NULL; FOREACH_PRISON_DESCENDANT(mypr, pr, descend) { if (!strcmp(pr->pr_name + mylen, name)) { - mtx_lock(&pr->pr_mtx); - if (prison_isalive(pr)) + KASSERT(prison_isvalid(pr), + ("Found invalid prison %p", pr)); + if (prison_isalive(pr)) { + mtx_lock(&pr->pr_mtx); return (pr); - if (prison_isvalid(pr)) - deadpr = pr; - mtx_unlock(&pr->pr_mtx); + } + deadpr = pr; } } /* There was no valid prison - perhaps there was a dying one. */ - if (deadpr != NULL) { + if (deadpr != NULL) mtx_lock(&deadpr->pr_mtx); - if (!prison_isvalid(deadpr)) { - mtx_unlock(&deadpr->pr_mtx); - goto again; - } - } return (deadpr); } @@ -2671,45 +2626,53 @@ prison_hold(struct prison *pr) /* * Remove a prison reference. If that was the last reference, the - * prison will be removed (at a later time). Return with the prison - * unlocked. + * prison will be removed (at a later time). */ void prison_free_locked(struct prison *pr) { - int lastref; mtx_assert(&pr->pr_mtx, MA_OWNED); + /* + * Locking is no longer required, but unlock because the caller + * expects it. + */ + mtx_unlock(&pr->pr_mtx); + prison_free(pr); +} + +void +prison_free(struct prison *pr) +{ + 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 (lastref) { + if (!refcount_release_if_not_last(&pr->pr_ref)) { /* - * Don't remove the prison itself in this context, + * Don't remove the last reference in this context, * in case there are locks held. */ taskqueue_enqueue(taskqueue_thread, &pr->pr_task); } } -void -prison_free(struct prison *pr) +static void +prison_free_not_last(struct prison *pr) { +#ifdef INVARIANTS + int lastref; - /* - * 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); + lastref = refcount_release(&pr->pr_ref); + KASSERT(!lastref, + ("prison_free_not_last freed last ref on prison %p (jid=%d).", + pr, pr->pr_id)); +#else + refcount_release(&pr->pr_ref); +#endif } /* @@ -2718,7 +2681,8 @@ prison_free(struct prison *pr) * 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. + * be set to the dying state until the prison mutex and allprison_lock + * are both freed. */ void prison_proc_hold(struct prison *pr) @@ -2756,7 +2720,7 @@ prison_proc_free(struct prison *pr) * but also half dead. Add a reference so any calls to * prison_free() won't re-submit the task. */ - refcount_acquire(&pr->pr_ref); + prison_hold(pr); taskqueue_enqueue(taskqueue_thread, &pr->pr_task); } } @@ -2768,18 +2732,18 @@ static void prison_complete(void *context, int pending) { struct prison *pr = context; + int drflags; - sx_xlock(&allprison_lock); - mtx_lock(&pr->pr_mtx); /* - * 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. + * This could be called to release the last reference, or the + * last user reference; the existence of a user reference implies + * the latter. There will always be a reference to remove, as + * prison_proc_free adds one. */ - prison_deref(pr, refcount_load(&pr->pr_uref) > 0 - ? PD_DEREF | PD_DEUREF | PD_LOCKED | PD_LIST_XLOCKED - : PD_LOCKED | PD_LIST_XLOCKED); + drflags = prison_lock_xlock(pr, PD_DEREF); + if (refcount_load(&pr->pr_uref) > 0) + drflags |= PD_DEUREF; + prison_deref(pr, drflags); } /* @@ -2794,84 +2758,86 @@ static void prison_deref(struct prison *pr, int flags) { struct prisonlist freeprison; - struct prison *rpr, *tpr; - int lastref, lasturef; + struct prison *rpr, *ppr, *tpr; TAILQ_INIT(&freeprison); - if (!(flags & PD_LOCKED)) - mtx_lock(&pr->pr_mtx); /* * Release this prison as requested, which may cause its parent * to be released, and then maybe its grandparent, etc. */ for (;;) { if (flags & PD_DEUREF) { + /* Drop a user reference. */ KASSERT(refcount_load(&pr->pr_uref) > 0, ("prison_deref PD_DEUREF on a dead prison (jid=%d)", pr->pr_id)); - lasturef = refcount_release(&pr->pr_uref); - if (lasturef) - refcount_acquire(&pr->pr_ref); - KASSERT(refcount_load(&prison0.pr_uref) > 0, - ("prison0 pr_uref=0")); - } else - lasturef = 0; + if (!refcount_release_if_not_last(&pr->pr_uref)) { + if (!(flags & PD_DEREF)) { + prison_hold(pr); + flags |= PD_DEREF; + } + flags = prison_lock_xlock(pr, flags); + if (refcount_release(&pr->pr_uref)) { + /* + * When the last user references goes, + * this becomes a dying prison. + */ + KASSERT( + refcount_load(&prison0.pr_uref) > 0, + ("prison0 pr_uref=0")); + mtx_unlock(&pr->pr_mtx); + flags &= ~PD_LOCKED; + (void)osd_jail_call(pr, + PR_METHOD_REMOVE, NULL); + } + } + } if (flags & PD_DEREF) { + /* Drop a reference. */ KASSERT(refcount_load(&pr->pr_ref) > 0, ("prison_deref PD_DEREF on a dead prison (jid=%d)", pr->pr_id)); - lastref = refcount_release(&pr->pr_ref); - } - else - lastref = refcount_load(&pr->pr_ref) == 0; - mtx_unlock(&pr->pr_mtx); - - /* - * Tell the modules if the last user reference was removed - * (even it sticks around in dying state). - */ - if (lasturef) { - if (!(flags & (PD_LIST_SLOCKED | PD_LIST_XLOCKED))) { - if (atomic_load_acq_int(&pr->pr_ref) > 1) { - sx_slock(&allprison_lock); - flags |= PD_LIST_SLOCKED; - } else { - sx_xlock(&allprison_lock); - flags |= PD_LIST_XLOCKED; + if (!refcount_release_if_not_last(&pr->pr_ref)) { + flags = prison_lock_xlock(pr, flags); + if (refcount_release(&pr->pr_ref)) { + /* + * When the last reference goes, + * unlink the prison and set it aside. + */ + KASSERT( + refcount_load(&pr->pr_uref) == 0, + ("prison_deref: last ref, " + "but still has %d urefs (jid=%d)", + pr->pr_uref, pr->pr_id)); + KASSERT( + refcount_load(&prison0.pr_ref) != 0, + ("prison0 pr_ref=0")); + TAILQ_REMOVE(&allprison, pr, pr_list); + LIST_REMOVE(pr, pr_sibling); + TAILQ_INSERT_TAIL(&freeprison, pr, + pr_list); + for (ppr = pr->pr_parent; + ppr != NULL; + ppr = ppr->pr_parent) + ppr->pr_childcount--; + /* + * Removing a prison frees references + * from its parent. + */ + mtx_unlock(&pr->pr_mtx); + flags &= ~PD_LOCKED; + pr = pr->pr_parent; + flags |= PD_DEREF | PD_DEUREF; + continue; } } - (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); - mtx_lock(&pr->pr_mtx); - lastref = refcount_release(&pr->pr_ref); - mtx_unlock(&pr->pr_mtx); } - - if (!lastref) - break; - - if (flags & PD_LIST_SLOCKED) { - if (!sx_try_upgrade(&allprison_lock)) { - sx_sunlock(&allprison_lock); - sx_xlock(&allprison_lock); - } - flags &= ~PD_LIST_SLOCKED; - } else if (!(flags & PD_LIST_XLOCKED)) - sx_xlock(&allprison_lock); - flags |= PD_LIST_XLOCKED; - - TAILQ_REMOVE(&allprison, pr, pr_list); - LIST_REMOVE(pr, pr_sibling); - TAILQ_INSERT_TAIL(&freeprison, pr, pr_list); - for (tpr = pr->pr_parent; tpr != NULL; tpr = tpr->pr_parent) - tpr->pr_childcount--; - - /* Removing a prison frees a reference on its parent. */ - pr = pr->pr_parent; - mtx_lock(&pr->pr_mtx); - flags |= PD_DEREF | PD_DEUREF; + break; } /* Release all the prison locks. */ + if (flags & PD_LOCKED) + mtx_unlock(&pr->pr_mtx); if (flags & PD_LIST_SLOCKED) sx_sunlock(&allprison_lock); else if (flags & PD_LIST_XLOCKED) @@ -2902,10 +2868,47 @@ prison_deref(struct prison *pr, int flags) if (racct_enable) prison_racct_detach(rpr); #endif + TAILQ_REMOVE(&freeprison, rpr, pr_list); free(rpr, M_PRISON); } } +/* + * Given the current locking state in the flags, make sure allprison_lock + * is held exclusive, and the prison is locked. Return flags indicating + * the new state. + */ +static int +prison_lock_xlock(struct prison *pr, int flags) +{ + + if (!(flags & PD_LIST_XLOCKED)) { + /* + * Get allprison_lock, which may be an upgrade, + * and may require unlocking the prison. + */ + if (flags & PD_LOCKED) { + mtx_unlock(&pr->pr_mtx); + flags &= ~PD_LOCKED; + } + if (flags & PD_LIST_SLOCKED) { + if (!sx_try_upgrade(&allprison_lock)) { + sx_sunlock(&allprison_lock); + sx_xlock(&allprison_lock); + } + flags &= ~PD_LIST_SLOCKED; + } else + sx_xlock(&allprison_lock); + flags |= PD_LIST_XLOCKED; + } + if (!(flags & PD_LOCKED)) { + /* Lock the prison mutex. */ + mtx_lock(&pr->pr_mtx); + flags |= PD_LOCKED; + } + return flags; +} + /* * Set or clear a permission bit in the pr_allow field, passing restrictions * (cleared permission) down to child jails. @@ -3068,15 +3071,13 @@ prison_ischild(struct prison *pr1, struct prison *pr2) } /* - * Return true if the prison is currently alive. A prison is alive if it is - * valid and holds user references, and it isn't being removed. + * Return true if the prison is currently alive. A prison is alive if it + * holds user references and it isn't being removed. */ bool prison_isalive(struct prison *pr) { - if (__predict_false(refcount_load(&pr->pr_ref) == 0)) - return (false); if (__predict_false(refcount_load(&pr->pr_uref) == 0)) return (false); if (__predict_false(pr->pr_flags & PR_REMOVE)) @@ -3087,7 +3088,9 @@ prison_isalive(struct prison *pr) /* * 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. + * are still considered valid. Invalid prisons won't be found under normal + * circumstances, as they're only put in that state by functions that have + * an exclusive hold on allprison_lock. */ bool prison_isvalid(struct prison *pr) @@ -3754,10 +3757,6 @@ sysctl_jail_list(SYSCTL_HANDLER_ARGS) cpr->pr_ip6s * sizeof(struct in6_addr)); } #endif - 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; diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index f048234f3a33..435235f0384d 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 (prison_isvalid(pr) && (pr->pr_allow & PR_ALLOW_SYSVIPC)) { + if (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 deee60d87a5a..dd8925246d1e 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 (prison_isvalid(pr) && (pr->pr_allow & PR_ALLOW_SYSVIPC)) { + if (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 ad5f0030b965..2e7ae927dcc3 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 (prison_isvalid(pr) && (pr->pr_allow & PR_ALLOW_SYSVIPC)) { + if (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 dc94ce213d08..5c1775a261fc 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -1564,29 +1564,26 @@ mqfs_prison_remove(void *obj, void *data __unused) const struct prison *pr = obj; struct prison *tpr; struct mqfs_node *pn, *tpn; - int found; + struct vnode *pr_root; - found = 0; + pr_root = pr->pr_root; + if (pr->pr_parent->pr_root == pr_root) + return (0); TAILQ_FOREACH(tpr, &allprison, pr_list) { - prison_lock(tpr); - if (tpr != pr && prison_isvalid(tpr) && - tpr->pr_root == pr->pr_root) - found = 1; - prison_unlock(tpr); + if (tpr != pr && tpr->pr_root == pr_root) + return (0); } - if (!found) { - /* - * No jails are rooted in this directory anymore, - * so no queues should be either. - */ - sx_xlock(&mqfs_data.mi_lock); - LIST_FOREACH_SAFE(pn, &mqfs_data.mi_root->mn_children, - mn_sibling, tpn) { - if (pn->mn_pr_root == pr->pr_root) - (void)do_unlink(pn, curthread->td_ucred); - } - sx_xunlock(&mqfs_data.mi_lock); + /* + * No jails are rooted in this directory anymore, + * so no queues should be either. + */ + sx_xlock(&mqfs_data.mi_lock); + LIST_FOREACH_SAFE(pn, &mqfs_data.mi_root->mn_children, + mn_sibling, tpn) { + if (pn->mn_pr_root == pr_root) + (void)do_unlink(pn, curthread->td_ucred); } + sx_xunlock(&mqfs_data.mi_lock); return (0); } diff --git a/sys/sys/jail.h b/sys/sys/jail.h index 2ac6aabdbd43..a48e189729dc 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -155,7 +155,8 @@ struct prison_racct; * (m) locked by pr_mtx * (p) locked by pr_mtx, and also at least shared allprison_lock required * to update - * (r) atomic via refcount(9), pr_mtx required to decrement to zero + * (r) atomic via refcount(9), pr_mtx and allprison_lock required to + * decrement to zero */ struct prison { TAILQ_ENTRY(prison) pr_list; /* (a) all prisons */ From owner-dev-commits-src-all@freebsd.org Fri Mar 12 18:34:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BEB35A980F; Fri, 12 Mar 2021 18:34: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 4DxvcF44VZz4hTt; Fri, 12 Mar 2021 18:34: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 7E6A51C534; Fri, 12 Mar 2021 18:34: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 12CIYbrh032455; Fri, 12 Mar 2021 18:34:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CIYbIJ032454; Fri, 12 Mar 2021 18:34:37 GMT (envelope-from git) Date: Fri, 12 Mar 2021 18:34:37 GMT Message-Id: <202103121834.12CIYbIJ032454@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jonathan T. Looney" Subject: git: dbec10e08808 - main - Fetch the sigfastblock value in syscalls that wait for signals MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jtl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dbec10e08808e375365fb2a2462f306e0cdfda32 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 18:34:37 -0000 The branch main has been updated by jtl: URL: https://cgit.FreeBSD.org/src/commit/?id=dbec10e08808e375365fb2a2462f306e0cdfda32 commit dbec10e08808e375365fb2a2462f306e0cdfda32 Author: Jonathan T. Looney AuthorDate: 2021-03-12 18:14:17 +0000 Commit: Jonathan T. Looney CommitDate: 2021-03-12 18:14:17 +0000 Fetch the sigfastblock value in syscalls that wait for signals We have seen several cases of processes which have become "stuck" in kern_sigsuspend(). When this occurs, the kernel's td_sigblock_val is set to 0x10 (one block outstanding) and the userspace copy of the word is set to 0 (unblocked). Because the kernel's cached value shows that signals are blocked, kern_sigsuspend() blocks almost all signals, which means the process hangs indefinitely in sigsuspend(). It is not entirely clear what is causing this condition to occur. However, it seems to make sense to add some protection against this case by fetching the latest sigfastblock value from userspace for syscalls which will sleep waiting for signals. Here, the change is applied to kern_sigsuspend() and kern_sigtimedwait(). Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29225 --- sys/kern/kern_sig.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 7884b5be9f91..3d55405d3151 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1268,6 +1268,9 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, ksiginfo_t *ksi, ets.tv_nsec = 0; traced = false; + /* Ensure the sigfastblock value is up to date. */ + sigfastblock_fetch(td); + if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { timevalid = 1; @@ -1527,6 +1530,9 @@ kern_sigsuspend(struct thread *td, sigset_t mask) struct proc *p = td->td_proc; int has_sig, sig; + /* Ensure the sigfastblock value is up to date. */ + sigfastblock_fetch(td); + /* * When returning from sigsuspend, we want * the old mask to be restored after the From owner-dev-commits-src-all@freebsd.org Fri Mar 12 18:43:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EDDC5A9924; Fri, 12 Mar 2021 18:43: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 4Dxvq01nTqz4j51; Fri, 12 Mar 2021 18:43: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 307681CA9B; Fri, 12 Mar 2021 18:43: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 12CIhuvK045748; Fri, 12 Mar 2021 18:43:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CIhuAf045747; Fri, 12 Mar 2021 18:43:56 GMT (envelope-from git) Date: Fri, 12 Mar 2021 18:43:56 GMT Message-Id: <202103121843.12CIhuAf045747@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: ec24f78e5b20 - stable/13 - x86: tsc: deprioritize TSC on VirtualBox 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/stable/13 X-Git-Reftype: branch X-Git-Commit: ec24f78e5b201ea56a69607c6e4438a2faac25c0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 18:43:56 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ec24f78e5b201ea56a69607c6e4438a2faac25c0 commit ec24f78e5b201ea56a69607c6e4438a2faac25c0 Author: Kyle Evans AuthorDate: 2021-03-08 20:20:10 +0000 Commit: Kyle Evans CommitDate: 2021-03-12 18:43:43 +0000 x86: tsc: deprioritize TSC on VirtualBox Misbehavior has been observed with TSC under VirtualBox, where threads doing small sleeps (~1 second) may miss their wake up and hang around in a sleep state indefinitely. Switching back to ACPI-fast decidedly fixes it, so stop using TSC on VirtualBox at least for the time being. This partially reverts 84eaf2ccc6aa, applying it only to VirtualBox and increasing the quality to 0. Negative qualities can never be chosen and cannot be chosen with the tunable recently added. If we do not have a timecounter with a higher quality than 0, then TSC does at least leave the system mostly usable. PR: 253087 (cherry picked from commit 8cc15b0dfc2f3299662e78f18bd6127f83c14ab4) --- sys/x86/x86/tsc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index de0a1505c2f6..5ffbb64229e9 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -503,6 +503,14 @@ test_tsc(int adj_max_count) if ((!smp_tsc && !tsc_is_invariant)) return (-100); + /* + * Misbehavior of TSC under VirtualBox has been observed. In + * particular, threads doing small (~1 second) sleeps may miss their + * wakeup and hang around in sleep state, causing hangs on shutdown. + */ + if (vm_guest == VM_GUEST_VBOX) + return (0); + size = (mp_maxid + 1) * 3; data = malloc(sizeof(*data) * size * N, M_TEMP, M_WAITOK); adj = 0; From owner-dev-commits-src-all@freebsd.org Fri Mar 12 18:45:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF36A5A9862; Fri, 12 Mar 2021 18:45: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 4DxvrQ5zSjz4jDy; Fri, 12 Mar 2021 18:45: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 BE7EF1CA9C; Fri, 12 Mar 2021 18:45: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 12CIjAaP046153; Fri, 12 Mar 2021 18:45:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CIjAub046152; Fri, 12 Mar 2021 18:45:10 GMT (envelope-from git) Date: Fri, 12 Mar 2021 18:45:10 GMT Message-Id: <202103121845.12CIjAub046152@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: 05eac56a0432 - main - lib/msun: Fix x86 GCC6 build after 221622ec0c8e184 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: 05eac56a0432d07acd7f159125855437a4dd6259 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 18:45:10 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=05eac56a0432d07acd7f159125855437a4dd6259 commit 05eac56a0432d07acd7f159125855437a4dd6259 Author: Alex Richardson AuthorDate: 2021-03-12 18:44:42 +0000 Commit: Alex Richardson CommitDate: 2021-03-12 18:44:44 +0000 lib/msun: Fix x86 GCC6 build after 221622ec0c8e184 Apparently GCC only supports arithmetic expressions that use static const variables in initializers starting with GCC8. To keep older versions happy use a macro instead. Fixes: 221622ec0c ("lib/msun: Avoid FE_INEXACT for x86 log2l/log10l") Reported by: Jenkins Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D29233 --- lib/msun/ld80/s_logl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/msun/ld80/s_logl.c b/lib/msun/ld80/s_logl.c index d787b953fedb..c74519cafd69 100644 --- a/lib/msun/ld80/s_logl.c +++ b/lib/msun/ld80/s_logl.c @@ -674,14 +674,14 @@ logl(long double x) RETURNSPI(&r); } -static const double -invln10_hi = 4.3429448190317999e-1, /* 0x1bcb7b1526e000.0p-54 */ -invln10_lo = 7.1842412889749798e-14, /* 0x1438ca9aadd558.0p-96 */ -invln10_lo_plus_hi = invln10_lo + invln10_hi, -invln2_hi = 1.4426950408887933e0, /* 0x171547652b8000.0p-52 */ -invln2_lo = 1.7010652264631490e-13, /* 0x17f0bbbe87fed0.0p-95 */ -invln2_lo_plus_hi = invln2_lo + invln2_hi; - +/* Use macros since GCC < 8 rejects static const expressions in initializers. */ +#define invln10_hi 4.3429448190317999e-1 /* 0x1bcb7b1526e000.0p-54 */ +#define invln10_lo 7.1842412889749798e-14 /* 0x1438ca9aadd558.0p-96 */ +#define invln2_hi 1.4426950408887933e0 /* 0x171547652b8000.0p-52 */ +#define invln2_lo 1.7010652264631490e-13 /* 0x17f0bbbe87fed0.0p-95 */ +/* Let the compiler pre-calculate this sum to avoid FE_INEXACT at run time. */ +static const double invln10_lo_plus_hi = invln10_lo + invln10_hi; +static const double invln2_lo_plus_hi = invln2_lo + invln2_hi; long double log10l(long double x) From owner-dev-commits-src-all@freebsd.org Fri Mar 12 18:47:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1C1B5A9CD5; Fri, 12 Mar 2021 18:47: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 4DxvtY6WlDz4jYs; Fri, 12 Mar 2021 18:47: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 D0B5C1C861; Fri, 12 Mar 2021 18:47: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 12CIl1FK046643; Fri, 12 Mar 2021 18:47:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CIl1G7046642; Fri, 12 Mar 2021 18:47:01 GMT (envelope-from git) Date: Fri, 12 Mar 2021 18:47:01 GMT Message-Id: <202103121847.12CIl1G7046642@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: 2bfecbef9a57 - stable/13 - MFC jail: Add pr_state to struct prison 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2bfecbef9a57cd172fd734bff757168d30aa9512 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 18:47:02 -0000 The branch stable/13 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=2bfecbef9a57cd172fd734bff757168d30aa9512 commit 2bfecbef9a57cd172fd734bff757168d30aa9512 Author: Jamie Gritton AuthorDate: 2021-02-21 21:24:47 +0000 Commit: Jamie Gritton CommitDate: 2021-03-12 18:46:43 +0000 MFC jail: Add pr_state to struct prison Rather that using references (pr_ref and pr_uref) to deduce the state of a prison, keep track of its state explicitly. A prison is either "invalid" (pr_ref == 0), "alive" (pr_uref > 0) or "dying" (pr_uref == 0). State transitions are generally tied to the reference counts, but with some flexibility: a new prison is "invalid" even though it now starts with a reference, and jail_remove(2) sets the state to "dying" before the user reference count drops to zero (which was prviously accomplished via the PR_REMOVE flag). pr_state is protected by both the prison mutex and allprison_lock, so it has the same availablity guarantees as the reference counts do. Differential Revision: https://reviews.freebsd.org/D27876 (cherry picked from commit 1158508a8086a1a93492c1a2e22b61cd7fee4ec7) MFC jail: Fix a LOR introduced in 1158508a8086 (cherry picked from commit 701d6b50ae7b0b2b50fbd191c2dbd646ef3b4a67) --- sys/kern/kern_jail.c | 106 ++++++++++++++++++++++++++++----------------------- sys/sys/jail.h | 14 +++++-- 2 files changed, 69 insertions(+), 51 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 342af50462f2..04740924d1dd 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -106,6 +106,7 @@ struct prison prison0 = { .pr_path = "/", .pr_securelevel = -1, .pr_devfs_rsnum = 0, + .pr_state = PRISON_STATE_ALIVE, .pr_childmax = JAIL_MAX, .pr_hostuuid = DEFAULT_HOSTUUID, .pr_children = LIST_HEAD_INITIALIZER(prison0.pr_children), @@ -663,7 +664,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } ch_flags |= jsf->new | jsf->disable; } - if ((flags & (JAIL_CREATE | JAIL_UPDATE | JAIL_ATTACH)) == JAIL_CREATE + if ((flags & (JAIL_CREATE | JAIL_ATTACH)) == JAIL_CREATE && !(pr_flags & PR_PERSIST)) { error = EINVAL; vfs_opterror(opts, "new jail must persist or attach"); @@ -1198,6 +1199,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) /* This brings the parent back to life. */ mtx_lock(&ppr->pr_mtx); refcount_acquire(&ppr->pr_uref); + ppr->pr_state = PRISON_STATE_ALIVE; mtx_unlock(&ppr->pr_mtx); error = osd_jail_call(ppr, PR_METHOD_CREATE, opts); if (error) { @@ -1216,8 +1218,10 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } pr = malloc(sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO); - refcount_init(&pr->pr_ref, 0); + pr->pr_state = PRISON_STATE_INVALID; + refcount_init(&pr->pr_ref, 1); refcount_init(&pr->pr_uref, 0); + drflags |= PD_DEREF; LIST_INIT(&pr->pr_children); mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK); TASK_INIT(&pr->pr_task, 0, prison_complete, pr); @@ -1311,11 +1315,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) mtx_lock(&pr->pr_mtx); drflags |= PD_LOCKED; - /* - * New prisons do not yet have a reference, because we do not - * want others to see the incomplete prison once the - * allprison_lock is downgraded. - */ } else { /* * Grab a reference for existing prisons, to ensure they @@ -1737,14 +1736,17 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) prison_set_allow_locked(pr, tallow, 0); /* * Persistent prisons get an extra reference, and prisons losing their - * persist flag lose that reference. Only do this for existing prisons - * for now, so new ones will remain unseen until after the module - * handlers have completed. + * persist flag lose that reference. */ born = !prison_isalive(pr); - if (!created && (ch_flags & PR_PERSIST & (pr_flags ^ pr->pr_flags))) { + if (ch_flags & PR_PERSIST & (pr_flags ^ pr->pr_flags)) { if (pr_flags & PR_PERSIST) { prison_hold(pr); + /* + * This may make a dead prison alive again, but wait + * to label it as such until after OSD calls have had + * a chance to run (and perhaps to fail). + */ refcount_acquire(&pr->pr_uref); } else { drflags |= PD_DEUREF; @@ -1752,7 +1754,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } } pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; - pr->pr_flags &= ~PR_REMOVE; mtx_unlock(&pr->pr_mtx); drflags &= ~PD_LOCKED; @@ -1826,15 +1827,20 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) goto done_deref; } + /* + * A new prison is now ready to be seen; either it has gained a user + * reference via persistence, or is about to gain one via attachment. + */ + if (born) { + drflags = prison_lock_xlock(pr, drflags); + pr->pr_state = PRISON_STATE_ALIVE; + } + /* Attach this process to the prison if requested. */ if (flags & JAIL_ATTACH) { error = do_jail_attach(td, pr, prison_lock_xlock(pr, drflags)); drflags &= ~(PD_LOCKED | PD_LIST_XLOCKED); if (error) { - if (created) { - /* do_jail_attach has removed the prison. */ - pr = NULL; - } vfs_opterror(opts, "attach failed"); goto done_deref; } @@ -1842,6 +1848,10 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #ifdef RACCT if (racct_enable && !created) { + if (drflags & PD_LOCKED) { + mtx_unlock(&pr->pr_mtx); + drflags &= ~PD_LOCKED; + } if (drflags & PD_LIST_XLOCKED) { sx_xunlock(&allprison_lock); drflags &= ~PD_LIST_XLOCKED; @@ -1852,22 +1862,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) td->td_retval[0] = pr->pr_id; - if (created) { - /* - * Add a reference to newly created persistent prisons - * (which was not done earlier so that the prison would - * not be publicly visible). - */ - if (pr_flags & PR_PERSIST) { - drflags = prison_lock_xlock(pr, drflags); - refcount_acquire(&pr->pr_ref); - refcount_acquire(&pr->pr_uref); - } else { - /* Non-persistent jails need no further changes. */ - pr = NULL; - } - } - done_deref: /* Release any temporary prison holds and/or locks. */ if (pr != NULL) @@ -2332,7 +2326,7 @@ static void prison_remove_one(struct prison *pr) { struct proc *p; - int drflags; + int was_alive, drflags; drflags = PD_DEREF | PD_LOCKED | PD_LIST_XLOCKED; @@ -2340,7 +2334,8 @@ prison_remove_one(struct prison *pr) * Mark the prison as doomed, so it doesn't accidentally come back * to life. It may still be explicitly brought back by jail_set(2). */ - pr->pr_flags |= PR_REMOVE; + was_alive = pr->pr_state == PRISON_STATE_ALIVE; + pr->pr_state = PRISON_STATE_DYING; /* If the prison was persistent, it is not anymore. */ if (pr->pr_flags & PR_PERSIST) { @@ -2361,9 +2356,14 @@ prison_remove_one(struct prison *pr) return; } + /* Tell modules this prison has died. */ mtx_unlock(&pr->pr_mtx); + drflags &= ~PD_LOCKED; + if (was_alive) + (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); + sx_xunlock(&allprison_lock); - drflags &= ~(PD_LOCKED | PD_LIST_XLOCKED); + drflags &= ~PD_LIST_XLOCKED; /* * Kill all processes unfortunate enough to be attached to this prison. */ @@ -2429,7 +2429,7 @@ do_jail_attach(struct thread *td, struct prison *pr, int drflags) * a process root from one prison, but attached to the jail * of another. */ - refcount_acquire(&pr->pr_ref); + prison_hold(pr); refcount_acquire(&pr->pr_uref); drflags |= PD_DEREF | PD_DEUREF; mtx_unlock(&pr->pr_mtx); @@ -2721,6 +2721,12 @@ prison_proc_free(struct prison *pr) * prison_free() won't re-submit the task. */ prison_hold(pr); + mtx_lock(&pr->pr_mtx); + KASSERT(!(pr->pr_flags & PR_COMPLETE_PROC), + ("Redundant last reference in prison_proc_free (jid=%d)", + pr->pr_id)); + pr->pr_flags |= PR_COMPLETE_PROC; + mtx_unlock(&pr->pr_mtx); taskqueue_enqueue(taskqueue_thread, &pr->pr_task); } } @@ -2735,14 +2741,14 @@ prison_complete(void *context, int pending) int drflags; /* - * This could be called to release the last reference, or the - * last user reference; the existence of a user reference implies - * the latter. There will always be a reference to remove, as - * prison_proc_free adds one. + * This could be called to release the last reference, or the last + * user reference (plus the reference held in prison_proc_free). */ drflags = prison_lock_xlock(pr, PD_DEREF); - if (refcount_load(&pr->pr_uref) > 0) + if (pr->pr_flags & PR_COMPLETE_PROC) { + pr->pr_flags &= ~PR_COMPLETE_PROC; drflags |= PD_DEUREF; + } prison_deref(pr, drflags); } @@ -2777,7 +2783,8 @@ prison_deref(struct prison *pr, int flags) flags |= PD_DEREF; } flags = prison_lock_xlock(pr, flags); - if (refcount_release(&pr->pr_uref)) { + if (refcount_release(&pr->pr_uref) && + pr->pr_state == PRISON_STATE_ALIVE) { /* * When the last user references goes, * this becomes a dying prison. @@ -2785,6 +2792,7 @@ prison_deref(struct prison *pr, int flags) KASSERT( refcount_load(&prison0.pr_uref) > 0, ("prison0 pr_uref=0")); + pr->pr_state = PRISON_STATE_DYING; mtx_unlock(&pr->pr_mtx); flags &= ~PD_LOCKED; (void)osd_jail_call(pr, @@ -2812,6 +2820,7 @@ prison_deref(struct prison *pr, int flags) KASSERT( refcount_load(&prison0.pr_ref) != 0, ("prison0 pr_ref=0")); + pr->pr_state = PRISON_STATE_INVALID; TAILQ_REMOVE(&allprison, pr, pr_list); LIST_REMOVE(pr, pr_sibling); TAILQ_INSERT_TAIL(&freeprison, pr, @@ -3078,9 +3087,7 @@ bool prison_isalive(struct prison *pr) { - if (__predict_false(refcount_load(&pr->pr_uref) == 0)) - return (false); - if (__predict_false(pr->pr_flags & PR_REMOVE)) + if (__predict_false(pr->pr_state != PRISON_STATE_ALIVE)) return (false); return (true); } @@ -3096,6 +3103,8 @@ bool prison_isvalid(struct prison *pr) { + if (__predict_false(pr->pr_state == PRISON_STATE_INVALID)) + return (false); if (__predict_false(refcount_load(&pr->pr_ref) == 0)) return (false); return (true); @@ -3760,8 +3769,7 @@ sysctl_jail_list(SYSCTL_HANDLER_ARGS) bzero(xp, sizeof(*xp)); xp->pr_version = XPRISON_VERSION; xp->pr_id = cpr->pr_id; - xp->pr_state = prison_isalive(cpr) - ? PRISON_STATE_ALIVE : PRISON_STATE_DYING; + xp->pr_state = cpr->pr_state; strlcpy(xp->pr_path, prison_path(pr, cpr), sizeof(xp->pr_path)); strlcpy(xp->pr_host, cpr->pr_hostname, sizeof(xp->pr_host)); strlcpy(xp->pr_name, prison_name(pr, cpr), sizeof(xp->pr_name)); @@ -4412,6 +4420,10 @@ db_show_prison(struct prison *pr) db_printf(" parent = %p\n", pr->pr_parent); db_printf(" ref = %d\n", pr->pr_ref); db_printf(" uref = %d\n", pr->pr_uref); + db_printf(" state = %s\n", + pr->pr_state == PRISON_STATE_ALIVE ? "alive" : + pr->pr_state == PRISON_STATE_DYING ? "dying" : + "invalid"); db_printf(" path = %s\n", pr->pr_path); db_printf(" cpuset = %d\n", pr->pr_cpuset ? pr->pr_cpuset->cs_id : -1); diff --git a/sys/sys/jail.h b/sys/sys/jail.h index a48e189729dc..723a1fff0b82 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -88,9 +88,11 @@ struct xprison { }; #define XPRISON_VERSION 3 -#define PRISON_STATE_INVALID 0 -#define PRISON_STATE_ALIVE 1 -#define PRISON_STATE_DYING 2 +enum prison_state { + PRISON_STATE_INVALID = 0, /* New prison, not ready to be seen */ + PRISON_STATE_ALIVE, /* Current prison, visible to all */ + PRISON_STATE_DYING /* Removed but holding resources, */ +}; /* optionally visible. */ /* * Flags for jail_set and jail_get. @@ -155,6 +157,7 @@ struct prison_racct; * (m) locked by pr_mtx * (p) locked by pr_mtx, and also at least shared allprison_lock required * to update + * (q) locked by both pr_mtx and allprison_lock * (r) atomic via refcount(9), pr_mtx and allprison_lock required to * decrement to zero */ @@ -185,7 +188,8 @@ struct prison { int pr_securelevel; /* (p) securelevel */ int pr_enforce_statfs; /* (p) statfs permission */ int pr_devfs_rsnum; /* (p) devfs ruleset */ - int pr_spare[3]; + enum prison_state pr_state; /* (q) state in life cycle */ + int pr_spare[2]; int pr_osreldate; /* (c) kern.osreldate value */ unsigned long pr_hostid; /* (p) jail hostid */ char pr_name[MAXHOSTNAMELEN]; /* (p) admin jail name */ @@ -222,6 +226,8 @@ struct prison_racct { /* by this jail or an ancestor */ #define PR_IP6 0x04000000 /* IPv6 restricted or disabled */ /* by this jail or an ancestor */ +#define PR_COMPLETE_PROC 0x08000000 /* prison_complete called from */ + /* prison_proc_free, releases uref */ /* * Flags for pr_allow From owner-dev-commits-src-all@freebsd.org Fri Mar 12 18:48:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDE105A99E0; Fri, 12 Mar 2021 18:48: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 4DxvwX5wh6z4jM3; Fri, 12 Mar 2021 18:48: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 BE1561C55F; Fri, 12 Mar 2021 18:48: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 12CImiPn047099; Fri, 12 Mar 2021 18:48:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CImi2T047098; Fri, 12 Mar 2021 18:48:44 GMT (envelope-from git) Date: Fri, 12 Mar 2021 18:48:44 GMT Message-Id: <202103121848.12CImi2T047098@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: 246339530348 - stable/13 - MFC jail: Add PD_KILL to remove a prison in prison_deref(). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2463395303482ad8d32d90ec990e5312d72105c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 18:48:44 -0000 The branch stable/13 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=2463395303482ad8d32d90ec990e5312d72105c6 commit 2463395303482ad8d32d90ec990e5312d72105c6 Author: Jamie Gritton AuthorDate: 2021-02-22 20:27:44 +0000 Commit: Jamie Gritton CommitDate: 2021-03-12 18:48:20 +0000 MFC jail: Add PD_KILL to remove a prison in prison_deref(). Add the PD_KILL flag that instructs prison_deref() to take steps to actively kill a prison and its descendents, namely marking it PRISON_STATE_DYING, clearing its PR_PERSIST flag, and killing any attached processes. This replaces a similar loop in sys_jail_remove(), bringing the operation under the same single hold on allprison_lock that it already has. It is also used to clean up failed jail (re-)creations in kern_jail_set(), which didn't generally take all the proper steps. Differential Revision: https://reviews.freebsd.org/D28473 (cherry picked from commit 811e27fa3c445664e36071a7d08228fc7fb85676) MFC jail: back out 811e27fa3c44 until it doesn't break Jenkins Reported by: arichardson (cherry picked from commit ddfffb41a22d4798a036fe2d30e59694ba7cdad3) MFC jail: re-commit 811e27fa3c44 with fixes Make sure PD_KILL isn't passed to do_jail_attach, where it might end up trying to kill the caller's prison (even prison0). Fix the child jail loop in prison_deref_kill, which was doing the post-order part during the pre-order part. That's not a system- killer, but make jails not always die correctly. (cherry picked from commit c861373bdff90d8167a0d998899ca718ccdb541b) MFC jail: Add safety around prison_deref() flags. do_jail_attach() now only uses the PD_XXX flags that refer to lock status, so make sure that something else like PD_KILL doesn't slip through. Add a KASSERT() in prison_deref() to catch any further PD_KILL misuse. (cherry picked from commit 589e4c1df4a6e4b1368f26fc7fef704a2e5cb42c) --- sys/kern/kern_jail.c | 268 +++++++++++++++++++++++++++++++++------------------ sys/sys/jail.h | 13 +++ 2 files changed, 187 insertions(+), 94 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 04740924d1dd..547fca778dcf 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -141,12 +141,13 @@ static int get_next_prid(struct prison **insprp); static int do_jail_attach(struct thread *td, struct prison *pr, int drflags); static void prison_complete(void *context, int pending); static void prison_deref(struct prison *pr, int flags); +static void prison_deref_kill(struct prison *pr, struct prisonlist *freeprison); static int prison_lock_xlock(struct prison *pr, int flags); static void prison_free_not_last(struct prison *pr); +static void prison_proc_free_not_last(struct prison *pr); static void prison_set_allow_locked(struct prison *pr, unsigned flag, int enable); static char *prison_path(struct prison *pr1, struct prison *pr2); -static void prison_remove_one(struct prison *pr); #ifdef RACCT static void prison_racct_attach(struct prison *pr); static void prison_racct_modify(struct prison *pr); @@ -156,9 +157,12 @@ static void prison_racct_detach(struct prison *pr); /* Flags for prison_deref */ #define PD_DEREF 0x01 /* Decrement pr_ref */ #define PD_DEUREF 0x02 /* Decrement pr_uref */ -#define PD_LOCKED 0x04 /* pr_mtx is held */ -#define PD_LIST_SLOCKED 0x08 /* allprison_lock is held shared */ -#define PD_LIST_XLOCKED 0x10 /* allprison_lock is held exclusive */ +#define PD_KILL 0x04 /* Remove jail, kill processes, etc */ +#define PD_LOCKED 0x10 /* pr_mtx is held */ +#define PD_LIST_SLOCKED 0x20 /* allprison_lock is held shared */ +#define PD_LIST_XLOCKED 0x40 /* allprison_lock is held exclusive */ +#define PD_OP_FLAGS 0x07 /* Operation flags */ +#define PD_LOCK_FLAGS 0x70 /* Lock status flags */ /* * Parameter names corresponding to PR_* flag values. Size values are for kvm @@ -1756,6 +1760,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; mtx_unlock(&pr->pr_mtx); drflags &= ~PD_LOCKED; + /* + * Any errors past this point will need to de-persist newly created + * prisons, as well as call remove methods. + */ + if (born) + drflags |= PD_KILL; #ifdef RACCT if (racct_enable && created) @@ -1815,17 +1825,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) /* Let the modules do their work. */ if (born) { error = osd_jail_call(pr, PR_METHOD_CREATE, opts); - if (error) { - (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); + if (error) goto done_deref; - } } error = osd_jail_call(pr, PR_METHOD_SET, opts); - if (error) { - if (born) - (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); + if (error) goto done_deref; - } /* * A new prison is now ready to be seen; either it has gained a user @@ -1838,7 +1843,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) /* Attach this process to the prison if requested. */ if (flags & JAIL_ATTACH) { - error = do_jail_attach(td, pr, prison_lock_xlock(pr, drflags)); + error = do_jail_attach(td, pr, + prison_lock_xlock(pr, drflags & PD_LOCK_FLAGS)); drflags &= ~(PD_LOCKED | PD_LIST_XLOCKED); if (error) { vfs_opterror(opts, "attach failed"); @@ -1860,6 +1866,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } #endif + drflags &= ~PD_KILL; td->td_retval[0] = pr->pr_id; done_deref: @@ -2283,8 +2290,8 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) int sys_jail_remove(struct thread *td, struct jail_remove_args *uap) { - struct prison *pr, *cpr, *lpr; - int descend, error; + struct prison *pr; + int error; error = priv_check(td, PRIV_JAIL_REMOVE); if (error) @@ -2296,90 +2303,16 @@ sys_jail_remove(struct thread *td, struct jail_remove_args *uap) sx_xunlock(&allprison_lock); return (EINVAL); } - - /* Remove all descendants of this prison, then remove this prison. */ - prison_hold(pr); - if (!LIST_EMPTY(&pr->pr_children)) { + if (!prison_isalive(pr)) { + /* Silently ignore already-dying prisons. */ mtx_unlock(&pr->pr_mtx); - lpr = NULL; - FOREACH_PRISON_DESCENDANT(pr, cpr, descend) { - prison_hold(cpr); - if (lpr != NULL) { - mtx_lock(&lpr->pr_mtx); - prison_remove_one(lpr); - sx_xlock(&allprison_lock); - } - lpr = cpr; - } - if (lpr != NULL) { - mtx_lock(&lpr->pr_mtx); - prison_remove_one(lpr); - sx_xlock(&allprison_lock); - } - mtx_lock(&pr->pr_mtx); + sx_xunlock(&allprison_lock); + return (0); } - prison_remove_one(pr); + prison_deref(pr, PD_KILL | PD_LOCKED | PD_LIST_XLOCKED); return (0); } -static void -prison_remove_one(struct prison *pr) -{ - struct proc *p; - int was_alive, drflags; - - drflags = PD_DEREF | PD_LOCKED | PD_LIST_XLOCKED; - - /* - * Mark the prison as doomed, so it doesn't accidentally come back - * to life. It may still be explicitly brought back by jail_set(2). - */ - was_alive = pr->pr_state == PRISON_STATE_ALIVE; - pr->pr_state = PRISON_STATE_DYING; - - /* If the prison was persistent, it is not anymore. */ - if (pr->pr_flags & PR_PERSIST) { - drflags |= PD_DEUREF; - prison_free_not_last(pr); - pr->pr_flags &= ~PR_PERSIST; - } - - /* - * jail_remove added a reference. If that's the only one, remove - * the prison now. refcount(9) doesn't guarantee the cache coherence - * of non-zero counters, so force it here. - */ - KASSERT(refcount_load(&pr->pr_ref) > 0, - ("prison_remove_one removing a dead prison (jid=%d)", pr->pr_id)); - if (atomic_load_acq_int(&pr->pr_ref) == 1) { - prison_deref(pr, drflags); - return; - } - - /* Tell modules this prison has died. */ - mtx_unlock(&pr->pr_mtx); - drflags &= ~PD_LOCKED; - if (was_alive) - (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); - - sx_xunlock(&allprison_lock); - drflags &= ~PD_LIST_XLOCKED; - /* - * Kill all processes unfortunate enough to be attached to this prison. - */ - sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { - PROC_LOCK(p); - if (p->p_state != PRS_NEW && p->p_ucred && - p->p_ucred->cr_prison == pr) - kern_psignal(p, SIGKILL); - PROC_UNLOCK(p); - } - sx_sunlock(&allproc_lock); - /* Remove the temporary reference added by jail_remove. */ - prison_deref(pr, drflags); -} - /* * struct jail_attach_args { * int jid; @@ -2421,6 +2354,7 @@ do_jail_attach(struct thread *td, struct prison *pr, int drflags) mtx_assert(&pr->pr_mtx, MA_OWNED); sx_assert(&allprison_lock, SX_LOCKED); + drflags &= PD_LOCK_FLAGS; /* * XXX: Note that there is a slight race here if two threads * in the same privileged process attempt to attach to two @@ -2731,6 +2665,24 @@ prison_proc_free(struct prison *pr) } } +static void +prison_proc_free_not_last(struct prison *pr) +{ +#ifdef INVARIANTS + int lastref; + + KASSERT(refcount_load(&pr->pr_uref) > 0, + ("Trying to free dead prison %p (jid=%d).", + pr, pr->pr_id)); + lastref = refcount_release(&pr->pr_uref); + KASSERT(!lastref, + ("prison_proc_free_not_last freed last uref on prison %p (jid=%d).", + pr, pr->pr_id)); +#else + refcount_release(&pr->pr_uref); +#endif +} + /* * Complete a call to either prison_free or prison_proc_free. */ @@ -2764,14 +2716,27 @@ static void prison_deref(struct prison *pr, int flags) { struct prisonlist freeprison; - struct prison *rpr, *ppr, *tpr; + struct prison *killpr, *rpr, *ppr, *tpr; + struct proc *p; + killpr = NULL; TAILQ_INIT(&freeprison); /* * Release this prison as requested, which may cause its parent * to be released, and then maybe its grandparent, etc. */ for (;;) { + if (flags & PD_KILL) { + /* Kill the prison and its descendents. */ + KASSERT(pr != &prison0, + ("prison_deref trying to kill prison0")); + if (!(flags & PD_DEREF)) { + prison_hold(pr); + flags |= PD_DEREF; + } + flags = prison_lock_xlock(pr, flags); + prison_deref_kill(pr, &freeprison); + } if (flags & PD_DEUREF) { /* Drop a user reference. */ KASSERT(refcount_load(&pr->pr_uref) > 0, @@ -2800,6 +2765,17 @@ prison_deref(struct prison *pr, int flags) } } } + if (flags & PD_KILL) { + /* + * Any remaining user references are probably processes + * that need to be killed, either in this prison or its + * descendants. + */ + if (refcount_load(&pr->pr_uref) > 0) + killpr = pr; + /* Make sure the parent prison doesn't get killed. */ + flags &= ~PD_KILL; + } if (flags & PD_DEREF) { /* Drop a reference. */ KASSERT(refcount_load(&pr->pr_ref) > 0, @@ -2852,6 +2828,25 @@ prison_deref(struct prison *pr, int flags) else if (flags & PD_LIST_XLOCKED) sx_xunlock(&allprison_lock); + /* Kill any processes attached to a killed prison. */ + if (killpr != NULL) { + sx_slock(&allproc_lock); + FOREACH_PROC_IN_SYSTEM(p) { + PROC_LOCK(p); + if (p->p_state != PRS_NEW && p->p_ucred != NULL) { + for (ppr = p->p_ucred->cr_prison; + ppr != &prison0; + ppr = ppr->pr_parent) + if (ppr == killpr) { + kern_psignal(p, SIGKILL); + break; + } + } + PROC_UNLOCK(p); + } + sx_sunlock(&allproc_lock); + } + /* * Finish removing any unreferenced prisons, which couldn't happen * while allprison_lock was held (to avoid a LOR on vrele). @@ -2882,6 +2877,91 @@ prison_deref(struct prison *pr, int flags) } } +/* + * Kill the prison and its descendants. Mark them as dying, clear the + * persist flag, and call module remove methods. + */ +static void +prison_deref_kill(struct prison *pr, struct prisonlist *freeprison) +{ + struct prison *cpr, *ppr, *rpr; + bool descend; + + /* + * Unlike the descendants, the target prison can be killed + * even if it is currently dying. This is useful for failed + * creation in jail_set(2). + */ + KASSERT(refcount_load(&pr->pr_ref) > 0, + ("Trying to kill dead prison %p (jid=%d).", + pr, pr->pr_id)); + refcount_acquire(&pr->pr_uref); + pr->pr_state = PRISON_STATE_DYING; + mtx_unlock(&pr->pr_mtx); + + rpr = NULL; + FOREACH_PRISON_DESCENDANT_PRE_POST(pr, cpr, descend) { + if (descend) { + if (!prison_isalive(cpr)) { + descend = false; + continue; + } + prison_hold(cpr); + prison_proc_hold(cpr); + mtx_lock(&cpr->pr_mtx); + cpr->pr_state = PRISON_STATE_DYING; + cpr->pr_flags |= PR_REMOVE; + mtx_unlock(&cpr->pr_mtx); + continue; + } + if (!(cpr->pr_flags & PR_REMOVE)) + continue; + (void)osd_jail_call(cpr, PR_METHOD_REMOVE, NULL); + mtx_lock(&cpr->pr_mtx); + cpr->pr_flags &= ~PR_REMOVE; + if (cpr->pr_flags & PR_PERSIST) { + cpr->pr_flags &= ~PR_PERSIST; + prison_proc_free_not_last(cpr); + prison_free_not_last(cpr); + } + (void)refcount_release(&cpr->pr_uref); + if (refcount_release(&cpr->pr_ref)) { + /* + * When the last reference goes, unlink the prison + * and set it aside for prison_deref() to handle. + * Delay unlinking the sibling list to keep the loop + * safe. + */ + if (rpr != NULL) + LIST_REMOVE(rpr, pr_sibling); + rpr = cpr; + rpr->pr_state = PRISON_STATE_INVALID; + TAILQ_REMOVE(&allprison, rpr, pr_list); + TAILQ_INSERT_TAIL(freeprison, rpr, pr_list); + /* + * Removing a prison frees references from its parent. + */ + ppr = rpr->pr_parent; + prison_proc_free_not_last(ppr); + prison_free_not_last(ppr); + for (; ppr != NULL; ppr = ppr->pr_parent) + ppr->pr_childcount--; + } + mtx_unlock(&cpr->pr_mtx); + } + if (rpr != NULL) + LIST_REMOVE(rpr, pr_sibling); + + (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); + mtx_lock(&pr->pr_mtx); + if (pr->pr_flags & PR_PERSIST) { + pr->pr_flags &= ~PR_PERSIST; + prison_proc_free_not_last(pr); + prison_free_not_last(pr); + } + (void)refcount_release(&pr->pr_uref); +} + /* * Given the current locking state in the flags, make sure allprison_lock * is held exclusive, and the prison is locked. Return flags indicating diff --git a/sys/sys/jail.h b/sys/sys/jail.h index 723a1fff0b82..c9d4c65e4d9e 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -341,6 +341,19 @@ prison_unlock(struct prison *pr) ; \ else +/* + * Traverse a prison's descendants, visiting both preorder and postorder. + */ +#define FOREACH_PRISON_DESCENDANT_PRE_POST(ppr, cpr, descend) \ + for ((cpr) = (ppr), (descend) = 1; \ + ((cpr) = (descend) \ + ? ((descend) = !LIST_EMPTY(&(cpr)->pr_children)) \ + ? LIST_FIRST(&(cpr)->pr_children) \ + : (cpr) \ + : ((descend) = LIST_NEXT(cpr, pr_sibling) != NULL) \ + ? LIST_NEXT(cpr, pr_sibling) \ + : cpr->pr_parent) != (ppr);) + /* * Attributes of the physical system, and the root of the jail tree. */ From owner-dev-commits-src-all@freebsd.org Fri Mar 12 18:49:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCC765A9F0F; Fri, 12 Mar 2021 18:49: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 4Dxvxx5wBqz4jdB; Fri, 12 Mar 2021 18:49: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 BDDFA1CC08; Fri, 12 Mar 2021 18:49: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 12CInvXO047437; Fri, 12 Mar 2021 18:49:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CInvSA047436; Fri, 12 Mar 2021 18:49:57 GMT (envelope-from git) Date: Fri, 12 Mar 2021 18:49:57 GMT Message-Id: <202103121849.12CInvSA047436@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: d2bbfc375487 - stable/13 - MFC jail: Don't allow jails under dying parents 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d2bbfc3754871f08e487ac59e5c03a088c8acad2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 18:49:58 -0000 The branch stable/13 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=d2bbfc3754871f08e487ac59e5c03a088c8acad2 commit d2bbfc3754871f08e487ac59e5c03a088c8acad2 Author: Jamie Gritton AuthorDate: 2021-02-23 01:04:06 +0000 Commit: Jamie Gritton CommitDate: 2021-03-12 18:49:13 +0000 MFC jail: Don't allow jails under dying parents If a jail is created with jail_set(...JAIL_DYING), and it has a parent currently in a dying state, that will bring the parent jail back to life. Restrict that to require that the parent itself be explicitly brought back first, and not implicitly created along with the new child jail. Differential Revision: https://reviews.freebsd.org/D28515 (cherry picked from commit 0a2a96f35a4c2dab3486438680fa289e12971e4b) MFC jail: Fix locking on an early jail_set error. I had locked allprison_lock without immediately setting PD_LIST_LOCKED. (cherry picked from commit 108a9384e9e945cccba73c959f7e9cdb023cbcad) --- sys/kern/kern_jail.c | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 547fca778dcf..b5c8f6ebf9be 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -992,7 +992,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * This abuses the file error codes ENOENT and EEXIST. */ pr = NULL; - ppr = mypr; inspr = NULL; if (cuflags == JAIL_CREATE && jid == 0 && name != NULL) { namelc = strrchr(name, '.'); @@ -1002,6 +1001,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } sx_xlock(&allprison_lock); drflags = PD_LIST_XLOCKED; + ppr = mypr; + if (!prison_isalive(ppr)) { + /* This jail is dying. This process will surely follow. */ + error = EAGAIN; + goto done_deref; + } if (jid != 0) { if (jid < 0) { error = EINVAL; @@ -1024,7 +1029,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) break; } if (pr != NULL) { - ppr = pr->pr_parent; /* Create: jid must not exist. */ if (cuflags == JAIL_CREATE) { /* @@ -1046,6 +1050,13 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) vfs_opterror(opts, "jail %d not found", jid); goto done_deref; } + ppr = pr->pr_parent; + if (!prison_isalive(ppr)) { + error = ENOENT; + vfs_opterror(opts, "jail %d is dying", + ppr->pr_id); + goto done_deref; + } if (!prison_isalive(pr)) { if (!(flags & JAIL_DYING)) { error = ENOENT; @@ -1111,15 +1122,13 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) "jail \"%s\" not found", name); goto done_deref; } - if (!(flags & JAIL_DYING) && - !prison_isalive(ppr)) { - mtx_unlock(&ppr->pr_mtx); + mtx_unlock(&ppr->pr_mtx); + if (!prison_isalive(ppr)) { error = ENOENT; vfs_opterror(opts, "jail \"%s\" is dying", name); goto done_deref; } - mtx_unlock(&ppr->pr_mtx); *namelc = '.'; } namelc++; @@ -1198,26 +1207,9 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) vfs_opterror(opts, "prison limit exceeded"); goto done_deref; } - prison_hold(ppr); - if (!refcount_acquire_if_not_zero(&ppr->pr_uref)) { - /* This brings the parent back to life. */ - mtx_lock(&ppr->pr_mtx); - refcount_acquire(&ppr->pr_uref); - ppr->pr_state = PRISON_STATE_ALIVE; - mtx_unlock(&ppr->pr_mtx); - error = osd_jail_call(ppr, PR_METHOD_CREATE, opts); - if (error) { - pr = ppr; - drflags |= PD_DEREF | PD_DEUREF; - goto done_deref; - } - } - if (jid == 0 && (jid = get_next_prid(&inspr)) == 0) { error = EAGAIN; vfs_opterror(opts, "no available jail IDs"); - pr = ppr; - drflags |= PD_DEREF | PD_DEUREF; goto done_deref; } @@ -1237,6 +1229,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) TAILQ_INSERT_TAIL(&allprison, pr, pr_list); pr->pr_parent = ppr; + prison_hold(ppr); + prison_proc_hold(ppr); LIST_INSERT_HEAD(&ppr->pr_children, pr, pr_sibling); for (tpr = ppr; tpr != NULL; tpr = tpr->pr_parent) tpr->pr_childcount++; From owner-dev-commits-src-all@freebsd.org Fri Mar 12 19:00:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BA525AA68C; Fri, 12 Mar 2021 19:00: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 4Dxw9x1fkCz4kqt; Fri, 12 Mar 2021 19:00: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 2B8E61CACD; Fri, 12 Mar 2021 19:00: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 12CJ0LSJ068538; Fri, 12 Mar 2021 19:00:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CJ0LIo068537; Fri, 12 Mar 2021 19:00:21 GMT (envelope-from git) Date: Fri, 12 Mar 2021 19:00:21 GMT Message-Id: <202103121900.12CJ0LIo068537@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: 8f885fd1f381 - main - ccr: Set the RX channel ID correctly in work requests. 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: 8f885fd1f38159a06db82d680fa259f358e9f872 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 19:00:21 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8f885fd1f38159a06db82d680fa259f358e9f872 commit 8f885fd1f38159a06db82d680fa259f358e9f872 Author: John Baldwin AuthorDate: 2021-03-12 18:35:05 +0000 Commit: John Baldwin CommitDate: 2021-03-12 18:59:35 +0000 ccr: Set the RX channel ID correctly in work requests. These fixes are only relevant for requests on the second port. In some cases, the crypto completion data, completion message, and receive descriptor could be written in the wrong order. - Add a separate rx_channel_id that is a copy of the port's rx_c_chan and use it when an RX channel ID is required in crypto requests instead of using the tx_channel_id. - Set the correct rx_channel_id in the CPL_RX_PHYS_ADDR used to write the crypto result. - Set the FID to the first rx queue ID on the adapter rather than the queue ID of the first rx queue for the port. - While here, use tx_chan to set the tx_channel_id though this is identical to the previous value. Reviewed by: np Reported by: Chelsio QA Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29175 --- sys/dev/cxgbe/crypto/t4_crypto.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index 8861e710cfd2..46ea9d778fe3 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -165,6 +165,7 @@ struct ccr_session_blkcipher { struct ccr_port { struct sge_wrq *txq; struct sge_rxq *rxq; + int rx_channel_id; int tx_channel_id; u_int active_sessions; }; @@ -207,6 +208,7 @@ struct ccr_softc { bool detaching; struct ccr_port ports[MAX_NPORTS]; u_int port_mask; + int first_rxq_id; /* * Pre-allocate a dummy output buffer for the IV and AAD for @@ -333,6 +335,7 @@ ccr_write_phys_dsgl(struct ccr_session *s, void *dst, int nsegs) cpl->rss_hdr_int.opcode = CPL_RX_PHYS_ADDR; cpl->rss_hdr_int.qid = htobe16(s->port->rxq->iq.abs_id); cpl->rss_hdr_int.hash_val = 0; + cpl->rss_hdr_int.channel = s->port->rx_channel_id; sgl = (struct phys_sge_pairs *)(cpl + 1); j = 0; for (i = 0; i < sg->sg_nseg; i++) { @@ -423,12 +426,12 @@ ccr_populate_wreq(struct ccr_softc *sc, struct ccr_session *s, V_FW_CRYPTO_LOOKASIDE_WR_LEN16(wr_len / 16)); crwr->wreq.session_id = 0; crwr->wreq.rx_chid_to_rx_q_id = htobe32( - V_FW_CRYPTO_LOOKASIDE_WR_RX_CHID(s->port->tx_channel_id) | + V_FW_CRYPTO_LOOKASIDE_WR_RX_CHID(s->port->rx_channel_id) | V_FW_CRYPTO_LOOKASIDE_WR_LCB(0) | V_FW_CRYPTO_LOOKASIDE_WR_PHASH(0) | V_FW_CRYPTO_LOOKASIDE_WR_IV(IV_NOP) | V_FW_CRYPTO_LOOKASIDE_WR_FQIDX(0) | - V_FW_CRYPTO_LOOKASIDE_WR_TX_CH(0) | + V_FW_CRYPTO_LOOKASIDE_WR_TX_CH(0) | /* unused in firmware */ V_FW_CRYPTO_LOOKASIDE_WR_RX_Q_ID(s->port->rxq->iq.abs_id)); crwr->wreq.key_addr = 0; crwr->wreq.pld_size_hash_size = htobe32( @@ -440,7 +443,7 @@ ccr_populate_wreq(struct ccr_softc *sc, struct ccr_session *s, V_ULP_TXPKT_DATAMODIFY(0) | V_ULP_TXPKT_CHANNELID(s->port->tx_channel_id) | V_ULP_TXPKT_DEST(0) | - V_ULP_TXPKT_FID(s->port->rxq->iq.abs_id) | V_ULP_TXPKT_RO(1)); + V_ULP_TXPKT_FID(sc->first_rxq_id) | V_ULP_TXPKT_RO(1)); crwr->ulptx.len = htobe32( ((wr_len - sizeof(struct fw_crypto_lookaside_wr)) / 16)); @@ -525,7 +528,7 @@ ccr_hash(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) crwr->sec_cpl.op_ivinsrtofst = htobe32( V_CPL_TX_SEC_PDU_OPCODE(CPL_TX_SEC_PDU) | - V_CPL_TX_SEC_PDU_RXCHID(s->port->tx_channel_id) | + V_CPL_TX_SEC_PDU_RXCHID(s->port->rx_channel_id) | V_CPL_TX_SEC_PDU_ACKFOLLOWS(0) | V_CPL_TX_SEC_PDU_ULPTXLPBK(1) | V_CPL_TX_SEC_PDU_CPLLEN(2) | V_CPL_TX_SEC_PDU_PLACEHOLDER(0) | V_CPL_TX_SEC_PDU_IVINSRTOFST(0)); @@ -685,7 +688,7 @@ ccr_blkcipher(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) crwr->sec_cpl.op_ivinsrtofst = htobe32( V_CPL_TX_SEC_PDU_OPCODE(CPL_TX_SEC_PDU) | - V_CPL_TX_SEC_PDU_RXCHID(s->port->tx_channel_id) | + V_CPL_TX_SEC_PDU_RXCHID(s->port->rx_channel_id) | V_CPL_TX_SEC_PDU_ACKFOLLOWS(0) | V_CPL_TX_SEC_PDU_ULPTXLPBK(1) | V_CPL_TX_SEC_PDU_CPLLEN(2) | V_CPL_TX_SEC_PDU_PLACEHOLDER(0) | V_CPL_TX_SEC_PDU_IVINSRTOFST(1)); @@ -986,7 +989,7 @@ ccr_eta(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) crwr->sec_cpl.op_ivinsrtofst = htobe32( V_CPL_TX_SEC_PDU_OPCODE(CPL_TX_SEC_PDU) | - V_CPL_TX_SEC_PDU_RXCHID(s->port->tx_channel_id) | + V_CPL_TX_SEC_PDU_RXCHID(s->port->rx_channel_id) | V_CPL_TX_SEC_PDU_ACKFOLLOWS(0) | V_CPL_TX_SEC_PDU_ULPTXLPBK(1) | V_CPL_TX_SEC_PDU_CPLLEN(2) | V_CPL_TX_SEC_PDU_PLACEHOLDER(0) | V_CPL_TX_SEC_PDU_IVINSRTOFST(1)); @@ -1293,7 +1296,7 @@ ccr_gcm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) crwr->sec_cpl.op_ivinsrtofst = htobe32( V_CPL_TX_SEC_PDU_OPCODE(CPL_TX_SEC_PDU) | - V_CPL_TX_SEC_PDU_RXCHID(s->port->tx_channel_id) | + V_CPL_TX_SEC_PDU_RXCHID(s->port->rx_channel_id) | V_CPL_TX_SEC_PDU_ACKFOLLOWS(0) | V_CPL_TX_SEC_PDU_ULPTXLPBK(1) | V_CPL_TX_SEC_PDU_CPLLEN(2) | V_CPL_TX_SEC_PDU_PLACEHOLDER(0) | V_CPL_TX_SEC_PDU_IVINSRTOFST(1)); @@ -1768,7 +1771,7 @@ ccr_ccm(struct ccr_softc *sc, struct ccr_session *s, struct cryptop *crp) crwr->sec_cpl.op_ivinsrtofst = htobe32( V_CPL_TX_SEC_PDU_OPCODE(CPL_TX_SEC_PDU) | - V_CPL_TX_SEC_PDU_RXCHID(s->port->tx_channel_id) | + V_CPL_TX_SEC_PDU_RXCHID(s->port->rx_channel_id) | V_CPL_TX_SEC_PDU_ACKFOLLOWS(0) | V_CPL_TX_SEC_PDU_ULPTXLPBK(1) | V_CPL_TX_SEC_PDU_CPLLEN(2) | V_CPL_TX_SEC_PDU_PLACEHOLDER(0) | V_CPL_TX_SEC_PDU_IVINSRTOFST(1)); @@ -2131,11 +2134,13 @@ ccr_sysctls(struct ccr_softc *sc) static void ccr_init_port(struct ccr_softc *sc, int port) { + struct port_info *pi; + pi = sc->adapter->port[port]; sc->ports[port].txq = &sc->adapter->sge.ctrlq[port]; - sc->ports[port].rxq = - &sc->adapter->sge.rxq[sc->adapter->port[port]->vi->first_rxq]; - sc->ports[port].tx_channel_id = port; + sc->ports[port].rxq = &sc->adapter->sge.rxq[pi->vi->first_rxq]; + sc->ports[port].rx_channel_id = pi->rx_c_chan; + sc->ports[port].tx_channel_id = pi->tx_chan; _Static_assert(sizeof(sc->port_mask) * NBBY >= MAX_NPORTS - 1, "Too many ports to fit in port_mask"); sc->port_mask |= 1u << port; @@ -2163,6 +2168,12 @@ ccr_attach(device_t dev) sc->cid = cid; sc->adapter->ccr_softc = sc; + /* + * The FID must be the first RXQ for port 0 regardless of + * which port is used to service the request. + */ + sc->first_rxq_id = sc->adapter->sge.rxq[0].iq.abs_id; + mtx_init(&sc->lock, "ccr", NULL, MTX_DEF); sc->iv_aad_buf = malloc(MAX_AAD_LEN, M_CCR, M_WAITOK); sc->sg_iv_aad = sglist_build(sc->iv_aad_buf, MAX_AAD_LEN, M_WAITOK); From owner-dev-commits-src-all@freebsd.org Fri Mar 12 19:00:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 604AE5AA61B; Fri, 12 Mar 2021 19:00: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 4Dxw9y2Gvyz4kZH; Fri, 12 Mar 2021 19:00: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 411801CC94; Fri, 12 Mar 2021 19:00: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 12CJ0Mki068560; Fri, 12 Mar 2021 19:00:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CJ0MgI068559; Fri, 12 Mar 2021 19:00:22 GMT (envelope-from git) Date: Fri, 12 Mar 2021 19:00:22 GMT Message-Id: <202103121900.12CJ0MgI068559@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: 9c5137beb5f2 - main - ccr: Add per-port stats of queued and completed requests. 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: 9c5137beb5f28292410888d0770bdf24c15e1312 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 19:00:22 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9c5137beb5f28292410888d0770bdf24c15e1312 commit 9c5137beb5f28292410888d0770bdf24c15e1312 Author: John Baldwin AuthorDate: 2021-03-12 18:35:32 +0000 Commit: John Baldwin CommitDate: 2021-03-12 18:59:35 +0000 ccr: Add per-port stats of queued and completed requests. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29176 --- sys/dev/cxgbe/crypto/t4_crypto.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index 46ea9d778fe3..8cb5924c6b4c 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -168,6 +168,9 @@ struct ccr_port { int rx_channel_id; int tx_channel_id; u_int active_sessions; + + counter_u64_t stats_queued; + counter_u64_t stats_completed; }; struct ccr_session { @@ -2128,6 +2131,11 @@ ccr_sysctls(struct ccr_softc *sc) SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "active_sessions", CTLFLAG_RD, &sc->ports[i].active_sessions, 0, "Count of active sessions"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "queued", + CTLFLAG_RD, &sc->ports[i].stats_queued, "Requests queued"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "completed", + CTLFLAG_RD, &sc->ports[i].stats_completed, + "Requests completed"); } } @@ -2141,6 +2149,8 @@ ccr_init_port(struct ccr_softc *sc, int port) sc->ports[port].rxq = &sc->adapter->sge.rxq[pi->vi->first_rxq]; sc->ports[port].rx_channel_id = pi->rx_c_chan; sc->ports[port].tx_channel_id = pi->tx_chan; + sc->ports[port].stats_queued = counter_u64_alloc(M_WAITOK); + sc->ports[port].stats_completed = counter_u64_alloc(M_WAITOK); _Static_assert(sizeof(sc->port_mask) * NBBY >= MAX_NPORTS - 1, "Too many ports to fit in port_mask"); sc->port_mask |= 1u << port; @@ -2199,10 +2209,19 @@ ccr_attach(device_t dev) return (0); } +static void +ccr_free_port(struct ccr_softc *sc, int port) +{ + + counter_u64_free(sc->ports[port].stats_queued); + counter_u64_free(sc->ports[port].stats_completed); +} + static int ccr_detach(device_t dev) { struct ccr_softc *sc; + int i; sc = device_get_softc(dev); @@ -2230,6 +2249,9 @@ ccr_detach(device_t dev) counter_u64_free(sc->stats_sglist_error); counter_u64_free(sc->stats_process_error); counter_u64_free(sc->stats_sw_fallback); + for_each_port(sc->adapter, i) { + ccr_free_port(sc, i); + } sglist_free(sc->sg_iv_aad); free(sc->iv_aad_buf, M_CCR); sc->adapter->ccr_softc = NULL; @@ -2827,6 +2849,7 @@ ccr_process(device_t dev, struct cryptop *crp, int hint) s->pending++; #endif counter_u64_add(sc->stats_inflight, 1); + counter_u64_add(s->port->stats_queued, 1); } else counter_u64_add(sc->stats_process_error, 1); @@ -2871,6 +2894,7 @@ do_cpl6_fw_pld(struct sge_iq *iq, const struct rss_header *rss, mtx_unlock(&s->lock); #endif counter_u64_add(sc->stats_inflight, -1); + counter_u64_add(s->port->stats_completed, 1); switch (s->mode) { case HASH: From owner-dev-commits-src-all@freebsd.org Fri Mar 12 19:00:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CEB785AA0EC; Fri, 12 Mar 2021 19:00: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 4Dxw9z4PhFz4khm; Fri, 12 Mar 2021 19:00: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 7D0AD1CACE; Fri, 12 Mar 2021 19:00: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 12CJ0NYN068579; Fri, 12 Mar 2021 19:00:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CJ0Nj5068578; Fri, 12 Mar 2021 19:00:23 GMT (envelope-from git) Date: Fri, 12 Mar 2021 19:00:23 GMT Message-Id: <202103121900.12CJ0Nj5068578@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: 5fe0cd6503d3 - main - ccr: Disable requests on port 1 when needed to workaround a firmware bug. 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: 5fe0cd6503d34d23c98e9e1ff7bf10340218a5ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 19:00:24 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5fe0cd6503d34d23c98e9e1ff7bf10340218a5ec commit 5fe0cd6503d34d23c98e9e1ff7bf10340218a5ec Author: John Baldwin AuthorDate: 2021-03-12 18:35:56 +0000 Commit: John Baldwin CommitDate: 2021-03-12 18:59:35 +0000 ccr: Disable requests on port 1 when needed to workaround a firmware bug. Completions for crypto requests on port 1 can sometimes return a stale cookie value due to a firmware bug. Disable requests on port 1 by default on affected firmware. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D26581 --- sys/dev/cxgbe/crypto/t4_crypto.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/crypto/t4_crypto.c b/sys/dev/cxgbe/crypto/t4_crypto.c index 8cb5924c6b4c..cdd14fcee2f9 100644 --- a/sys/dev/cxgbe/crypto/t4_crypto.c +++ b/sys/dev/cxgbe/crypto/t4_crypto.c @@ -2153,7 +2153,15 @@ ccr_init_port(struct ccr_softc *sc, int port) sc->ports[port].stats_completed = counter_u64_alloc(M_WAITOK); _Static_assert(sizeof(sc->port_mask) * NBBY >= MAX_NPORTS - 1, "Too many ports to fit in port_mask"); - sc->port_mask |= 1u << port; + + /* + * Completions for crypto requests on port 1 can sometimes + * return a stale cookie value due to a firmware bug. Disable + * requests on port 1 by default on affected firmware. + */ + if (sc->adapter->params.fw_vers >= FW_VERSION32(1, 25, 4, 0) || + port == 0) + sc->port_mask |= 1u << port; } static int From owner-dev-commits-src-all@freebsd.org Fri Mar 12 19:06:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 801855AAA06; Fri, 12 Mar 2021 19:06:24 +0000 (UTC) (envelope-from dim@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 4DxwJw2pT7z4lRw; Fri, 12 Mar 2021 19:06:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "R3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 3929E2AFBA; Fri, 12 Mar 2021 19:06:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58:0:b893:f361:9800:e767] (unknown [IPv6:2001:470:7a58:0:b893:f361:9800:e767]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 645493CF18; Fri, 12 Mar 2021 20:06:22 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_764D54AA-739C-41C1-9479-859C5B8F8314"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 05eac56a0432 - main - lib/msun: Fix x86 GCC6 build after 221622ec0c8e184 Date: Fri, 12 Mar 2021 20:06:13 +0100 In-Reply-To: <202103121845.12CIjAub046152@gitrepo.freebsd.org> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Alex Richardson References: <202103121845.12CIjAub046152@gitrepo.freebsd.org> X-Mailer: Apple Mail (2.3654.60.0.2.21) X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 19:06:24 -0000 --Apple-Mail=_764D54AA-739C-41C1-9479-859C5B8F8314 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 12 Mar 2021, at 19:45, Alex Richardson = wrote: >=20 > The branch main has been updated by arichardson: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D05eac56a0432d07acd7f159125855437= a4dd6259 >=20 > commit 05eac56a0432d07acd7f159125855437a4dd6259 > Author: Alex Richardson > AuthorDate: 2021-03-12 18:44:42 +0000 > Commit: Alex Richardson > CommitDate: 2021-03-12 18:44:44 +0000 >=20 > lib/msun: Fix x86 GCC6 build after 221622ec0c8e184 >=20 > Apparently GCC only supports arithmetic expressions that use static > const variables in initializers starting with GCC8. To keep older > versions happy use a macro instead. >=20 > Fixes: 221622ec0c ("lib/msun: Avoid FE_INEXACT for x86 = log2l/log10l") > Reported by: Jenkins > Reviewed By: imp > Differential Revision: https://reviews.freebsd.org/D29233 Since gcc 6 is EOLed by upstream, why are we still running CI with it? Isn't it time to upgrade the CI compiler(s), so these kludges don't have to be used anymore? -Dimitry --Apple-Mail=_764D54AA-739C-41C1-9479-859C5B8F8314 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCYEu7pQAKCRCwXqMKLiCW o225AJ4rfbxpSWkb3yXP3z8CaJUPhQcS7wCeMMY22fZ6c4DzWXWWSwfcqLAsWYM= =C7K4 -----END PGP SIGNATURE----- --Apple-Mail=_764D54AA-739C-41C1-9479-859C5B8F8314-- From owner-dev-commits-src-all@freebsd.org Fri Mar 12 19:45:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BF655ABB26; Fri, 12 Mar 2021 19:45:17 +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 4Dxx9n1Hk7z4nNp; Fri, 12 Mar 2021 19:45:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 64C082B56E; Fri, 12 Mar 2021 19:45:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 05eac56a0432 - main - lib/msun: Fix x86 GCC6 build after 221622ec0c8e184 To: Dimitry Andric , Alex Richardson Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202103121845.12CIjAub046152@gitrepo.freebsd.org> From: John Baldwin Message-ID: <5f6cc88d-5c16-2438-1aca-b2531d2cb9ae@FreeBSD.org> Date: Fri, 12 Mar 2021 11:45:11 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 19:45:17 -0000 On 3/12/21 11:06 AM, Dimitry Andric wrote: > On 12 Mar 2021, at 19:45, Alex Richardson wrote: >> >> The branch main has been updated by arichardson: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=05eac56a0432d07acd7f159125855437a4dd6259 >> >> commit 05eac56a0432d07acd7f159125855437a4dd6259 >> Author: Alex Richardson >> AuthorDate: 2021-03-12 18:44:42 +0000 >> Commit: Alex Richardson >> CommitDate: 2021-03-12 18:44:44 +0000 >> >> lib/msun: Fix x86 GCC6 build after 221622ec0c8e184 >> >> Apparently GCC only supports arithmetic expressions that use static >> const variables in initializers starting with GCC8. To keep older >> versions happy use a macro instead. >> >> Fixes: 221622ec0c ("lib/msun: Avoid FE_INEXACT for x86 log2l/log10l") >> Reported by: Jenkins >> Reviewed By: imp >> Differential Revision: https://reviews.freebsd.org/D29233 > > Since gcc 6 is EOLed by upstream, why are we still running CI with it? > Isn't it time to upgrade the CI compiler(s), so these kludges don't have > to be used anymore? I'm trying, but we still don't build with GCC 9 yet everywhere. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Fri Mar 12 20:50:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC7E25AD2CD; Fri, 12 Mar 2021 20: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 4DxycV4YjZz4rqp; Fri, 12 Mar 2021 20:50: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 8AD901E601; Fri, 12 Mar 2021 20:50: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 12CKo2V8006269; Fri, 12 Mar 2021 20:50:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CKo2ER006266; Fri, 12 Mar 2021 20:50:02 GMT (envelope-from git) Date: Fri, 12 Mar 2021 20:50:02 GMT Message-Id: <202103122050.12CKo2ER006266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7381bbee29df - main - cam: Run all XPT_ASYNC ccbs in a dedicated thread MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7381bbee29df959e88ec59866cf2878263e7f3b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 20:50:02 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7381bbee29df959e88ec59866cf2878263e7f3b2 commit 7381bbee29df959e88ec59866cf2878263e7f3b2 Author: Warner Losh AuthorDate: 2021-03-12 20:20:52 +0000 Commit: Warner Losh CommitDate: 2021-03-12 20:29:42 +0000 cam: Run all XPT_ASYNC ccbs in a dedicated thread Queue all XPT_ASYNC ccb's and run those in a new cam async thread. This thread is allowed to sleep for things like memory. This should allow us to make all the registration routines for cam periph drivers simpler since they can assume they can always allocate memory. This is a separate thread so that any I/O that's completed in xpt_done_td isn't held up. This should fix the panics for WAITOK alloations that are elsewhere in the storage stack that aren't so easy to convert to NOWAIT. Additional future work will convert other allocations in the registration path to WAITOK should detailed analysis show it to be safe. Reviewed by: chs@, rpokala@ Differential Revision: https://reviews.freebsd.org/D29210 --- sys/cam/cam.h | 5 +++-- sys/cam/cam_xpt.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/sys/cam/cam.h b/sys/cam/cam.h index 2aaa2e3a5775..70813f92ad10 100644 --- a/sys/cam/cam.h +++ b/sys/cam/cam.h @@ -94,8 +94,9 @@ typedef struct { u_int32_t generation; int index; #define CAM_UNQUEUED_INDEX -1 -#define CAM_ACTIVE_INDEX -2 -#define CAM_DONEQ_INDEX -3 +#define CAM_ACTIVE_INDEX -2 +#define CAM_DONEQ_INDEX -3 +#define CAM_ASYNC_INDEX -4 #define CAM_EXTRAQ_INDEX INT_MAX } cam_pinfo; diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 9cfee80a6049..24e16bebb2e7 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -180,6 +180,7 @@ struct cam_doneq { static struct cam_doneq cam_doneqs[MAXCPU]; static u_int __read_mostly cam_num_doneqs; static struct proc *cam_proc; +static struct cam_doneq cam_async; SYSCTL_INT(_kern_cam, OID_AUTO, num_doneqs, CTLFLAG_RDTUN, &cam_num_doneqs, 0, "Number of completion queues/threads"); @@ -271,6 +272,7 @@ static void xptpoll(struct cam_sim *sim); static void camisr_runqueue(void); static void xpt_done_process(struct ccb_hdr *ccb_h); static void xpt_done_td(void *); +static void xpt_async_td(void *); static dev_match_ret xptbusmatch(struct dev_match_pattern *patterns, u_int num_patterns, struct cam_eb *bus); static dev_match_ret xptdevicematch(struct dev_match_pattern *patterns, @@ -972,6 +974,15 @@ xpt_init(void *dummy) return (ENOMEM); } + mtx_init(&cam_async.cam_doneq_mtx, "CAM async", NULL, MTX_DEF); + STAILQ_INIT(&cam_async.cam_doneq); + if (kproc_kthread_add(xpt_async_td, &cam_async, + &cam_proc, NULL, 0, 0, "cam", "async") != 0) { + printf("xpt_init: Cannot init async thread " + "- failing attach\n"); + return (ENOMEM); + } + /* * Register a callback for when interrupts are enabled. */ @@ -3146,8 +3157,16 @@ call_sim: xpt_done(start_ccb); break; case XPT_ASYNC: + /* + * Queue the async operation so it can be run from a sleepable + * context. + */ start_ccb->ccb_h.status = CAM_REQ_CMP; - xpt_done(start_ccb); + mtx_lock(&cam_async.cam_doneq_mtx); + STAILQ_INSERT_TAIL(&cam_async.cam_doneq, &start_ccb->ccb_h, sim_links.stqe); + start_ccb->ccb_h.pinfo.index = CAM_ASYNC_INDEX; + mtx_unlock(&cam_async.cam_doneq_mtx); + wakeup(&cam_async.cam_doneq); break; default: case XPT_SDEV_TYPE: @@ -5472,6 +5491,34 @@ xpt_done_process(struct ccb_hdr *ccb_h) mtx_unlock(mtx); } +/* + * Parameterize instead and use xpt_done_td? + */ +static void +xpt_async_td(void *arg) +{ + struct cam_doneq *queue = arg; + struct ccb_hdr *ccb_h; + STAILQ_HEAD(, ccb_hdr) doneq; + + STAILQ_INIT(&doneq); + mtx_lock(&queue->cam_doneq_mtx); + while (1) { + while (STAILQ_EMPTY(&queue->cam_doneq)) + msleep(&queue->cam_doneq, &queue->cam_doneq_mtx, + PRIBIO, "-", 0); + STAILQ_CONCAT(&doneq, &queue->cam_doneq); + mtx_unlock(&queue->cam_doneq_mtx); + + while ((ccb_h = STAILQ_FIRST(&doneq)) != NULL) { + STAILQ_REMOVE_HEAD(&doneq, sim_links.stqe); + xpt_done_process(ccb_h); + } + + mtx_lock(&queue->cam_doneq_mtx); + } +} + void xpt_done_td(void *arg) { From owner-dev-commits-src-all@freebsd.org Fri Mar 12 22:07:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D01005AECD0; Fri, 12 Mar 2021 22:07: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 4Dy0KX5b4Rz3C4J; Fri, 12 Mar 2021 22:07: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 AECF01EFD2; Fri, 12 Mar 2021 22:07: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 12CM7Cgf010873; Fri, 12 Mar 2021 22:07:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12CM7Ctx010872; Fri, 12 Mar 2021 22:07:12 GMT (envelope-from git) Date: Fri, 12 Mar 2021 22:07:12 GMT Message-Id: <202103122207.12CM7Ctx010872@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Jeremy Subject: git: 07564e176201 - main - arm64: Add support for the RK805/RK808 RTC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: peterj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 07564e1762010ba7e8ef5a7574bf9ceee811e95c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 22:07:12 -0000 The branch main has been updated by peterj: URL: https://cgit.FreeBSD.org/src/commit/?id=07564e1762010ba7e8ef5a7574bf9ceee811e95c commit 07564e1762010ba7e8ef5a7574bf9ceee811e95c Author: Peter Jeremy AuthorDate: 2021-03-12 22:06:04 +0000 Commit: Peter Jeremy CommitDate: 2021-03-12 22:06:04 +0000 arm64: Add support for the RK805/RK808 RTC Implement a driver for the RTC embedded in the RK805/RK808 power management system used for RK3328 and RK3399 SoCs. Based on experiments on my RK808, setting the time doesn't alter the internal/inaccessible sub-second counter, therefore there's no point in calling clock_schedule(). Based on an earlier revision by andrew. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D22692 Sponsored by: Google MFC after: 1 week --- sys/arm64/rockchip/rk805.c | 123 ++++++++++++++++++++++++++++++++++++++++-- sys/arm64/rockchip/rk805reg.h | 25 +++++++++ 2 files changed, 144 insertions(+), 4 deletions(-) diff --git a/sys/arm64/rockchip/rk805.c b/sys/arm64/rockchip/rk805.c index 19397627a8b0..d3e04081aeb2 100644 --- a/sys/arm64/rockchip/rk805.c +++ b/sys/arm64/rockchip/rk805.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -46,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include +#include "clock_if.h" #include "regdev_if.h" MALLOC_DEFINE(M_RK805_REG, "RK805 regulator", "RK805 power regulator"); @@ -356,10 +358,10 @@ rk805_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) } static int -rk805_write(device_t dev, uint8_t reg, uint8_t data) +rk805_write(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) { - return (iicdev_writeto(dev, reg, &data, 1, IIC_INTRWAIT)); + return (iicdev_writeto(dev, reg, data, size, IIC_INTRWAIT)); } static int @@ -415,7 +417,7 @@ rk805_regnode_enable(struct regnode *regnode, bool enable, int *udelay) val |= sc->def->enable_mask; else val &= ~sc->def->enable_mask; - rk805_write(sc->base_dev, sc->def->enable_reg, val); + rk805_write(sc->base_dev, sc->def->enable_reg, &val, 1); *udelay = 0; @@ -491,7 +493,7 @@ rk805_regnode_set_voltage(struct regnode *regnode, int min_uvolt, if (rk805_regnode_voltage_to_reg(sc, min_uvolt, max_uvolt, &val) != 0) return (ERANGE); - rk805_write(sc->base_dev, sc->def->voltage_reg, val); + rk805_write(sc->base_dev, sc->def->voltage_reg, &val, 1); rk805_read(sc->base_dev, sc->def->voltage_reg, &val, 1); @@ -624,9 +626,117 @@ rk805_start(void *pdev) device_printf(dev, "Chip Version: %x\n", data[1] & 0xf); } + /* Register this as a 1Hz clock */ + clock_register(dev, 1000000); + config_intrhook_disestablish(&sc->intr_hook); } +static int +rk805_gettime(device_t dev, struct timespec *ts) +{ + struct bcd_clocktime bct; + uint8_t data[7]; + uint8_t ctrl; + int error; + + /* Latch the RTC value into the shadow registers and set 24hr mode */ + error = rk805_read(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + + ctrl |= RK805_RTC_READSEL; + ctrl &= ~(RK805_RTC_AMPM_MODE | RK805_RTC_GET_TIME); + error = rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + ctrl |= RK805_RTC_GET_TIME; + error = rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + ctrl &= ~RK805_RTC_GET_TIME; + error = rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + + /* This works as long as RK805_RTC_SECS = 0 */ + error = rk805_read(dev, RK805_RTC_SECS, data, 7); + if (error != 0) + return (error); + + /* + * If the reported year is earlier than 2019, assume the clock is unset. + * This is both later than the reset value for the RK805 and RK808 as + * well as being prior to the current time. + */ + if (data[RK805_RTC_YEARS] < 0x19) + return (EINVAL); + + memset(&bct, 0, sizeof(bct)); + bct.year = data[RK805_RTC_YEARS]; + bct.mon = data[RK805_RTC_MONTHS] & RK805_RTC_MONTHS_MASK; + bct.day = data[RK805_RTC_DAYS] & RK805_RTC_DAYS_MASK; + bct.hour = data[RK805_RTC_HOURS] & RK805_RTC_HOURS_MASK; + bct.min = data[RK805_RTC_MINUTES] & RK805_RTC_MINUTES_MASK; + bct.sec = data[RK805_RTC_SECS] & RK805_RTC_SECS_MASK; + bct.dow = data[RK805_RTC_WEEKS] & RK805_RTC_WEEKS_MASK; + /* The day of week is reported as 1-7 with 1 = Monday */ + if (bct.dow == 7) + bct.dow = 0; + bct.ispm = 0; + + if (bootverbose) + device_printf(dev, "Read RTC: %02x-%02x-%02x %02x:%02x:%02x\n", + bct.year, bct.mon, bct.day, bct.hour, bct.min, bct.sec); + + return (clock_bcd_to_ts(&bct, ts, false)); +} + +static int +rk805_settime(device_t dev, struct timespec *ts) +{ + struct bcd_clocktime bct; + uint8_t data[7]; + int error; + uint8_t ctrl; + + clock_ts_to_bcd(ts, &bct, false); + + /* This works as long as RK805_RTC_SECS = 0 */ + data[RK805_RTC_YEARS] = bct.year; + data[RK805_RTC_MONTHS] = bct.mon; + data[RK805_RTC_DAYS] = bct.day; + data[RK805_RTC_HOURS] = bct.hour; + data[RK805_RTC_MINUTES] = bct.min; + data[RK805_RTC_SECS] = bct.sec; + data[RK805_RTC_WEEKS] = bct.dow; + /* The day of week is reported as 1-7 with 1 = Monday */ + if (data[RK805_RTC_WEEKS] == 0) + data[RK805_RTC_WEEKS] = 7; + + error = rk805_read(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + + ctrl |= RK805_RTC_CTRL_STOP; + ctrl &= ~RK805_RTC_AMPM_MODE; + error = rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + + error = rk805_write(dev, RK805_RTC_SECS, data, 7); + ctrl &= ~RK805_RTC_CTRL_STOP; + rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); + + if (bootverbose) + device_printf(dev, + "Set RTC at %04x-%02x-%02x %02x:%02x:%02x[.%09ld]\n", + bct.year, bct.mon, bct.day, bct.hour, bct.min, bct.sec, + bct.nsec); + + return (error); +} + static int rk805_attach(device_t dev) { @@ -724,6 +834,11 @@ static device_method_t rk805_methods[] = { /* regdev interface */ DEVMETHOD(regdev_map, rk805_map), + + /* Clock interface */ + DEVMETHOD(clock_gettime, rk805_gettime), + DEVMETHOD(clock_settime, rk805_settime), + DEVMETHOD_END }; diff --git a/sys/arm64/rockchip/rk805reg.h b/sys/arm64/rockchip/rk805reg.h index db489d77c26e..b1f4481a5b68 100644 --- a/sys/arm64/rockchip/rk805reg.h +++ b/sys/arm64/rockchip/rk805reg.h @@ -30,6 +30,31 @@ #ifndef _RK805REG_H_ #define _RK805REG_H_ +/* + * The RTC registers are the same in both RK805 and RK808. + * Note that the code assumes that RK805_RTC_SECS is 0 + */ +#define RK805_RTC_SECS 0x00 +#define RK805_RTC_SECS_MASK 0x7f +#define RK805_RTC_MINUTES 0x01 +#define RK805_RTC_MINUTES_MASK 0x7f +#define RK805_RTC_HOURS 0x02 +#define RK805_RTC_HOURS_MASK 0x3f +#define RK805_RTC_HOURS_PM 0x80 +#define RK805_RTC_DAYS 0x03 +#define RK805_RTC_DAYS_MASK 0x3f +#define RK805_RTC_MONTHS 0x04 +#define RK805_RTC_MONTHS_MASK 0x1f +#define RK805_RTC_YEARS 0x05 +#define RK805_RTC_WEEKS 0x06 /* day of week */ +#define RK805_RTC_WEEKS_MASK 0x07 + +#define RK805_RTC_CTRL 0x10 +#define RK805_RTC_CTRL_STOP (1 << 0) +#define RK805_RTC_AMPM_MODE (1 << 3) +#define RK805_RTC_GET_TIME (1 << 6) +#define RK805_RTC_READSEL (1 << 7) + #define RK805_CHIP_NAME 0x17 #define RK805_CHIP_VER 0x18 #define RK805_OTP_VER 0x19 From owner-dev-commits-src-all@freebsd.org Sat Mar 13 01:33:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B0DB5B4E06; Sat, 13 Mar 2021 01:33: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 4Dy4vk028Cz3RLy; Sat, 13 Mar 2021 01:33: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 E810121FA9; Sat, 13 Mar 2021 01:33: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 12D1XbZQ086100; Sat, 13 Mar 2021 01:33:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12D1Xb8Q086099; Sat, 13 Mar 2021 01:33:37 GMT (envelope-from git) Date: Sat, 13 Mar 2021 01:33:37 GMT Message-Id: <202103130133.12D1Xb8Q086099@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 51dfae383bf6 - main - [ath] validate ts_antenna before updating tx statistics MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51dfae383bf6298af9e6d816a78b92b6f34d68be Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 01:33:38 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=51dfae383bf6298af9e6d816a78b92b6f34d68be commit 51dfae383bf6298af9e6d816a78b92b6f34d68be Author: Adrian Chadd AuthorDate: 2021-03-13 01:29:09 +0000 Commit: Adrian Chadd CommitDate: 2021-03-13 01:33:07 +0000 [ath] validate ts_antenna before updating tx statistics Right now ts_antenna is either 0 or 1 in each supported HAL so this is purely a sanity check. Later on if I ever get magical free time I may add some extensions for the NICs that can have slightly more complicated antenna switches for transmit and I'd like this to not bust memory. --- sys/dev/ath/if_ath.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 34a9311c834a..0ef10e529dd5 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -4175,6 +4175,11 @@ ath_tx_update_stats(struct ath_softc *sc, struct ath_tx_status *ts, if (ts->ts_status == 0) { u_int8_t txant = ts->ts_antenna; + /* + * Handle weird/corrupted tx antenna field + */ + if (txant >= ATH_IOCTL_STATS_NUM_TX_ANTENNA) + txant = 0; sc->sc_stats.ast_ant_tx[txant]++; sc->sc_ant_tx[txant]++; if (ts->ts_finaltsi != 0) From owner-dev-commits-src-all@freebsd.org Sat Mar 13 03:16:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 274885B7A04; Sat, 13 Mar 2021 03:16: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 4Dy7BD0d6vz3p3t; Sat, 13 Mar 2021 03:16: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 0833723702; Sat, 13 Mar 2021 03:16: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 12D3GJ9j020324; Sat, 13 Mar 2021 03:16:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12D3GJfA020323; Sat, 13 Mar 2021 03:16:19 GMT (envelope-from git) Date: Sat, 13 Mar 2021 03:16:19 GMT Message-Id: <202103130316.12D3GJfA020323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 62694ac4a4db - stable/13 - Restore AT_RESOLVE_BENEATH support for funlinkat(2)/unlinkat(2). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 62694ac4a4db60275e04e3ccf4973436086551a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 03:16:20 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=62694ac4a4db60275e04e3ccf4973436086551a7 commit 62694ac4a4db60275e04e3ccf4973436086551a7 Author: Konstantin Belousov AuthorDate: 2021-03-05 02:07:57 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-13 02:52:01 +0000 Restore AT_RESOLVE_BENEATH support for funlinkat(2)/unlinkat(2). (cherry picked from commit ead7697f04c036853535a4281cec9aa09ef21270) --- sys/kern/vfs_syscalls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 52604d3da829..40dd8c069bfb 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1811,7 +1811,7 @@ kern_funlinkat_ex(struct thread *td, int dfd, const char *path, int fd, int flag, enum uio_seg pathseg, ino_t oldinum) { - if ((flag & ~AT_REMOVEDIR) != 0) + if ((flag & ~(AT_REMOVEDIR | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); if ((flag & AT_REMOVEDIR) != 0) From owner-dev-commits-src-all@freebsd.org Sat Mar 13 07:35:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C1CA56C440; Sat, 13 Mar 2021 07:35: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 4DyDxV6W8vz4WBB; Sat, 13 Mar 2021 07:35: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 D20EE26CB5; Sat, 13 Mar 2021 07:35: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 12D7Zgsw062295; Sat, 13 Mar 2021 07:35:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12D7ZgQf062294; Sat, 13 Mar 2021 07:35:42 GMT (envelope-from git) Date: Sat, 13 Mar 2021 07:35:42 GMT Message-Id: <202103130735.12D7ZgQf062294@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: fb3edd4f3ff8 - main - [ath] do a cold reset if TSFOOR triggers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb3edd4f3ff89f5883b8309ff71ff4a426279c85 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 07:35:43 -0000 The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=fb3edd4f3ff89f5883b8309ff71ff4a426279c85 commit fb3edd4f3ff89f5883b8309ff71ff4a426279c85 Author: Adrian Chadd AuthorDate: 2021-03-13 07:30:25 +0000 Commit: Adrian Chadd CommitDate: 2021-03-13 07:30:25 +0000 [ath] do a cold reset if TSFOOR triggers TSFOOR happens if a beacon with a given TSF isn't received within the programmed/expected TSF value, plus/minus a fudge range. (OOR == out of range.) If this happens then it could be because the baseband/mac is stuck, or the baseband is deaf. So, do a cold reset and resync the beacon to try and unstick the hardware. It also happens when a bad AP decides to err, slew its TSF because they themselves are resetting and they don't preserve the TSF "well." This has fixed a bunch of weird corner cases on my 2GHz AP radio upstairs here where it occasionally goes deaf due to how much 2GHz noise is up here (and ANI gets a little sideways) and this unsticks the station VAP. For AP modes a hung baseband/mac usually ends up as a stuck beacon and those have been addressed for a long time by just resetting the hardware. But similar hangs in station mode didn't have a similar recovery mechanism. Tested: * AR9380, STA mode, 2GHz/5GHz * AR9580, STA mode, 5GHz * QCA9344 SoC w/ on-board wifi (TL-WDR4300/3600 devices); 2GHz STA mode --- sys/dev/ath/if_ath.c | 50 ++++++++++++++++++++++++++++++++++++++++++----- sys/dev/ath/if_athioctl.h | 1 + sys/dev/ath/if_athvar.h | 1 + 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 0ef10e529dd5..698b8d1a2853 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -165,6 +165,7 @@ static void ath_parent(struct ieee80211com *); static void ath_fatal_proc(void *, int); static void ath_bmiss_vap(struct ieee80211vap *); static void ath_bmiss_proc(void *, int); +static void ath_tsfoor_proc(void *, int); static void ath_key_update_begin(struct ieee80211vap *); static void ath_key_update_end(struct ieee80211vap *); static void ath_update_mcast_hw(struct ath_softc *); @@ -761,6 +762,7 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) TASK_INIT(&sc->sc_rxtask, 0, sc->sc_rx.recv_tasklet, sc); TASK_INIT(&sc->sc_bmisstask, 0, ath_bmiss_proc, sc); + TASK_INIT(&sc->sc_tsfoortask, 0, ath_tsfoor_proc, sc); TASK_INIT(&sc->sc_bstucktask,0, ath_bstuck_proc, sc); TASK_INIT(&sc->sc_resettask,0, ath_reset_proc, sc); TASK_INIT(&sc->sc_txqtask, 0, ath_txq_sched_tasklet, sc); @@ -2333,13 +2335,18 @@ ath_intr(void *arg) sc->sc_stats.ast_rxorn++; } if (status & HAL_INT_TSFOOR) { - /* out of range beacon - wake the chip up, - * but don't modify self-gen frame config */ - device_printf(sc->sc_dev, "%s: TSFOOR\n", __func__); - sc->sc_syncbeacon = 1; + /* + * out of range beacon - wake the chip up, + * but don't modify self-gen frame config. + * Do a full reset to clear any potential stuck + * PHY/MAC that generated this condition. + */ + sc->sc_stats.ast_tsfoor++; ATH_LOCK(sc); ath_power_setpower(sc, HAL_PM_AWAKE, 0); ATH_UNLOCK(sc); + taskqueue_enqueue(sc->sc_tq, &sc->sc_tsfoortask); + device_printf(sc->sc_dev, "%s: TSFOOR\n", __func__); } if (status & HAL_INT_MCI) { ath_btcoex_mci_intr(sc); @@ -2483,7 +2490,7 @@ ath_bmiss_proc(void *arg, int pending) ath_beacon_miss(sc); /* - * Do a reset upon any becaon miss event. + * Do a reset upon any beacon miss event. * * It may be a non-recognised RX clear hang which needs a reset * to clear. @@ -2505,6 +2512,39 @@ ath_bmiss_proc(void *arg, int pending) ATH_UNLOCK(sc); } +/* + * Handle a TSF out of range interrupt in STA mode. + * + * This may be due to a partially deaf looking radio, so + * do a full reset just in case it is indeed deaf and + * resync the beacon. + */ +static void +ath_tsfoor_proc(void *arg, int pending) +{ + struct ath_softc *sc = arg; + + DPRINTF(sc, ATH_DEBUG_ANY, "%s: pending %u\n", __func__, pending); + + ATH_LOCK(sc); + ath_power_set_power_state(sc, HAL_PM_AWAKE); + ATH_UNLOCK(sc); + + /* + * Do a full reset after any TSFOOR. It's possible that + * we've gone deaf or partially deaf (eg due to calibration + * failures) and this should clean things up a bit. + */ + ath_reset(sc, ATH_RESET_NOLOSS, HAL_RESET_FORCE_COLD); + + /* Force a beacon resync, in case they've drifted */ + sc->sc_syncbeacon = 1; + + ATH_LOCK(sc); + ath_power_restore_power_state(sc); + ATH_UNLOCK(sc); +} + /* * Handle TKIP MIC setup to deal hardware that doesn't do MIC * calcs together with WME. If necessary disable the crypto diff --git a/sys/dev/ath/if_athioctl.h b/sys/dev/ath/if_athioctl.h index fec48bb4c890..5043cd8ab467 100644 --- a/sys/dev/ath/if_athioctl.h +++ b/sys/dev/ath/if_athioctl.h @@ -177,6 +177,7 @@ struct ath_stats { u_int32_t ast_tx_nodeq_overflow; /* node sw queue overflow */ u_int32_t ast_tx_ldpc; /* TX LDPC frame */ u_int32_t ast_tx_stbc; /* TX STBC frame */ + u_int32_t ast_tsfoor; /* TSFOOR interrupts */ u_int32_t ast_pad[10]; }; diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index 7817fe667281..1d2f842197cd 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -784,6 +784,7 @@ struct ath_softc { /* recent tx frames/antenna */ struct ath_txq *sc_cabq; /* tx q for cab frames */ struct task sc_bmisstask; /* bmiss int processing */ + struct task sc_tsfoortask; /* TSFOOR int processing */ struct task sc_bstucktask; /* stuck beacon processing */ struct task sc_resettask; /* interface reset task */ struct task sc_fataltask; /* fatal task */ From owner-dev-commits-src-all@freebsd.org Sat Mar 13 09:31:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D893B570055; Sat, 13 Mar 2021 09:31: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 4DyHWY5rn0z4cr3; Sat, 13 Mar 2021 09:31: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 BBBB868B; Sat, 13 Mar 2021 09:31: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 12D9Vrnq018782; Sat, 13 Mar 2021 09:31:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12D9VrP7018781; Sat, 13 Mar 2021 09:31:53 GMT (envelope-from git) Date: Sat, 13 Mar 2021 09:31:53 GMT Message-Id: <202103130931.12D9VrP7018781@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: 59146a6921d0 - main - zfs: make seqc asserts conditional on replay 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: 59146a6921d06d5cf4320dc8ed82810363ffe7c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 09:31:53 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=59146a6921d06d5cf4320dc8ed82810363ffe7c4 commit 59146a6921d06d5cf4320dc8ed82810363ffe7c4 Author: Mateusz Guzik AuthorDate: 2021-03-13 09:10:16 +0000 Commit: Mateusz Guzik CommitDate: 2021-03-13 09:31:49 +0000 zfs: make seqc asserts conditional on replay Avoids tripping on asserts when doing pool recovery. --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c | 9 ++++++--- sys/contrib/openzfs/module/zfs/zfs_replay.c | 5 ----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c index 23b87de8bd0d..7089d0e0e887 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_acl.c @@ -1141,10 +1141,11 @@ zfs_acl_chown_setattr(znode_t *zp) int error; zfs_acl_t *aclp; - if (zp->z_zfsvfs->z_replay == B_FALSE) + if (zp->z_zfsvfs->z_replay == B_FALSE) { ASSERT_VOP_ELOCKED(ZTOV(zp), __func__); + ASSERT_VOP_IN_SEQC(ZTOV(zp)); + } ASSERT(MUTEX_HELD(&zp->z_acl_lock)); - ASSERT_VOP_IN_SEQC(ZTOV(zp)); if ((error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE)) == 0) zp->z_mode = zfs_mode_compute(zp->z_mode, aclp, @@ -1172,7 +1173,9 @@ zfs_aclset_common(znode_t *zp, zfs_acl_t *aclp, cred_t *cr, dmu_tx_t *tx) int count = 0; zfs_acl_phys_t acl_phys; - ASSERT_VOP_IN_SEQC(ZTOV(zp)); + if (zp->z_zfsvfs->z_replay == B_FALSE) { + ASSERT_VOP_IN_SEQC(ZTOV(zp)); + } mode = zp->z_mode; diff --git a/sys/contrib/openzfs/module/zfs/zfs_replay.c b/sys/contrib/openzfs/module/zfs/zfs_replay.c index 53c7dbd5df43..cba5e8c9cd0b 100644 --- a/sys/contrib/openzfs/module/zfs/zfs_replay.c +++ b/sys/contrib/openzfs/module/zfs/zfs_replay.c @@ -859,12 +859,7 @@ zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap) zfsvfs->z_fuid_replay = zfs_replay_fuid_domain(start, &start, lr->lr_uid, lr->lr_gid); - /* - * Satisfy assertions. - */ - vn_seqc_write_begin(ZTOV(zp)); error = zfs_setattr(zp, vap, 0, kcred); - vn_seqc_write_end(ZTOV(zp)); zfs_fuid_info_free(zfsvfs->z_fuid_replay); zfsvfs->z_fuid_replay = NULL; From owner-dev-commits-src-all@freebsd.org Sat Mar 13 12:00:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC4CA574FFA; Sat, 13 Mar 2021 12:00: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 4DyLqW4m70z4nBC; Sat, 13 Mar 2021 12:00: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 96ABA2386; Sat, 13 Mar 2021 12:00: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 12DC0tot014333; Sat, 13 Mar 2021 12:00:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DC0t1S014332; Sat, 13 Mar 2021 12:00:55 GMT (envelope-from git) Date: Sat, 13 Mar 2021 12:00:55 GMT Message-Id: <202103131200.12DC0t1S014332@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: 653ed678c703 - main - zfs: bring back possibility to rewind the checkpoint from 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: 653ed678c70376b15cdc42daafa7b4554570cea2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 12:00:55 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=653ed678c70376b15cdc42daafa7b4554570cea2 commit 653ed678c70376b15cdc42daafa7b4554570cea2 Author: Mariusz Zaborski AuthorDate: 2021-03-13 11:56:17 +0000 Commit: Mariusz Zaborski CommitDate: 2021-03-13 11:56:17 +0000 zfs: bring back possibility to rewind the checkpoint from Add parsing of the rewind options. When I was upstreaming the change [1], I omitted the part where we detect that the pool should be rewind. When the FreeBSD repo has synced with the OpenZFS, this part of the code was removed. [1] FreeBSD repo: 277f38abffc6a8160b5044128b5b2c620fbb970c [2] OpenZFS repo: f2c027bd6a003ec5793f8716e6189c389c60f47a Originally reviewed by: tsoome, allanjude Originally reviewed by: kevans (ok from high-level overview) Signed-off-by: Mariusz Zaborski PR: 254152 Reported by: Zhenlei Huang Obtained from: https://github.com/openzfs/zfs/pull/11730 --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index 7bc6b83d0272..a537342f9678 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -1291,6 +1291,18 @@ getpoolname(const char *osname, char *poolname) return (0); } +static void +fetch_osname_options(char *name, bool *checkpointrewind) +{ + + if (name[0] == '!') { + *checkpointrewind = true; + memmove(name, name + 1, strlen(name)); + } else { + *checkpointrewind = false; + } +} + /*ARGSUSED*/ static int zfs_mount(vfs_t *vfsp) @@ -1301,6 +1313,7 @@ zfs_mount(vfs_t *vfsp) char *osname; int error = 0; int canwrite; + bool checkpointrewind; if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL)) return (SET_ERROR(EINVAL)); @@ -1314,6 +1327,8 @@ zfs_mount(vfs_t *vfsp) secpolicy_fs_mount_clearopts(cr, vfsp); } + fetch_osname_options(osname, &checkpointrewind); + /* * Check for mount privilege? * @@ -1392,7 +1407,7 @@ zfs_mount(vfs_t *vfsp) error = getpoolname(osname, pname); if (error == 0) - error = spa_import_rootpool(pname, false); + error = spa_import_rootpool(pname, checkpointrewind); if (error) goto out; } From owner-dev-commits-src-all@freebsd.org Sat Mar 13 13:54:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A40F757852A; Sat, 13 Mar 2021 13:54: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 4DyPLx4ChLz4tTH; Sat, 13 Mar 2021 13:54: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 7917D3BC0; Sat, 13 Mar 2021 13:54: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 12DDsnJF065155; Sat, 13 Mar 2021 13:54:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DDsnKR065154; Sat, 13 Mar 2021 13:54:49 GMT (envelope-from git) Date: Sat, 13 Mar 2021 13:54:49 GMT Message-Id: <202103131354.12DDsnKR065154@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 9097e3cbcac4 - main - Partially revert libcxxrt changes to avoid _Unwind_Exception change MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9097e3cbcac455eb0dedd097d8d5548c72568d0a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 13:54:49 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=9097e3cbcac455eb0dedd097d8d5548c72568d0a commit 9097e3cbcac455eb0dedd097d8d5548c72568d0a Author: Dimitry Andric AuthorDate: 2021-03-13 13:54:24 +0000 Commit: Dimitry Andric CommitDate: 2021-03-13 13:54:24 +0000 Partially revert libcxxrt changes to avoid _Unwind_Exception change (Note I am also applying this to main and stable/13, to restore the old libcxxrt ABI and to avoid having to maintain a compat library.) After the recent cherry-picking of libcxxrt commits 0ee0dbfb0d26 and d2b3fadf2db5, users reported that editors/libreoffice packages from the official package builders did not start anymore. It turns out that the combination of these commits subtly changes the ABI, requiring all applications that depend on internal details of struct _Unwind_Exception (available via unwind-arm.h and unwind-itanium.h) to be recompiled. However, the FreeBSD package builders always use -RELEASE jails, so these still use the old declaration of struct _Unwind_Exception, which is not entirely compatible. In particular, LibreOffice uses this struct in its internal "uno bridge" component, where it attempts to setup its own exception handling mechanism. To fix this incompatibility, go back to the old declarations of struct _Unwind_Exception, and restore the __LP64__ specific workaround we had in place before (which was to cope with yet another, older ABI bug). Effectively, this reverts upstream libcxxrt commits 88bdf6b290da ("Specify double-word alignment for ARM unwind") and b96169641f79 ("Updated Itanium unwind"), and reapplies our commit 3c4fd2463bb2 ("libcxxrt: add padding in __cxa_allocate_* to fix alignment"). PR: 253840 --- contrib/libcxxrt/exception.cc | 30 ++++++++++++++++++++++++------ contrib/libcxxrt/unwind-arm.h | 2 +- contrib/libcxxrt/unwind-itanium.h | 9 +++------ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc index 0fb26ddb4ed2..0de878e9e6db 100644 --- a/contrib/libcxxrt/exception.cc +++ b/contrib/libcxxrt/exception.cc @@ -572,6 +572,19 @@ static void free_exception(char *e) } } +#ifdef __LP64__ +/** + * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte + * alignment but it was broken by the addition of the referenceCount. + * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep + * compatibility with consumers of the broken __cxa_exception, explicitly add + * padding on allocation (and account for it on free). + */ +static const int exception_alignment_padding = 8; +#else +static const int exception_alignment_padding = 0; +#endif + /** * Allocates an exception structure. Returns a pointer to the space that can * be used to store an object of thrown_size bytes. This function will use an @@ -580,16 +593,19 @@ static void free_exception(char *e) */ extern "C" void *__cxa_allocate_exception(size_t thrown_size) { - size_t size = thrown_size + sizeof(__cxa_exception); + size_t size = exception_alignment_padding + sizeof(__cxa_exception) + + thrown_size; char *buffer = alloc_or_die(size); - return buffer+sizeof(__cxa_exception); + return buffer + exception_alignment_padding + sizeof(__cxa_exception); } extern "C" void *__cxa_allocate_dependent_exception(void) { - size_t size = sizeof(__cxa_dependent_exception); + size_t size = exception_alignment_padding + + sizeof(__cxa_dependent_exception); char *buffer = alloc_or_die(size); - return buffer+sizeof(__cxa_dependent_exception); + return buffer + exception_alignment_padding + + sizeof(__cxa_dependent_exception); } /** @@ -617,7 +633,8 @@ extern "C" void __cxa_free_exception(void *thrown_exception) } } - free_exception(reinterpret_cast(ex)); + free_exception(reinterpret_cast(ex) - + exception_alignment_padding); } static void releaseException(__cxa_exception *exception) @@ -644,7 +661,8 @@ void __cxa_free_dependent_exception(void *thrown_exception) { releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); } - free_exception(reinterpret_cast(ex)); + free_exception(reinterpret_cast(ex) - + exception_alignment_padding); } /** diff --git a/contrib/libcxxrt/unwind-arm.h b/contrib/libcxxrt/unwind-arm.h index ec81237e573b..6eb9d9e45981 100644 --- a/contrib/libcxxrt/unwind-arm.h +++ b/contrib/libcxxrt/unwind-arm.h @@ -97,7 +97,7 @@ struct _Unwind_Exception } pr_cache; /** Force alignment of next item to 8-byte boundary */ long long int :0; -} __attribute__((__aligned__(8))); +}; /* Unwinding functions */ _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *ucbp); diff --git a/contrib/libcxxrt/unwind-itanium.h b/contrib/libcxxrt/unwind-itanium.h index 199d91de283d..1ee0cf0e81c4 100644 --- a/contrib/libcxxrt/unwind-itanium.h +++ b/contrib/libcxxrt/unwind-itanium.h @@ -79,12 +79,9 @@ struct _Unwind_Exception { uint64_t exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; - uintptr_t private_1; - uintptr_t private_2; -#if __SIZEOF_POINTER__ == 4 - uint32_t reserved[3]; -#endif - } __attribute__((__aligned__)); + unsigned long private_1; + unsigned long private_2; + } ; extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, From owner-dev-commits-src-all@freebsd.org Sat Mar 13 13:55:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53251578535; Sat, 13 Mar 2021 13:55:03 +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 4DyPMC1pb8z4tVN; Sat, 13 Mar 2021 13:55: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 1ADB53D22; Sat, 13 Mar 2021 13:55: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 12DDt2JC065317; Sat, 13 Mar 2021 13:55:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DDt2s6065316; Sat, 13 Mar 2021 13:55:02 GMT (envelope-from git) Date: Sat, 13 Mar 2021 13:55:02 GMT Message-Id: <202103131355.12DDt2s6065316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 0b45290603b9 - stable/13 - Partially revert libcxxrt changes to avoid _Unwind_Exception change MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0b45290603b9d294dc2fbbf6d7b8fa20acd60175 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 13:55:03 -0000 The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=0b45290603b9d294dc2fbbf6d7b8fa20acd60175 commit 0b45290603b9d294dc2fbbf6d7b8fa20acd60175 Author: Dimitry Andric AuthorDate: 2021-03-13 13:54:05 +0000 Commit: Dimitry Andric CommitDate: 2021-03-13 13:54:05 +0000 Partially revert libcxxrt changes to avoid _Unwind_Exception change (Note I am also applying this to main and stable/13, to restore the old libcxxrt ABI and to avoid having to maintain a compat library.) After the recent cherry-picking of libcxxrt commits 0ee0dbfb0d26 and d2b3fadf2db5, users reported that editors/libreoffice packages from the official package builders did not start anymore. It turns out that the combination of these commits subtly changes the ABI, requiring all applications that depend on internal details of struct _Unwind_Exception (available via unwind-arm.h and unwind-itanium.h) to be recompiled. However, the FreeBSD package builders always use -RELEASE jails, so these still use the old declaration of struct _Unwind_Exception, which is not entirely compatible. In particular, LibreOffice uses this struct in its internal "uno bridge" component, where it attempts to setup its own exception handling mechanism. To fix this incompatibility, go back to the old declarations of struct _Unwind_Exception, and restore the __LP64__ specific workaround we had in place before (which was to cope with yet another, older ABI bug). Effectively, this reverts upstream libcxxrt commits 88bdf6b290da ("Specify double-word alignment for ARM unwind") and b96169641f79 ("Updated Itanium unwind"), and reapplies our commit 3c4fd2463bb2 ("libcxxrt: add padding in __cxa_allocate_* to fix alignment"). PR: 253840 --- contrib/libcxxrt/exception.cc | 30 ++++++++++++++++++++++++------ contrib/libcxxrt/unwind-arm.h | 2 +- contrib/libcxxrt/unwind-itanium.h | 9 +++------ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc index 0fb26ddb4ed2..0de878e9e6db 100644 --- a/contrib/libcxxrt/exception.cc +++ b/contrib/libcxxrt/exception.cc @@ -572,6 +572,19 @@ static void free_exception(char *e) } } +#ifdef __LP64__ +/** + * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte + * alignment but it was broken by the addition of the referenceCount. + * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep + * compatibility with consumers of the broken __cxa_exception, explicitly add + * padding on allocation (and account for it on free). + */ +static const int exception_alignment_padding = 8; +#else +static const int exception_alignment_padding = 0; +#endif + /** * Allocates an exception structure. Returns a pointer to the space that can * be used to store an object of thrown_size bytes. This function will use an @@ -580,16 +593,19 @@ static void free_exception(char *e) */ extern "C" void *__cxa_allocate_exception(size_t thrown_size) { - size_t size = thrown_size + sizeof(__cxa_exception); + size_t size = exception_alignment_padding + sizeof(__cxa_exception) + + thrown_size; char *buffer = alloc_or_die(size); - return buffer+sizeof(__cxa_exception); + return buffer + exception_alignment_padding + sizeof(__cxa_exception); } extern "C" void *__cxa_allocate_dependent_exception(void) { - size_t size = sizeof(__cxa_dependent_exception); + size_t size = exception_alignment_padding + + sizeof(__cxa_dependent_exception); char *buffer = alloc_or_die(size); - return buffer+sizeof(__cxa_dependent_exception); + return buffer + exception_alignment_padding + + sizeof(__cxa_dependent_exception); } /** @@ -617,7 +633,8 @@ extern "C" void __cxa_free_exception(void *thrown_exception) } } - free_exception(reinterpret_cast(ex)); + free_exception(reinterpret_cast(ex) - + exception_alignment_padding); } static void releaseException(__cxa_exception *exception) @@ -644,7 +661,8 @@ void __cxa_free_dependent_exception(void *thrown_exception) { releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); } - free_exception(reinterpret_cast(ex)); + free_exception(reinterpret_cast(ex) - + exception_alignment_padding); } /** diff --git a/contrib/libcxxrt/unwind-arm.h b/contrib/libcxxrt/unwind-arm.h index ec81237e573b..6eb9d9e45981 100644 --- a/contrib/libcxxrt/unwind-arm.h +++ b/contrib/libcxxrt/unwind-arm.h @@ -97,7 +97,7 @@ struct _Unwind_Exception } pr_cache; /** Force alignment of next item to 8-byte boundary */ long long int :0; -} __attribute__((__aligned__(8))); +}; /* Unwinding functions */ _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *ucbp); diff --git a/contrib/libcxxrt/unwind-itanium.h b/contrib/libcxxrt/unwind-itanium.h index 199d91de283d..1ee0cf0e81c4 100644 --- a/contrib/libcxxrt/unwind-itanium.h +++ b/contrib/libcxxrt/unwind-itanium.h @@ -79,12 +79,9 @@ struct _Unwind_Exception { uint64_t exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; - uintptr_t private_1; - uintptr_t private_2; -#if __SIZEOF_POINTER__ == 4 - uint32_t reserved[3]; -#endif - } __attribute__((__aligned__)); + unsigned long private_1; + unsigned long private_2; + } ; extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, From owner-dev-commits-src-all@freebsd.org Sat Mar 13 14:52:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11E4F579D2D; Sat, 13 Mar 2021 14:52: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 4DyQd26rqcz4xsF; Sat, 13 Mar 2021 14:52: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 D33AF4AAD; Sat, 13 Mar 2021 14:52: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 12DEq6wW044158; Sat, 13 Mar 2021 14:52:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DEq64V044157; Sat, 13 Mar 2021 14:52:06 GMT (envelope-from git) Date: Sat, 13 Mar 2021 14:52:06 GMT Message-Id: <202103131452.12DEq64V044157@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: d197bf2b20e7 - main - net80211: Fix a typo in a comment 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: d197bf2b20e7efc6ffef520bf96d5f642e26a015 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 14:52:07 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d197bf2b20e7efc6ffef520bf96d5f642e26a015 commit d197bf2b20e7efc6ffef520bf96d5f642e26a015 Author: Gordon Bergling AuthorDate: 2021-03-13 14:51:30 +0000 Commit: Gordon Bergling CommitDate: 2021-03-13 14:51:30 +0000 net80211: Fix a typo in a comment - destionation -> destination - while here, fix some whitespace issues MFC after: 1 week --- sys/net80211/ieee80211_hwmp.c | 62 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index 75c3eeb7c759..4fbcc9051c47 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -1,33 +1,33 @@ -/*- +/*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2009 The FreeBSD Foundation - * All rights reserved. - * + * Copyright (c) 2009 The FreeBSD Foundation + * All rights reserved. + * * This software was developed by Rui Paulo under sponsorship from the - * FreeBSD Foundation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE 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 Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE 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 #ifdef __FreeBSD__ __FBSDID("$FreeBSD$"); @@ -282,7 +282,7 @@ hwmp_vdetach(struct ieee80211vap *vap) callout_drain(&hs->hs_roottimer); IEEE80211_FREE(vap->iv_hwmp, M_80211_VAP); vap->iv_hwmp = NULL; -} +} static int hwmp_newstate(struct ieee80211vap *vap, enum ieee80211_state ostate, int arg) @@ -378,7 +378,7 @@ verify_mesh_perr_len(struct ieee80211vap *vap, } iefrm_t += IEEE80211_MESHPERR_NDEST_OFFSET + 1; /* flag is next field */ - /* We need to check each destionation flag to know size */ + /* We need to check each destination flag to know size */ for(i = 0; ipreq_lifetime = le32dec(iefrm_t); iefrm_t += 4; preq->preq_metric = le32dec(iefrm_t); iefrm_t += 4; preq->preq_tcount = *iefrm_t++; - + for (i = 0; i < preq->preq_tcount; i++) { preq->preq_targets[i].target_flags = *iefrm_t++; IEEE80211_ADDR_COPY( @@ -983,7 +983,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, return; } /* - * Acceptance criteria: if unicast addressed + * Acceptance criteria: if unicast addressed * AND no valid forwarding for Target of PREQ, discard this PREQ. */ if(rttarg != NULL) From owner-dev-commits-src-all@freebsd.org Sat Mar 13 15:11:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDD1457A2FA; Sat, 13 Mar 2021 15:11: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 4DyR3p60mNz4ylt; Sat, 13 Mar 2021 15:11: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 B6D924E0A; Sat, 13 Mar 2021 15:11: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 12DFBoOF069731; Sat, 13 Mar 2021 15:11:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DFBoKs069730; Sat, 13 Mar 2021 15:11:50 GMT (envelope-from git) Date: Sat, 13 Mar 2021 15:11:50 GMT Message-Id: <202103131511.12DFBoKs069730@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: 564a3ac63abe - main - i386: Fix a few typos 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: 564a3ac63abe166c6174ed3a58e78859a738ee58 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 15:11:50 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=564a3ac63abe166c6174ed3a58e78859a738ee58 commit 564a3ac63abe166c6174ed3a58e78859a738ee58 Author: Gordon Bergling AuthorDate: 2021-03-13 15:10:01 +0000 Commit: Gordon Bergling CommitDate: 2021-03-13 15:10:01 +0000 i386: Fix a few typos - wheter -> whether - while here, fix some whitespace issues MFC after: 1 week --- sys/i386/i386/initcpu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/i386/i386/initcpu.c b/sys/i386/i386/initcpu.c index 9ba269af2b32..ee2d7ec224e5 100644 --- a/sys/i386/i386/initcpu.c +++ b/sys/i386/i386/initcpu.c @@ -2,21 +2,21 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) KATO Takenori, 1997, 1998. - * + * * All rights reserved. Unpublished rights reserved under the copyright * laws of Japan. - * + * * 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 as * the first lines of this file unmodified. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. @@ -837,7 +837,7 @@ enable_K5_wt_alloc(void) msr |= AMD_WT_ALLOC_TME | AMD_WT_ALLOC_FRE; /* - * There is no way to know wheter 15-16M hole exists or not. + * There is no way to know whether 15-16M hole exists or not. * Therefore, we disable write allocate for this range. */ wrmsr(0x86, 0x0ff00f0); @@ -890,7 +890,7 @@ enable_K6_wt_alloc(void) whcr |= 0x0001LL; #else /* - * There is no way to know wheter 15-16M hole exists or not. + * There is no way to know whether 15-16M hole exists or not. * Therefore, we disable write allocate for this range. */ whcr &= ~0x0001LL; @@ -940,7 +940,7 @@ enable_K6_2_wt_alloc(void) whcr |= 1LL << 16; #else /* - * There is no way to know wheter 15-16M hole exists or not. + * There is no way to know whether 15-16M hole exists or not. * Therefore, we disable write allocate for this range. */ whcr &= ~(1LL << 16); From owner-dev-commits-src-all@freebsd.org Sat Mar 13 15:38:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0211057A960; Sat, 13 Mar 2021 15:38: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 4DyRfw6gP0z5181; Sat, 13 Mar 2021 15:38: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 D78A1549D; Sat, 13 Mar 2021 15:38: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 12DFcmvc098099; Sat, 13 Mar 2021 15:38:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DFcmkf098098; Sat, 13 Mar 2021 15:38:48 GMT (envelope-from git) Date: Sat, 13 Mar 2021 15:38:48 GMT Message-Id: <202103131538.12DFcmkf098098@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: 183502d1625f - main - Fix a few typos in comments 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: 183502d1625fbcc3600fbe1d196758b946749569 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 15:38:49 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=183502d1625fbcc3600fbe1d196758b946749569 commit 183502d1625fbcc3600fbe1d196758b946749569 Author: Gordon Bergling AuthorDate: 2021-03-13 15:37:28 +0000 Commit: Gordon Bergling CommitDate: 2021-03-13 15:37:28 +0000 Fix a few typos in comments - trough -> through MFC after: 1 week --- share/man/man4/ng_macfilter.4 | 2 +- sys/netinet/sctp_ss_functions.c | 2 +- sys/netpfil/ipfw/nat64/nat64_translate.c | 2 +- sys/sys/soundcard.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/share/man/man4/ng_macfilter.4 b/share/man/man4/ng_macfilter.4 index 5d8b9a4f780b..895d3560136b 100644 --- a/share/man/man4/ng_macfilter.4 +++ b/share/man/man4/ng_macfilter.4 @@ -45,7 +45,7 @@ address. .Pp This processing is done when traffic flows from the .Dq ether -hook trough +hook through .Nm macfilter to one of the outgoing hooks. Outbound hooks can be added to and remove from diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index 5f10d3e9bcb7..5557015cd2a9 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -583,7 +583,7 @@ sctp_ss_prio_set_value(struct sctp_tcb *stcb, struct sctp_association *asoc, /* * Fair bandwidth algorithm. - * Maintains an equal troughput per stream. + * Maintains an equal throughput per stream. */ static void sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, diff --git a/sys/netpfil/ipfw/nat64/nat64_translate.c b/sys/netpfil/ipfw/nat64/nat64_translate.c index e8fffe03497c..4ed3bfa765f6 100644 --- a/sys/netpfil/ipfw/nat64/nat64_translate.c +++ b/sys/netpfil/ipfw/nat64/nat64_translate.c @@ -722,7 +722,7 @@ nat64_icmp6_reflect(struct mbuf *m, uint8_t type, uint8_t code, uint32_t mtu, /* * Move pkthdr from original mbuf. We should have initialized some * fields, because we can reinject this mbuf to netisr and it will - * go trough input path (it requires at least rcvif should be set). + * go through input path (it requires at least rcvif should be set). * Also do M_ALIGN() to reduce chances of need to allocate new mbuf * in the chain, when we will do M_PREPEND() or make some type of * tunneling. diff --git a/sys/sys/soundcard.h b/sys/sys/soundcard.h index 41cd8593914a..285f26986434 100644 --- a/sys/sys/soundcard.h +++ b/sys/sys/soundcard.h @@ -484,7 +484,7 @@ struct sysex_info { * This structure is also used with ioctl(SNDCTL_PGMR_IFACE) which allows * a patch manager daemon to read and write device parameters. This * ioctl available through /dev/sequencer also. Avoid using it since it's - * extremely hardware dependent. In addition access trough /dev/sequencer + * extremely hardware dependent. In addition access through /dev/sequencer * may confuse the patch manager daemon. */ From owner-dev-commits-src-all@freebsd.org Sat Mar 13 17:27:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FBAB57D16F; Sat, 13 Mar 2021 17:27: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 4DyV4L3FBHz56yR; Sat, 13 Mar 2021 17:27: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 616EF6A19; Sat, 13 Mar 2021 17:27: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 12DHRU1C042807; Sat, 13 Mar 2021 17:27:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DHRUhU042806; Sat, 13 Mar 2021 17:27:30 GMT (envelope-from git) Date: Sat, 13 Mar 2021 17:27:30 GMT Message-Id: <202103131727.12DHRUhU042806@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: 5666643a9538 - main - Fix some common typos in comments 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: 5666643a95389e3ea7637b86cc556d411242f71e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 17:27:30 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5666643a95389e3ea7637b86cc556d411242f71e commit 5666643a95389e3ea7637b86cc556d411242f71e Author: Gordon Bergling AuthorDate: 2021-03-13 17:26:15 +0000 Commit: Gordon Bergling CommitDate: 2021-03-13 17:26:15 +0000 Fix some common typos in comments - occured -> occurred - normaly -> normally - controling -> controlling - fileds -> fields - insterted -> inserted - outputing -> outputting MFC after: 1 week --- lib/libipsec/pfkey.c | 48 ++++++++++++++++++------------------- stand/efi/include/efifs.h | 2 +- sys/dev/ixl/ixl_pf_i2c.c | 40 +++++++++++++++---------------- sys/fs/nfsclient/nfs_clrpcops.c | 4 ++-- sys/mips/ingenic/jz4780_regs.h | 6 ++--- sys/net/if_pfsync.h | 2 +- sys/netinet/tcp_log_buf.h | 6 ++--- sys/netinet/tcp_stacks/bbr.c | 8 +++---- sys/netinet/tcp_stacks/rack.c | 2 +- sys/netinet/tcp_stacks/tcp_rack.h | 2 +- tools/test/stress2/misc/nullfs17.sh | 2 +- usr.bin/ar/write.c | 4 ++-- usr.bin/fmt/fmt.c | 2 +- 13 files changed, 64 insertions(+), 64 deletions(-) diff --git a/lib/libipsec/pfkey.c b/lib/libipsec/pfkey.c index d1aae7321c2e..08098775910f 100644 --- a/lib/libipsec/pfkey.c +++ b/lib/libipsec/pfkey.c @@ -342,7 +342,7 @@ pfkey_get_softrate(type) * sending SADB_GETSPI message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_getspi(so, satype, mode, src, dst, min, max, reqid, seq) @@ -471,7 +471,7 @@ pfkey_send_getspi(so, satype, mode, src, dst, min, max, reqid, seq) * The length of key material is a_keylen + e_keylen. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_update(so, satype, mode, src, dst, spi, reqid, wsize, @@ -502,7 +502,7 @@ pfkey_send_update(so, satype, mode, src, dst, spi, reqid, wsize, * The length of key material is a_keylen + e_keylen. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_add(so, satype, mode, src, dst, spi, reqid, wsize, @@ -532,7 +532,7 @@ pfkey_send_add(so, satype, mode, src, dst, spi, reqid, wsize, * sending SADB_DELETE message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_delete(so, satype, mode, src, dst, spi) @@ -555,7 +555,7 @@ pfkey_send_delete(so, satype, mode, src, dst, spi) * * OUT: * positive: success and return length sent - * -1 : error occured, and set errno + * -1 : error occurred, and set errno */ int pfkey_send_delete_all(so, satype, mode, src, dst) @@ -637,7 +637,7 @@ pfkey_send_delete_all(so, satype, mode, src, dst) * sending SADB_GET message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_get(so, satype, mode, src, dst, spi) @@ -657,7 +657,7 @@ pfkey_send_get(so, satype, mode, src, dst, spi) * sending SADB_REGISTER message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_register(so, satype) @@ -699,7 +699,7 @@ pfkey_send_register(so, satype) * sadb_supported returned into ipsec_supported. * OUT: * 0: success and return length sent. - * -1: error occured, and set errno. + * -1: error occurred, and set errno. */ int pfkey_recv_register(so) @@ -739,7 +739,7 @@ pfkey_recv_register(so) * tlen: msg length, it's to makeing sure. * OUT: * 0: success and return length sent. - * -1: error occured, and set errno. + * -1: error occurred, and set errno. */ int pfkey_set_supported(msg, tlen) @@ -803,7 +803,7 @@ pfkey_set_supported(msg, tlen) * sending SADB_FLUSH message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_flush(so, satype) @@ -822,7 +822,7 @@ pfkey_send_flush(so, satype) * sending SADB_DUMP message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_dump(so, satype) @@ -844,8 +844,8 @@ pfkey_send_dump(so, satype) * flag: set promisc off if zero, set promisc on if non-zero. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. - * 0 : error occured, and set errno. + * -1 : error occurred, and set errno. + * 0 : error occurred, and set errno. * others: a pointer to new allocated buffer in which supported * algorithms is. */ @@ -866,7 +866,7 @@ pfkey_send_promisc_toggle(so, flag) * sending SADB_X_SPDADD message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_spdadd(so, src, prefs, dst, prefd, proto, policy, policylen, seq) @@ -892,7 +892,7 @@ pfkey_send_spdadd(so, src, prefs, dst, prefd, proto, policy, policylen, seq) * sending SADB_X_SPDADD message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_spdadd2(so, src, prefs, dst, prefd, proto, ltime, vtime, @@ -920,7 +920,7 @@ pfkey_send_spdadd2(so, src, prefs, dst, prefd, proto, ltime, vtime, * sending SADB_X_SPDUPDATE message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_spdupdate(so, src, prefs, dst, prefd, proto, policy, policylen, seq) @@ -946,7 +946,7 @@ pfkey_send_spdupdate(so, src, prefs, dst, prefd, proto, policy, policylen, seq) * sending SADB_X_SPDUPDATE message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_spdupdate2(so, src, prefs, dst, prefd, proto, ltime, vtime, @@ -974,7 +974,7 @@ pfkey_send_spdupdate2(so, src, prefs, dst, prefd, proto, ltime, vtime, * sending SADB_X_SPDDELETE message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_spddelete(so, src, prefs, dst, prefd, proto, policy, policylen, seq) @@ -1005,7 +1005,7 @@ pfkey_send_spddelete(so, src, prefs, dst, prefd, proto, policy, policylen, seq) * sending SADB_X_SPDDELETE message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_spddelete2(so, spid) @@ -1024,7 +1024,7 @@ pfkey_send_spddelete2(so, spid) * sending SADB_X_SPDGET message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_spdget(so, spid) @@ -1043,7 +1043,7 @@ pfkey_send_spdget(so, spid) * sending SADB_X_SPDSETIDX message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_spdsetidx(so, src, prefs, dst, prefd, proto, policy, policylen, seq) @@ -1074,7 +1074,7 @@ pfkey_send_spdsetidx(so, src, prefs, dst, prefd, proto, policy, policylen, seq) * sending SADB_SPDFLUSH message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_spdflush(so) @@ -1092,7 +1092,7 @@ pfkey_send_spdflush(so) * sending SADB_SPDDUMP message to the kernel. * OUT: * positive: success and return length sent. - * -1 : error occured, and set errno. + * -1 : error occurred, and set errno. */ int pfkey_send_spddump(so) @@ -1658,7 +1658,7 @@ pfkey_close(so) * receive sadb_msg data, and return pointer to new buffer allocated. * Must free this buffer later. * OUT: - * NULL : error occured. + * NULL : error occurred. * others : a pointer to sadb_msg structure. * * XXX should be rewritten to pass length explicitly diff --git a/stand/efi/include/efifs.h b/stand/efi/include/efifs.h index 58febb66eb75..76aa93d6d07f 100644 --- a/stand/efi/include/efifs.h +++ b/stand/efi/include/efifs.h @@ -29,7 +29,7 @@ Revision History // -// EFI Partition header (normaly starts in LBA 1) +// EFI Partition header (normally starts in LBA 1) // #define EFI_PARTITION_SIGNATURE 0x5053595320494249 diff --git a/sys/dev/ixl/ixl_pf_i2c.c b/sys/dev/ixl/ixl_pf_i2c.c index 9aea32bbe5ce..c69e2f8ac836 100644 --- a/sys/dev/ixl/ixl_pf_i2c.c +++ b/sys/dev/ixl/ixl_pf_i2c.c @@ -2,30 +2,30 @@ Copyright (c) 2013-2018, Intel Corporation All rights reserved. - - Redistribution and use in source and binary forms, with or without + + 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, + + 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 + + 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 the Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived from + + 3. Neither the name of the Intel Corporation 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) + 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. @@ -661,7 +661,7 @@ ixl_write_i2c_byte_reg(struct ixl_pf *pf, u8 byte_offset, reg |= (datai2c << I40E_GLGEN_I2CCMD_DATA_SHIFT); reg &= ~I40E_GLGEN_I2CCMD_OP_MASK; - /* Write command to registers controling I2C - data and address. */ + /* Write command to registers controlling I2C - data and address. */ wr32(hw, I40E_GLGEN_I2CCMD(hw->func_caps.mdio_port_num), reg); status = ixl_wait_for_i2c_completion(hw, hw->func_caps.mdio_port_num); diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 527a47338b3f..7cd793502476 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -1872,7 +1872,7 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iomode, if (nd->nd_repstat) { /* * In case the rpc gets retried, roll - * the uio fileds changed by nfsm_uiombuf() + * the uio fields changed by nfsm_uiombuf() * back. */ uiop->uio_offset -= len; @@ -6423,7 +6423,7 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, if (nd->nd_repstat != 0) { /* * In case the rpc gets retried, roll - * the uio fileds changed by nfsm_uiombuf() + * the uio fields changed by nfsm_uiombuf() * back. */ uiop->uio_offset -= len; diff --git a/sys/mips/ingenic/jz4780_regs.h b/sys/mips/ingenic/jz4780_regs.h index 221c21784925..c46045ae0e18 100644 --- a/sys/mips/ingenic/jz4780_regs.h +++ b/sys/mips/ingenic/jz4780_regs.h @@ -483,9 +483,9 @@ readreg(uint32_t reg) #define JZ_SMBFHCNT 0x1C /* Fast speed SMB SCL high count */ #define JZ_SMBFLCNT 0x20 /* Fast speed SMB SCL low count */ #define JZ_SMBINTST 0x2C /* SMB Interrupt Status */ - #define JZ_ISTT 0x400 /* START or RESTART occured */ - #define JZ_ISTP 0x200 /* STOP occured */ - #define JZ_TXABT 0x40 /* ABORT occured */ + #define JZ_ISTT 0x400 /* START or RESTART occurred */ + #define JZ_ISTP 0x200 /* STOP occurred */ + #define JZ_TXABT 0x40 /* ABORT occurred */ #define JZ_TXEMP 0x10 /* TX FIFO is low */ #define JZ_TXOF 0x08 /* TX FIFO is high */ #define JZ_RXFL 0x04 /* RX FIFO is at JZ_SMBRXTL*/ diff --git a/sys/net/if_pfsync.h b/sys/net/if_pfsync.h index f26a2ae34eed..ccd26c9ac0de 100644 --- a/sys/net/if_pfsync.h +++ b/sys/net/if_pfsync.h @@ -55,7 +55,7 @@ #define PFSYNC_ACT_CLR 0 /* clear all states */ #define PFSYNC_ACT_INS 1 /* insert state */ -#define PFSYNC_ACT_INS_ACK 2 /* ack of insterted state */ +#define PFSYNC_ACT_INS_ACK 2 /* ack of inserted state */ #define PFSYNC_ACT_UPD 3 /* update state */ #define PFSYNC_ACT_UPD_C 4 /* "compressed" update state */ #define PFSYNC_ACT_UPD_REQ 5 /* request "uncompressed" state */ diff --git a/sys/netinet/tcp_log_buf.h b/sys/netinet/tcp_log_buf.h index 436383124dce..bdd56c94587e 100644 --- a/sys/netinet/tcp_log_buf.h +++ b/sys/netinet/tcp_log_buf.h @@ -192,8 +192,8 @@ enum tcp_log_events { BBR_LOG_MSGSIZE, /* We received a EMSGSIZE error 19 */ BBR_LOG_BBRRTT, /* BBR RTT is updated 20 */ BBR_LOG_JUSTRET, /* We just returned out of output 21 */ - BBR_LOG_STATE, /* A BBR state change occured 22 */ - BBR_LOG_PKT_EPOCH, /* A BBR packet epoch occured 23 */ + BBR_LOG_STATE, /* A BBR state change occurred 22 */ + BBR_LOG_PKT_EPOCH, /* A BBR packet epoch occurred 23 */ BBR_LOG_PERSIST, /* BBR changed to/from a persists 24 */ TCP_LOG_FLOWEND, /* End of a flow 25 */ BBR_LOG_RTO, /* BBR's timeout includes BBR info 26 */ @@ -204,7 +204,7 @@ enum tcp_log_events { TCP_LOG_USERSEND, /* User level sends data 31 */ BBR_RSM_CLEARED, /* RSM cleared of ACK flags 32 */ BBR_LOG_STATE_TARGET, /* Log of target at state 33 */ - BBR_LOG_TIME_EPOCH, /* A timed based Epoch occured 34 */ + BBR_LOG_TIME_EPOCH, /* A timed based Epoch occurred 34 */ BBR_LOG_TO_PROCESS, /* A to was processed 35 */ BBR_LOG_BBRTSO, /* TSO update 36 */ BBR_LOG_HPTSDIAG, /* Hpts diag insert 37 */ diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index d57dd03ec4ec..f9535935a9db 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -3385,7 +3385,7 @@ bbr_get_bw_delay_prod(uint64_t rtt, uint64_t bw) { /* * Calculate the bytes in flight needed given the bw (in bytes per * second) and the specifyed rtt in useconds. We need to put out the - * returned value per RTT to match that rate. Gain will normaly + * returned value per RTT to match that rate. Gain will normally * raise it up from there. * * This should not overflow as long as the bandwidth is below 1 @@ -10667,7 +10667,7 @@ bbr_set_probebw_gains(struct tcp_bbr *bbr, uint32_t cts, uint32_t losses) } /** * We fall through and return always one of two things has - * occured. + * occurred. * 1) We are still not at target * * 2) We reached the target and set rc_bbr_state_atflight @@ -11157,7 +11157,7 @@ static void bbr_state_change(struct tcp_bbr *bbr, uint32_t cts, int32_t epoch, int32_t pkt_epoch, uint32_t losses) { /* - * A tick occured in the rtt epoch do we need to do anything? + * A tick occurred in the rtt epoch do we need to do anything? */ #ifdef BBR_INVARIANTS if ((bbr->rc_bbr_state != BBR_STATE_STARTUP) && @@ -11305,7 +11305,7 @@ bbr_state_change(struct tcp_bbr *bbr, uint32_t cts, int32_t epoch, int32_t pkt_e bbr->r_ctl.rc_bbr_enters_probertt = 1; if (bbr->rc_use_google == 0) { /* - * Restore any lowering that as occured to + * Restore any lowering that as occurred to * reach here */ if (bbr->r_ctl.bbr_rttprobe_gain_val) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index f5b0de7cbc59..5bea540c6ab6 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -14058,7 +14058,7 @@ enobufs: } else if ((slot == 0) && (sendalot == 0) && tot_len_this_send) { /* * Get our pacing rate, if an error - * occured in sending (ENOBUF) we would + * occurred in sending (ENOBUF) we would * hit the else if with slot preset. Other * errors return. */ diff --git a/sys/netinet/tcp_stacks/tcp_rack.h b/sys/netinet/tcp_stacks/tcp_rack.h index c45b7c75cd56..04c5c4940e10 100644 --- a/sys/netinet/tcp_stacks/tcp_rack.h +++ b/sys/netinet/tcp_stacks/tcp_rack.h @@ -29,7 +29,7 @@ #define _NETINET_TCP_RACK_H_ #define RACK_ACKED 0x0001/* The remote endpoint acked this */ -#define RACK_TO_MIXED 0x0002/* A timeout occured that mixed the send order - not used */ +#define RACK_TO_MIXED 0x0002/* A timeout occurred that mixed the send order - not used */ #define RACK_DEFERRED 0x0004/* We can't use this for RTT calc - not used */ #define RACK_OVERMAX 0x0008/* We have more retran's then we can fit */ #define RACK_SACK_PASSED 0x0010/* A sack was done above this block */ diff --git a/tools/test/stress2/misc/nullfs17.sh b/tools/test/stress2/misc/nullfs17.sh index 121225f67c00..c7e447117969 100755 --- a/tools/test/stress2/misc/nullfs17.sh +++ b/tools/test/stress2/misc/nullfs17.sh @@ -29,7 +29,7 @@ # Variation of nullfs.sh # "panic: LK_RETRY set with incompatible flags (0x202400) or -# an error occured (11)" seen. +# an error occurred (11)" seen. # https://people.freebsd.org/~pho/stress/log/matt001.txt [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 diff --git a/usr.bin/ar/write.c b/usr.bin/ar/write.c index 24bac2f25b92..6ca20a372fdb 100644 --- a/usr.bin/ar/write.c +++ b/usr.bin/ar/write.c @@ -175,7 +175,7 @@ create_obj_from_file(struct bsdar *bsdar, const char *name, time_t mtime) /* * When option '-D' is specified, mtime and UID / GID from the file - * will be replaced with 0, and file mode with 644. This ensures that + * will be replaced with 0, and file mode with 644. This ensures that * checksums will match for two archives containing the exact same * files. */ @@ -645,7 +645,7 @@ write_objs(struct bsdar *bsdar) /* * Archive string table is padded by a "\n" as the normal members. * The difference is that the size of archive string table counts - * in the pad bit, while normal members' size fileds do not. + * in the pad bit, while normal members' size fields do not. */ if (bsdar->as != NULL && bsdar->as_sz % 2 != 0) bsdar->as[bsdar->as_sz++] = '\n'; diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c index be196c26977a..967de1309e9e 100644 --- a/usr.bin/fmt/fmt.c +++ b/usr.bin/fmt/fmt.c @@ -624,7 +624,7 @@ output_word(size_t indent0, size_t indent1, const wchar_t *word, size_t length, if (new_x <= goal_length) { /* * After adding the word we still aren't at the goal length, - * so clearly we add it to the buffer rather than outputing + * so clearly we add it to the buffer rather than outputting * it. */ wmemset(output_buffer + output_buffer_length, L' ', From owner-dev-commits-src-all@freebsd.org Sat Mar 13 17:33:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFEC957D708 for ; Sat, 13 Mar 2021 17:33: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 4DyVBk4gFpz57DS; Sat, 13 Mar 2021 17:33: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 92E636A55; Sat, 13 Mar 2021 17:33: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 12DHX2D2055086; Sat, 13 Mar 2021 17:33:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DHX2l5055084; Sat, 13 Mar 2021 17:33:02 GMT (envelope-from git) Date: Sat, 13 Mar 2021 17:33:02 GMT Message-Id: <202103131733.12DHX2l5055084@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Martin Matuska Subject: git: 9162a1ce3ae9 - vendor/openzfs - Update vendor/openzfs to master-9305ff2ed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/vendor/openzfs X-Git-Reftype: branch X-Git-Commit: 9162a1ce3ae9158ae75ab1835e30ac14d3b6899c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 17:33:02 -0000 The branch vendor/openzfs has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=9162a1ce3ae9158ae75ab1835e30ac14d3b6899c commit 9162a1ce3ae9158ae75ab1835e30ac14d3b6899c Author: Martin Matuska AuthorDate: 2021-03-13 17:30:04 +0000 Commit: Martin Matuska CommitDate: 2021-03-13 17:30:04 +0000 Update vendor/openzfs to master-9305ff2ed Notable upstream pull request merges: #11153 Scalable teardown lock for FreeBSD #11651 Don't bomb out when using keylocation=file:// #11667 zvol: call zil_replaying() during replay #11683 abd_get_offset_struct() may allocate new abd #11693 Intentionally allow ZFS_READONLY in zfs_write #11716 zpool import cachefile improvements #11720 FreeBSD: Clean up zfsdev_close to match Linux #11730 FreeBSD: bring back possibility to rewind the checkpoint from bootloader --- .github/workflows/checkstyle.yaml | 2 +- cmd/vdev_id/vdev_id | 9 +- cmd/zpool/zpool_main.c | 307 +++++++++++++-------- cmd/zstream/zstream_redup.c | 1 + config/zfs-build.m4 | 36 +++ configure.ac | 1 + include/os/freebsd/spl/sys/Makefile.am | 3 + include/os/freebsd/spl/sys/debug.h | 80 +++--- include/os/freebsd/zfs/sys/zfs_vfsops_os.h | 118 ++++++-- include/os/freebsd/zfs/sys/zfs_znode_impl.h | 10 +- include/os/linux/spl/sys/debug.h | 78 +++--- include/os/linux/zfs/sys/zfs_vfsops_os.h | 33 +++ include/os/linux/zfs/sys/zfs_znode_impl.h | 10 +- include/sys/dmu_redact.h | 2 + include/sys/zfs_ioctl.h | 1 - lib/libzfs/libzfs_crypto.c | 10 +- lib/libzfs/libzfs_mount.c | 25 +- lib/libzfs/os/freebsd/libzfs_zmount.c | 5 +- lib/libzfs/os/linux/libzfs_mount_os.c | 6 +- lib/libzutil/zutil_import.c | 177 +++++++++--- man/man8/zfs-receive.8 | 10 + man/man8/zfs-send.8 | 7 +- module/Makefile.in | 5 + module/os/freebsd/zfs/kmod_core.c | 18 +- module/os/freebsd/zfs/zfs_dir.c | 5 +- module/os/freebsd/zfs/zfs_vfsops.c | 65 +++-- module/os/freebsd/zfs/zfs_vnops_os.c | 61 +--- module/os/freebsd/zfs/zfs_znode.c | 2 +- module/os/freebsd/zfs/zvol_os.c | 9 +- module/os/linux/zfs/zfs_acl.c | 26 +- module/os/linux/zfs/zfs_vfsops.c | 18 +- module/os/linux/zfs/zio_crypt.c | 1 + module/os/linux/zfs/zvol_os.c | 102 +++++-- module/zcommon/zfs_prop.c | 2 +- module/zfs/abd.c | 6 +- module/zfs/spa_misc.c | 4 +- module/zfs/zfs_ioctl.c | 10 +- module/zfs/zfs_vnops.c | 6 +- module/zfs/zvol.c | 15 +- tests/runfiles/common.run | 1 + tests/zfs-tests/include/commands.cfg | 2 +- tests/zfs-tests/include/libtest.shlib | 19 +- tests/zfs-tests/include/tunables.cfg | 8 +- .../functional/cli_root/zpool/zpool_002_pos.ksh | 37 ++- .../functional/cli_root/zpool/zpool_003_pos.ksh | 39 ++- .../functional/cli_root/zpool_import/Makefile.am | 1 + .../import_cachefile_paths_changed.ksh | 117 ++++++++ .../tests/functional/events/events_002_pos.ksh | 7 +- .../tests/functional/xattr/xattr_003_neg.ksh | 44 +-- 49 files changed, 1063 insertions(+), 498 deletions(-) diff --git a/.github/workflows/checkstyle.yaml b/.github/workflows/checkstyle.yaml index 1707f5bb21db..8dcd5047a748 100644 --- a/.github/workflows/checkstyle.yaml +++ b/.github/workflows/checkstyle.yaml @@ -6,7 +6,7 @@ on: jobs: checkstyle: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 with: diff --git a/cmd/vdev_id/vdev_id b/cmd/vdev_id/vdev_id index 8a379a72690e..d8918da1078c 100755 --- a/cmd/vdev_id/vdev_id +++ b/cmd/vdev_id/vdev_id @@ -298,8 +298,15 @@ sas_handler() { # Utilize DM device name to gather subordinate block devices # using sysfs to avoid userspace utilities - DMDEV=$(ls -l --full-time /dev/mapper | grep $DM_NAME | + + # If our DEVNAME is something like /dev/dm-177, then we may be + # able to get our DMDEV from it. + DMDEV=$(echo $DEVNAME | sed 's;/dev/;;g') + if [ ! -e /sys/block/$DMDEV/slaves/* ] ; then + # It's not there, try looking in /dev/mapper + DMDEV=$(ls -l --full-time /dev/mapper | grep $DM_NAME | awk '{gsub("../", " "); print $NF}') + fi # Use sysfs pointers in /sys/block/dm-X/slaves because using # userspace tools creates lots of overhead and should be avoided diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index e89eb3bea770..e23604b3d81c 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -2623,8 +2623,8 @@ print_class_vdevs(zpool_handle_t *zhp, status_cbdata_t *cb, nvlist_t *nv, /* * Display the status for the given pool. */ -static void -show_import(nvlist_t *config) +static int +show_import(nvlist_t *config, boolean_t report_error) { uint64_t pool_state; vdev_stat_t *vs; @@ -2656,6 +2656,13 @@ show_import(nvlist_t *config) reason = zpool_import_status(config, &msgid, &errata); + /* + * If we're importing using a cachefile, then we won't report any + * errors unless we are in the scan phase of the import. + */ + if (reason != ZPOOL_STATUS_OK && !report_error) + return (reason); + (void) printf(gettext(" pool: %s\n"), name); (void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); (void) printf(gettext(" state: %s"), health); @@ -2983,6 +2990,7 @@ show_import(nvlist_t *config) "be part of this pool, though their\n\texact " "configuration cannot be determined.\n")); } + return (0); } static boolean_t @@ -3121,6 +3129,121 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts, return (ret); } +static int +import_pools(nvlist_t *pools, nvlist_t *props, char *mntopts, int flags, + char *orig_name, char *new_name, + boolean_t do_destroyed, boolean_t pool_specified, boolean_t do_all, + importargs_t *import) +{ + nvlist_t *config = NULL; + nvlist_t *found_config = NULL; + uint64_t pool_state; + + /* + * At this point we have a list of import candidate configs. Even if + * we were searching by pool name or guid, we still need to + * post-process the list to deal with pool state and possible + * duplicate names. + */ + int err = 0; + nvpair_t *elem = NULL; + boolean_t first = B_TRUE; + while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) { + + verify(nvpair_value_nvlist(elem, &config) == 0); + + verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, + &pool_state) == 0); + if (!do_destroyed && pool_state == POOL_STATE_DESTROYED) + continue; + if (do_destroyed && pool_state != POOL_STATE_DESTROYED) + continue; + + verify(nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY, + import->policy) == 0); + + if (!pool_specified) { + if (first) + first = B_FALSE; + else if (!do_all) + (void) printf("\n"); + + if (do_all) { + err |= do_import(config, NULL, mntopts, + props, flags); + } else { + /* + * If we're importing from cachefile, then + * we don't want to report errors until we + * are in the scan phase of the import. If + * we get an error, then we return that error + * to invoke the scan phase. + */ + if (import->cachefile && !import->scan) + err = show_import(config, B_FALSE); + else + (void) show_import(config, B_TRUE); + } + } else if (import->poolname != NULL) { + char *name; + + /* + * We are searching for a pool based on name. + */ + verify(nvlist_lookup_string(config, + ZPOOL_CONFIG_POOL_NAME, &name) == 0); + + if (strcmp(name, import->poolname) == 0) { + if (found_config != NULL) { + (void) fprintf(stderr, gettext( + "cannot import '%s': more than " + "one matching pool\n"), + import->poolname); + (void) fprintf(stderr, gettext( + "import by numeric ID instead\n")); + err = B_TRUE; + } + found_config = config; + } + } else { + uint64_t guid; + + /* + * Search for a pool by guid. + */ + verify(nvlist_lookup_uint64(config, + ZPOOL_CONFIG_POOL_GUID, &guid) == 0); + + if (guid == import->guid) + found_config = config; + } + } + + /* + * If we were searching for a specific pool, verify that we found a + * pool, and then do the import. + */ + if (pool_specified && err == 0) { + if (found_config == NULL) { + (void) fprintf(stderr, gettext("cannot import '%s': " + "no such pool available\n"), orig_name); + err = B_TRUE; + } else { + err |= do_import(found_config, new_name, + mntopts, props, flags); + } + } + + /* + * If we were just looking for pools, report an error if none were + * found. + */ + if (!pool_specified && first) + (void) fprintf(stderr, + gettext("no pools available to import\n")); + return (err); +} + typedef struct target_exists_args { const char *poolname; uint64_t poolguid; @@ -3248,51 +3371,54 @@ zpool_do_checkpoint(int argc, char **argv) /* * zpool import [-d dir] [-D] * import [-o mntopts] [-o prop=value] ... [-R root] [-D] [-l] - * [-d dir | -c cachefile] [-f] -a + * [-d dir | -c cachefile | -s] [-f] -a * import [-o mntopts] [-o prop=value] ... [-R root] [-D] [-l] - * [-d dir | -c cachefile] [-f] [-n] [-F] [newpool] + * [-d dir | -c cachefile | -s] [-f] [-n] [-F] + * [newpool] * - * -c Read pool information from a cachefile instead of searching - * devices. + * -c Read pool information from a cachefile instead of searching + * devices. If importing from a cachefile config fails, then + * fallback to searching for devices only in the directories that + * exist in the cachefile. * - * -d Scan in a specific directory, other than /dev/. More than + * -d Scan in a specific directory, other than /dev/. More than * one directory can be specified using multiple '-d' options. * - * -D Scan for previously destroyed pools or import all or only - * specified destroyed pools. + * -D Scan for previously destroyed pools or import all or only + * specified destroyed pools. * - * -R Temporarily import the pool, with all mountpoints relative to + * -R Temporarily import the pool, with all mountpoints relative to * the given root. The pool will remain exported when the machine * is rebooted. * - * -V Import even in the presence of faulted vdevs. This is an - * intentionally undocumented option for testing purposes, and - * treats the pool configuration as complete, leaving any bad + * -V Import even in the presence of faulted vdevs. This is an + * intentionally undocumented option for testing purposes, and + * treats the pool configuration as complete, leaving any bad * vdevs in the FAULTED state. In other words, it does verbatim * import. * - * -f Force import, even if it appears that the pool is active. + * -f Force import, even if it appears that the pool is active. * - * -F Attempt rewind if necessary. + * -F Attempt rewind if necessary. * - * -n See if rewind would work, but don't actually rewind. + * -n See if rewind would work, but don't actually rewind. * - * -N Import the pool but don't mount datasets. + * -N Import the pool but don't mount datasets. * - * -T Specify a starting txg to use for import. This option is - * intentionally undocumented option for testing purposes. + * -T Specify a starting txg to use for import. This option is + * intentionally undocumented option for testing purposes. * - * -a Import all pools found. + * -a Import all pools found. * - * -l Load encryption keys while importing. + * -l Load encryption keys while importing. * - * -o Set property=value and/or temporary mount options (without '='). + * -o Set property=value and/or temporary mount options (without '='). * - * -s Scan using the default search path, the libblkid cache will - * not be consulted. + * -s Scan using the default search path, the libblkid cache will + * not be consulted. * - * --rewind-to-checkpoint - * Import the pool and revert back to the checkpoint. + * --rewind-to-checkpoint + * Import the pool and revert back to the checkpoint. * * The import command scans for pools to import, and import pools based on pool * name and GUID. The pool can also be renamed as part of the import process. @@ -3309,15 +3435,11 @@ zpool_do_import(int argc, char **argv) boolean_t do_all = B_FALSE; boolean_t do_destroyed = B_FALSE; char *mntopts = NULL; - nvpair_t *elem; - nvlist_t *config; uint64_t searchguid = 0; char *searchname = NULL; char *propval; - nvlist_t *found_config; nvlist_t *policy = NULL; nvlist_t *props = NULL; - boolean_t first; int flags = ZFS_IMPORT_NORMAL; uint32_t rewind_policy = ZPOOL_NO_REWIND; boolean_t dryrun = B_FALSE; @@ -3325,7 +3447,8 @@ zpool_do_import(int argc, char **argv) boolean_t xtreme_rewind = B_FALSE; boolean_t do_scan = B_FALSE; boolean_t pool_exists = B_FALSE; - uint64_t pool_state, txg = -1ULL; + boolean_t pool_specified = B_FALSE; + uint64_t txg = -1ULL; char *cachefile = NULL; importargs_t idata = { 0 }; char *endptr; @@ -3447,6 +3570,11 @@ zpool_do_import(int argc, char **argv) usage(B_FALSE); } + if (cachefile && do_scan) { + (void) fprintf(stderr, gettext("-c is incompatible with -s\n")); + usage(B_FALSE); + } + if ((flags & ZFS_IMPORT_LOAD_KEYS) && (flags & ZFS_IMPORT_ONLY)) { (void) fprintf(stderr, gettext("-l is incompatible with -N\n")); usage(B_FALSE); @@ -3527,7 +3655,7 @@ zpool_do_import(int argc, char **argv) searchname = argv[0]; searchguid = 0; } - found_config = NULL; + pool_specified = B_TRUE; /* * User specified a name or guid. Ensure it's unique. @@ -3606,98 +3734,33 @@ zpool_do_import(int argc, char **argv) return (1); } + err = import_pools(pools, props, mntopts, flags, argv[0], + argc == 1 ? NULL : argv[1], do_destroyed, pool_specified, + do_all, &idata); + /* - * At this point we have a list of import candidate configs. Even if - * we were searching by pool name or guid, we still need to - * post-process the list to deal with pool state and possible - * duplicate names. + * If we're using the cachefile and we failed to import, then + * fallback to scanning the directory for pools that match + * those in the cachefile. */ - err = 0; - elem = NULL; - first = B_TRUE; - while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) { - - verify(nvpair_value_nvlist(elem, &config) == 0); - - verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, - &pool_state) == 0); - if (!do_destroyed && pool_state == POOL_STATE_DESTROYED) - continue; - if (do_destroyed && pool_state != POOL_STATE_DESTROYED) - continue; - - verify(nvlist_add_nvlist(config, ZPOOL_LOAD_POLICY, - policy) == 0); - - if (argc == 0) { - if (first) - first = B_FALSE; - else if (!do_all) - (void) printf("\n"); - - if (do_all) { - err |= do_import(config, NULL, mntopts, - props, flags); - } else { - show_import(config); - } - } else if (searchname != NULL) { - char *name; - - /* - * We are searching for a pool based on name. - */ - verify(nvlist_lookup_string(config, - ZPOOL_CONFIG_POOL_NAME, &name) == 0); + if (err != 0 && cachefile != NULL) { + (void) printf(gettext("cachefile import failed, retrying\n")); - if (strcmp(name, searchname) == 0) { - if (found_config != NULL) { - (void) fprintf(stderr, gettext( - "cannot import '%s': more than " - "one matching pool\n"), searchname); - (void) fprintf(stderr, gettext( - "import by numeric ID instead\n")); - err = B_TRUE; - } - found_config = config; - } - } else { - uint64_t guid; - - /* - * Search for a pool by guid. - */ - verify(nvlist_lookup_uint64(config, - ZPOOL_CONFIG_POOL_GUID, &guid) == 0); - - if (guid == searchguid) - found_config = config; - } - } + /* + * We use the scan flag to gather the directories that exist + * in the cachefile. If we need to fallback to searching for + * the pool config, we will only search devices in these + * directories. + */ + idata.scan = B_TRUE; + nvlist_free(pools); + pools = zpool_search_import(g_zfs, &idata, &libzfs_config_ops); - /* - * If we were searching for a specific pool, verify that we found a - * pool, and then do the import. - */ - if (argc != 0 && err == 0) { - if (found_config == NULL) { - (void) fprintf(stderr, gettext("cannot import '%s': " - "no such pool available\n"), argv[0]); - err = B_TRUE; - } else { - err |= do_import(found_config, argc == 1 ? NULL : - argv[1], mntopts, props, flags); - } + err = import_pools(pools, props, mntopts, flags, argv[0], + argc == 1 ? NULL : argv[1], do_destroyed, pool_specified, + do_all, &idata); } - /* - * If we were just looking for pools, report an error if none were - * found. - */ - if (argc == 0 && first) - (void) fprintf(stderr, - gettext("no pools available to import\n")); - error: nvlist_free(props); nvlist_free(pools); @@ -7785,8 +7848,8 @@ print_removal_status(zpool_handle_t *zhp, pool_removal_stat_t *prs) * do not print estimated time if hours_left is more than * 30 days */ - (void) printf(gettext(" %s copied out of %s at %s/s, " - "%.2f%% done"), + (void) printf(gettext( + "\t%s copied out of %s at %s/s, %.2f%% done"), examined_buf, total_buf, rate_buf, 100 * fraction_done); if (hours_left < (30 * 24)) { (void) printf(gettext(", %lluh%um to go\n"), @@ -7801,8 +7864,8 @@ print_removal_status(zpool_handle_t *zhp, pool_removal_stat_t *prs) if (prs->prs_mapping_memory > 0) { char mem_buf[7]; zfs_nicenum(prs->prs_mapping_memory, mem_buf, sizeof (mem_buf)); - (void) printf(gettext(" %s memory used for " - "removed device mappings\n"), + (void) printf(gettext( + "\t%s memory used for removed device mappings\n"), mem_buf); } } diff --git a/cmd/zstream/zstream_redup.c b/cmd/zstream/zstream_redup.c index 41f1068e3dfc..15dd8a1ed126 100644 --- a/cmd/zstream/zstream_redup.c +++ b/cmd/zstream/zstream_redup.c @@ -248,6 +248,7 @@ zfs_redup_stream(int infd, int outfd, boolean_t verbose) fflags = DMU_GET_FEATUREFLAGS(drrb->drr_versioninfo); fflags &= ~(DMU_BACKUP_FEATURE_DEDUP | DMU_BACKUP_FEATURE_DEDUPPROPS); + /* cppcheck-suppress syntaxError */ DMU_SET_FEATUREFLAGS(drrb->drr_versioninfo, fflags); int sz = drr->drr_payloadlen; diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 305d0c6936b2..cd5996c0424c 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -11,6 +11,7 @@ AC_DEFUN([ZFS_AC_DEBUG_ENABLE], [ DEBUG_CPPFLAGS="-DDEBUG -UNDEBUG" DEBUG_LDFLAGS="" DEBUG_ZFS="_with_debug" + WITH_DEBUG="true" AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled]) KERNEL_DEBUG_CFLAGS="-Werror" @@ -22,6 +23,7 @@ AC_DEFUN([ZFS_AC_DEBUG_DISABLE], [ DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG" DEBUG_LDFLAGS="" DEBUG_ZFS="_without_debug" + WITH_DEBUG="" KERNEL_DEBUG_CFLAGS="" KERNEL_DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG" @@ -51,6 +53,7 @@ AC_DEFUN([ZFS_AC_DEBUG], [ AC_SUBST(DEBUG_CPPFLAGS) AC_SUBST(DEBUG_LDFLAGS) AC_SUBST(DEBUG_ZFS) + AC_SUBST(WITH_DEBUG) AC_SUBST(KERNEL_DEBUG_CFLAGS) AC_SUBST(KERNEL_DEBUG_CPPFLAGS) @@ -152,6 +155,39 @@ AC_DEFUN([ZFS_AC_DEBUG_KMEM_TRACKING], [ AC_MSG_RESULT([$enable_debug_kmem_tracking]) ]) +AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], [ + AS_IF([sysctl -n kern.conftxt | fgrep -qx $'options\tINVARIANTS'], + [enable_invariants="yes"], + [enable_invariants="no"]) +]) + +AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT], [ + AM_COND_IF([BUILD_FREEBSD], + [ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], + [enable_invariants="no"]) +]) + +dnl # +dnl # Detected for the running kernel by default, enables INVARIANTS features +dnl # in the FreeBSD kernel module. This feature must be used when building +dnl # for a FreeBSD kernel with "options INVARIANTS" in the KERNCONF and must +dnl # not be used when the INVARIANTS option is absent. +dnl # +AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS], [ + AC_MSG_CHECKING([whether FreeBSD kernel INVARIANTS checks are enabled]) + AC_ARG_ENABLE([invariants], + [AS_HELP_STRING([--enable-invariants], + [Enable FreeBSD kernel INVARIANTS checks [[default: detect]]])], + [], [ZFS_AC_DEBUG_INVARIANTS_DETECT]) + + AS_IF([test "x$enable_invariants" = xyes], + [WITH_INVARIANTS="true"], + [WITH_INVARIANTS=""]) + AC_SUBST(WITH_INVARIANTS) + + AC_MSG_RESULT([$enable_invariants]) +]) + AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ AX_COUNT_CPUS([]) AC_SUBST(CPU_COUNT) diff --git a/configure.ac b/configure.ac index b2d88554ed7d..07f590b390bd 100644 --- a/configure.ac +++ b/configure.ac @@ -61,6 +61,7 @@ ZFS_AC_DEBUG ZFS_AC_DEBUGINFO ZFS_AC_DEBUG_KMEM ZFS_AC_DEBUG_KMEM_TRACKING +ZFS_AC_DEBUG_INVARIANTS AC_CONFIG_FILES([ Makefile diff --git a/include/os/freebsd/spl/sys/Makefile.am b/include/os/freebsd/spl/sys/Makefile.am index ca45b42b6b8d..6bee47830d9c 100644 --- a/include/os/freebsd/spl/sys/Makefile.am +++ b/include/os/freebsd/spl/sys/Makefile.am @@ -4,6 +4,7 @@ KERNEL_H = \ atomic.h \ byteorder.h \ callb.h \ + ccompat.h \ ccompile.h \ cmn_err.h \ condvar.h \ @@ -18,9 +19,11 @@ KERNEL_H = \ fcntl.h \ file.h \ freebsd_rwlock.h \ + idmap.h \ inttypes.h \ isa_defs.h \ kmem_cache.h \ + kidmap.h \ kmem.h \ kstat.h \ list_impl.h \ diff --git a/include/os/freebsd/spl/sys/debug.h b/include/os/freebsd/spl/sys/debug.h index 2751f57801f7..1f820bc3345f 100644 --- a/include/os/freebsd/spl/sys/debug.h +++ b/include/os/freebsd/spl/sys/debug.h @@ -68,65 +68,65 @@ void spl_dumpstack(void); #define PANIC(fmt, a...) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a) -#define VERIFY(cond) \ - (void) (unlikely(!(cond)) && \ +#define VERIFY(cond) \ + (void) (unlikely(!(cond)) && \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "%s", "VERIFY(" #cond ") failed\n")) -#define VERIFY3B(LEFT, OP, RIGHT) do { \ - boolean_t _verify3_left = (boolean_t)(LEFT); \ - boolean_t _verify3_right = (boolean_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3B(LEFT, OP, RIGHT) do { \ + const boolean_t _verify3_left = (boolean_t)(LEFT); \ + const boolean_t _verify3_right = (boolean_t)(RIGHT);\ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%d " #OP " %d)\n", \ - (boolean_t) (_verify3_left), \ - (boolean_t) (_verify3_right)); \ + "failed (%d " #OP " %d)\n", \ + (boolean_t) (_verify3_left), \ + (boolean_t) (_verify3_right)); \ } while (0) -#define VERIFY3S(LEFT, OP, RIGHT) do { \ - int64_t _verify3_left = (int64_t)(LEFT); \ - int64_t _verify3_right = (int64_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3S(LEFT, OP, RIGHT) do { \ + const int64_t _verify3_left = (int64_t)(LEFT); \ + const int64_t _verify3_right = (int64_t)(RIGHT); \ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%lld " #OP " %lld)\n", \ - (long long) (_verify3_left), \ - (long long) (_verify3_right)); \ + "failed (%lld " #OP " %lld)\n", \ + (long long) (_verify3_left), \ + (long long) (_verify3_right)); \ } while (0) -#define VERIFY3U(LEFT, OP, RIGHT) do { \ - uint64_t _verify3_left = (uint64_t)(LEFT); \ - uint64_t _verify3_right = (uint64_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3U(LEFT, OP, RIGHT) do { \ + const uint64_t _verify3_left = (uint64_t)(LEFT); \ + const uint64_t _verify3_right = (uint64_t)(RIGHT); \ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%llu " #OP " %llu)\n", \ - (unsigned long long) (_verify3_left), \ - (unsigned long long) (_verify3_right)); \ + "failed (%llu " #OP " %llu)\n", \ + (unsigned long long) (_verify3_left), \ + (unsigned long long) (_verify3_right)); \ } while (0) -#define VERIFY3P(LEFT, OP, RIGHT) do { \ - uintptr_t _verify3_left = (uintptr_t)(LEFT); \ - uintptr_t _verify3_right = (uintptr_t)(RIGHT); \ - if (!(_verify3_left OP _verify3_right)) \ +#define VERIFY3P(LEFT, OP, RIGHT) do { \ + const uintptr_t _verify3_left = (uintptr_t)(LEFT); \ + const uintptr_t _verify3_right = (uintptr_t)(RIGHT);\ + if (unlikely(!(_verify3_left OP _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ - "failed (%px " #OP " %px)\n", \ - (void *) (_verify3_left), \ - (void *) (_verify3_right)); \ + "failed (%px " #OP " %px)\n", \ + (void *) (_verify3_left), \ + (void *) (_verify3_right)); \ } while (0) -#define VERIFY0(RIGHT) do { \ - int64_t _verify3_left = (int64_t)(0); \ - int64_t _verify3_right = (int64_t)(RIGHT); \ - if (!(_verify3_left == _verify3_right)) \ +#define VERIFY0(RIGHT) do { \ + const int64_t _verify3_left = (int64_t)(0); \ + const int64_t _verify3_right = (int64_t)(RIGHT); \ + if (unlikely(!(_verify3_left == _verify3_right))) \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ - "VERIFY3(0 == " #RIGHT ") " \ - "failed (0 == %lld)\n", \ - (long long) (_verify3_right)); \ + "VERIFY3(0 == " #RIGHT ") " \ + "failed (0 == %lld)\n", \ + (long long) (_verify3_right)); \ } while (0) -#define CTASSERT_GLOBAL(x) CTASSERT(x) +#define CTASSERT_GLOBAL(x) CTASSERT(x) /* * Debugging disabled (--disable-debug) @@ -154,11 +154,11 @@ void spl_dumpstack(void); #define ASSERT0 VERIFY0 #define ASSERT VERIFY #define IMPLY(A, B) \ - ((void)(((!(A)) || (B)) || \ + ((void)(likely((!(A)) || (B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") implies (" #B ")"))) #define EQUIV(A, B) \ - ((void)((!!(A) == !!(B)) || \ + ((void)(likely(!!(A) == !!(B)) || \ spl_panic(__FILE__, __FUNCTION__, __LINE__, \ "(" #A ") is equivalent to (" #B ")"))) /* END CSTYLED */ diff --git a/include/os/freebsd/zfs/sys/zfs_vfsops_os.h b/include/os/freebsd/zfs/sys/zfs_vfsops_os.h index c7f464d034bd..a263b48f7517 100644 --- a/include/os/freebsd/zfs/sys/zfs_vfsops_os.h +++ b/include/os/freebsd/zfs/sys/zfs_vfsops_os.h @@ -27,6 +27,10 @@ #ifndef _SYS_FS_ZFS_VFSOPS_H #define _SYS_FS_ZFS_VFSOPS_H +#if __FreeBSD_version >= 1300125 +#define TEARDOWN_RMS +#endif + #if __FreeBSD_version >= 1300109 #define TEARDOWN_INACTIVE_RMS #endif @@ -46,10 +50,16 @@ extern "C" { #endif -#ifdef TEARDOWN_INACTIVE_RMS +#ifdef TEARDOWN_RMS typedef struct rmslock zfs_teardown_lock_t; #else -#define zfs_teardown_lock_t krwlock_t +#define zfs_teardown_lock_t rrmlock_t +#endif + +#ifdef TEARDOWN_INACTIVE_RMS +typedef struct rmslock zfs_teardown_inactive_lock_t; +#else +#define zfs_teardown_inactive_lock_t krwlock_t #endif typedef struct zfsvfs zfsvfs_t; @@ -80,8 +90,8 @@ struct zfsvfs { int z_norm; /* normalization flags */ boolean_t z_atime; /* enable atimes mount option */ boolean_t z_unmounted; /* unmounted */ - rrmlock_t z_teardown_lock; - zfs_teardown_lock_t z_teardown_inactive_lock; + zfs_teardown_lock_t z_teardown_lock; + zfs_teardown_inactive_lock_t z_teardown_inactive_lock; list_t z_all_znodes; /* all vnodes in the fs */ uint64_t z_nr_znodes; /* number of znodes in the fs */ kmutex_t z_znodes_lock; /* lock for z_all_znodes */ @@ -112,53 +122,121 @@ struct zfsvfs { struct task z_unlinked_drain_task; }; +#ifdef TEARDOWN_RMS +#define ZFS_TEARDOWN_INIT(zfsvfs) \ + rms_init(&(zfsvfs)->z_teardown_lock, "zfs teardown") + +#define ZFS_TEARDOWN_DESTROY(zfsvfs) \ + rms_destroy(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \ + rms_try_rlock(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \ + rms_rlock(&(zfsvfs)->z_teardown_lock); + +#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \ + rms_runlock(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \ + rms_wlock(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \ + rms_wunlock(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \ + rms_unlock(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \ + rms_rowned(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \ + rms_wowned(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_HELD(zfsvfs) \ + rms_owned_any(&(zfsvfs)->z_teardown_lock) +#else +#define ZFS_TEARDOWN_INIT(zfsvfs) \ + rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE) + +#define ZFS_TEARDOWN_DESTROY(zfsvfs) \ + rrm_destroy(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \ + rw_tryenter(&(zfsvfs)->z_teardown_lock, RW_READER) + +#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \ + rrm_enter_read(&(zfsvfs)->z_teardown_lock, tag); + +#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \ + rrm_enter(&(zfsvfs)->z_teardown_lock, RW_WRITER, tag) + +#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \ + RRM_READ_HELD(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \ + RRM_WRITE_HELD(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_HELD(zfsvfs) \ + RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock) +#endif + #ifdef TEARDOWN_INACTIVE_RMS -#define ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \ rms_init(&(zfsvfs)->z_teardown_inactive_lock, "zfs teardown inactive") -#define ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \ rms_destroy(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs) \ rms_try_rlock(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs) \ rms_rlock(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \ rms_runlock(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \ rms_wlock(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs) \ rms_wunlock(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs) \ rms_wowned(&(zfsvfs)->z_teardown_inactive_lock) #else -#define ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \ rw_init(&(zfsvfs)->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL) -#define ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \ rw_destroy(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs) \ rw_tryenter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER) -#define ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs) \ rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER) -#define ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \ rw_exit(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \ rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_WRITER) -#define ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs) \ rw_exit(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs) \ RW_WRITE_HELD(&(zfsvfs)->z_teardown_inactive_lock) #endif diff --git a/include/os/freebsd/zfs/sys/zfs_znode_impl.h b/include/os/freebsd/zfs/sys/zfs_znode_impl.h index 186afa9b2b39..d7cdb360c2bc 100644 --- a/include/os/freebsd/zfs/sys/zfs_znode_impl.h +++ b/include/os/freebsd/zfs/sys/zfs_znode_impl.h @@ -124,19 +124,19 @@ extern minor_t zfsdev_minor_alloc(void); /* Called on entry to each ZFS vnode and vfs operation */ #define ZFS_ENTER(zfsvfs) \ { \ - rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ - if ((zfsvfs)->z_unmounted) { \ - ZFS_EXIT(zfsvfs); \ + ZFS_TEARDOWN_ENTER_READ((zfsvfs), FTAG); \ + if (__predict_false((zfsvfs)->z_unmounted)) { \ + ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \ return (EIO); \ } \ } /* Must be called before exiting the vop */ -#define ZFS_EXIT(zfsvfs) rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG) +#define ZFS_EXIT(zfsvfs) ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG) /* Verifies the znode is valid */ #define ZFS_VERIFY_ZP(zp) \ - if ((zp)->z_sa_hdl == NULL) { \ + if (__predict_false((zp)->z_sa_hdl == NULL)) { \ ZFS_EXIT((zp)->z_zfsvfs); \ return (EIO); \ } \ diff --git a/include/os/linux/spl/sys/debug.h b/include/os/linux/spl/sys/debug.h index 46da5c783397..dc6b85eebff7 100644 *** 2070 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Mar 13 17:38:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 712F557D5D5; Sat, 13 Mar 2021 17:38:17 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay213.isp.belgacom.be (mailrelay213.isp.belgacom.be [195.238.22.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign RSA OV SSL CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DyVJm6Gj7z57pR; Sat, 13 Mar 2021 17:38:16 +0000 (UTC) (envelope-from tijl@freebsd.org) IronPort-SDR: 8x4W9c24hjdW4vjtyJ7QY9JXx5Qny87QoN24bLLq1wEOyX/CVU0+W3iikNhnmQJ3tY3Z1zn0lA R8DiUkQpy/vdN8GKFgh5DOuc70GQEUvFtbAURYqm8tdX+0jQ54N3NZzb/H3B1T1ns2TqTpv1x8 +gfmjyk23BC5lvDkOFhA66cMGTzj8yQKSJ0tU9ZXkl0eBd3bpBM1xAnUDzOezcudLH8YIq5WyG FHPCv0cRR10m6W5ygMrOvUPHva49U16bXtHVD63CH2KqeVHF7OZXgZTEs6ZXDCon56+eElXHDr QxA= X-IPAS-Result: =?us-ascii?q?A2BEDACF90xg/wSs8lFaHAEBAQEBAQcBARIBAQQEAQFAB?= =?us-ascii?q?4FIAoMKFVYBUBqNRYYoghgDNwGKcIl8hUmBaAsBAQEBAQEBAQEzCgQBAYRNA?= =?us-ascii?q?oF1JjgTAgMBAQEDAgMBAQEBBgEBAQEBAQUEAYYYOQ1DARABBAGBXiKDawEFO?= =?us-ascii?q?j8QCw4KFRlXBhOCcYMLC6xJgTSJX4EJgTkBjUJCggyDdzU+gVF4FwQWgQCBB?= =?us-ascii?q?oU3BIIEQgGBDxMYXS8PaQEFPZBHE4xlml+CCYMMiUqHD4tWMYR2nx8thhKaB?= =?us-ascii?q?ZIthmuBek0wCIMkCUcZDY4oAxYUgweFRoVGQAMvCy0CBgoBAQMJgxWHY4NxA?= =?us-ascii?q?QE?= IronPort-PHdr: A9a23:vZAzfR/2xHjPev9uWQu7ngc9DhMPi/DPJgcQr6AfoPdwSMyLwZ3uM QTl6Ol3ixeRBMOHsqMC0rCK+PC/EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7F skRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCe5bL9oM Rm6swrcusYVjIZgN6081gbHrnxUdupM2GhmP0iTnxHy5sex+J5s7SFdsO8/+sBDTKv3Yb02Q aRXAzo6PW814tbrtQTYQguU+nQcSGQWnQFWDAXD8Rr3Q43+sir+tup6xSmaIcj7Rq06VDi+8 6tmTgLjhSEaPDA77W7XkNR9gqxbrhy/uhJxwIzbYI+aO/Vica3QZs8aSGhbU8pNSyBNHp2wY o0SBOQBJ+ZYqIz9qkMQoxm7AQmnGf3iyjhPhn/tw6I61v4uEQfd3Ac9GN8OrHXUrNfxNKoJU e611rfHwiveYv1L1znx8o/IcgouofyVW797bMXex1U1GQzfklWQtZLqPymT1ukVrWWW6/dtW OyrhmM7qAx8rCSiytkyh4TKm48Z1FTJ+CF4zYsoONC1VkB1bNGqHZZUuC+XKpd6TMwjTmx1u Ss0xLsLsoO1cigNzZQo3R/fa/qffoiG+BLsSvieLixjhH14Yr6/gAyy8Uemx+bhVce0yE5Ho ylYntXWqHwA2ALf5tKaRvZ/4EutwzmC2gbO4e9eO080j7DUK5s5z741kZocrFrMEzftmEXzk K+WbkIk+vW06+j/YrXpuJucN4hshwH9KKsuns2/AeEmPQgUWGiX4/i81Lzh/U39WrlFkvo2k q7CsJ/EIMQUvKi5AxRP3oYk8Ra/AC+q0NUenXYZMFJIYBGKg5XzN13QL/30E+2zj0munTt13 fzLMaXtApDXIXjClLfhc6x960lZyAcr0dBf5pBUCrUaLfL9QE/+qsLXAQQiMwOp2ernD8991 owGVWKVHqCZKL/SsUOP5u83PuaDepEVtC/hJPgi4v7uiH45mUMGfaWwxpsXcmy3Eu1jI0qDY HrshMwMEWkQvgUgUuPlk0aCXiNJa3a1RaI86SkxCJi6AofbWoCtnLuB0T+mEZJIeGBKE0yDE XDtd4WBWvcMdDmSLtZ6kjweSbetUpUu1RWqtALhxbpnNPTb9TMDupL4ydd5/erTlQs99TZsF cSSz3mNT31onmMPXzI2x7p/rlBkxlif1qh4hvlYFd1P5/NVTAg6L4Xcwvd0C9DoRA3OYMyGS E27Tdm8BjExVN0xyccUY0lhA9WikgzD3y2yDrAIlryLAYc58qzG33fvOcly0G3G27Q7g1khW MtPOj7uuqkq2wnWBpLTgg2wkaqwdK9UiCLM8U+t12eDlnp0FglqXvOWc2oYYx7qStCxzUTFV LKrALI8el9dyMyGAoVQZ9DDtnkAQ+3sboeNK1mtknu9UE7bjoiHa5DnLj114Q== IronPort-HdrOrdr: A9a23:UJv61Ky7/1mA43TZH/qkKrPwqL1zdoIgy1knxilNYDZSddGVkN 3roeQD2XbP+VAscVwDufTFAqmPRnvA6YV4iLN7AZ6OVBTr0VHHEKhM9o3nqgeMJwTa9vRBkY dMGpIOa+HYKFhhkILH5xOlGMwr29mN/MmT5Nv261dIYUVUZ7p77wF/Yzz6LmRTSBNdDZQ0UL qwj/A3wAaIQngcYsSlCnRtZYGqzeHjro7sYhINGncchzWmsDXA0tLHOind9C03FxlIxa4m+W jDjhaR3NTAj9iLjiXy80WW1YlfktmJ8KonOOWczssSIVzX+2KVWLg= X-IronPort-Anti-Spam-Filtered: true Received: from 4.172-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.172.4]) by relay.proximus.be with ESMTP; 13 Mar 2021 18:38:14 +0100 Received: from localhost (localhost [127.0.0.1]) by kalimero.tijl.coosemans.org (8.16.1/8.16.1) with ESMTP id 12DHcDZl005701; Sat, 13 Mar 2021 18:38:13 +0100 (CET) (envelope-from tijl@FreeBSD.org) Date: Sat, 13 Mar 2021 18:38:12 +0100 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Dimitry Andric Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 9097e3cbcac4 - main - Partially revert libcxxrt changes to avoid _Unwind_Exception change Message-ID: <20210313183812.77b74819@FreeBSD.org> In-Reply-To: <202103131354.12DDsnKR065154@gitrepo.freebsd.org> References: <202103131354.12DDsnKR065154@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DyVJm6Gj7z57pR 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 17:38:17 -0000 On Sat, 13 Mar 2021 13:54:49 GMT Dimitry Andric wrote: > The branch main has been updated by dim: > > URL: https://cgit.FreeBSD.org/src/commit/?id=9097e3cbcac455eb0dedd097d8d5548c72568d0a > > commit 9097e3cbcac455eb0dedd097d8d5548c72568d0a > Author: Dimitry Andric > AuthorDate: 2021-03-13 13:54:24 +0000 > Commit: Dimitry Andric > CommitDate: 2021-03-13 13:54:24 +0000 > > Partially revert libcxxrt changes to avoid _Unwind_Exception change > > (Note I am also applying this to main and stable/13, to restore the old > libcxxrt ABI and to avoid having to maintain a compat library.) > > After the recent cherry-picking of libcxxrt commits 0ee0dbfb0d26 and > d2b3fadf2db5, users reported that editors/libreoffice packages from the > official package builders did not start anymore. It turns out that the > combination of these commits subtly changes the ABI, requiring all > applications that depend on internal details of struct _Unwind_Exception > (available via unwind-arm.h and unwind-itanium.h) to be recompiled. > > However, the FreeBSD package builders always use -RELEASE jails, so > these still use the old declaration of struct _Unwind_Exception, which > is not entirely compatible. In particular, LibreOffice uses this struct > in its internal "uno bridge" component, where it attempts to setup its > own exception handling mechanism. > > To fix this incompatibility, go back to the old declarations of struct > _Unwind_Exception, and restore the __LP64__ specific workaround we had > in place before (which was to cope with yet another, older ABI bug). > > Effectively, this reverts upstream libcxxrt commits 88bdf6b290da > ("Specify double-word alignment for ARM unwind") and b96169641f79 > ("Updated Itanium unwind"), and reapplies our commit 3c4fd2463bb2 > ("libcxxrt: add padding in __cxa_allocate_* to fix alignment"). > > PR: 253840 > --- > contrib/libcxxrt/exception.cc | 30 ++++++++++++++++++++++++------ > contrib/libcxxrt/unwind-arm.h | 2 +- > contrib/libcxxrt/unwind-itanium.h | 9 +++------ > 3 files changed, 28 insertions(+), 13 deletions(-) > > diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc > index 0fb26ddb4ed2..0de878e9e6db 100644 > --- a/contrib/libcxxrt/exception.cc > +++ b/contrib/libcxxrt/exception.cc > @@ -572,6 +572,19 @@ static void free_exception(char *e) > } > } > > +#ifdef __LP64__ > +/** > + * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte > + * alignment but it was broken by the addition of the referenceCount. > + * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep > + * compatibility with consumers of the broken __cxa_exception, explicitly add > + * padding on allocation (and account for it on free). > + */ > +static const int exception_alignment_padding = 8; > +#else > +static const int exception_alignment_padding = 0; > +#endif > + > /** > * Allocates an exception structure. Returns a pointer to the space that can > * be used to store an object of thrown_size bytes. This function will use an > @@ -580,16 +593,19 @@ static void free_exception(char *e) > */ > extern "C" void *__cxa_allocate_exception(size_t thrown_size) > { > - size_t size = thrown_size + sizeof(__cxa_exception); > + size_t size = exception_alignment_padding + sizeof(__cxa_exception) + > + thrown_size; > char *buffer = alloc_or_die(size); > - return buffer+sizeof(__cxa_exception); > + return buffer + exception_alignment_padding + sizeof(__cxa_exception); > } > > extern "C" void *__cxa_allocate_dependent_exception(void) > { > - size_t size = sizeof(__cxa_dependent_exception); > + size_t size = exception_alignment_padding + > + sizeof(__cxa_dependent_exception); > char *buffer = alloc_or_die(size); > - return buffer+sizeof(__cxa_dependent_exception); > + return buffer + exception_alignment_padding + > + sizeof(__cxa_dependent_exception); > } > > /** > @@ -617,7 +633,8 @@ extern "C" void __cxa_free_exception(void *thrown_exception) > } > } > > - free_exception(reinterpret_cast(ex)); > + free_exception(reinterpret_cast(ex) - > + exception_alignment_padding); > } > > static void releaseException(__cxa_exception *exception) > @@ -644,7 +661,8 @@ void __cxa_free_dependent_exception(void *thrown_exception) > { > releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); > } > - free_exception(reinterpret_cast(ex)); > + free_exception(reinterpret_cast(ex) - > + exception_alignment_padding); > } > > /** > diff --git a/contrib/libcxxrt/unwind-arm.h b/contrib/libcxxrt/unwind-arm.h > index ec81237e573b..6eb9d9e45981 100644 > --- a/contrib/libcxxrt/unwind-arm.h > +++ b/contrib/libcxxrt/unwind-arm.h > @@ -97,7 +97,7 @@ struct _Unwind_Exception > } pr_cache; > /** Force alignment of next item to 8-byte boundary */ > long long int :0; > -} __attribute__((__aligned__(8))); > +}; > > /* Unwinding functions */ > _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *ucbp); > diff --git a/contrib/libcxxrt/unwind-itanium.h b/contrib/libcxxrt/unwind-itanium.h > index 199d91de283d..1ee0cf0e81c4 100644 > --- a/contrib/libcxxrt/unwind-itanium.h > +++ b/contrib/libcxxrt/unwind-itanium.h > @@ -79,12 +79,9 @@ struct _Unwind_Exception > { > uint64_t exception_class; > _Unwind_Exception_Cleanup_Fn exception_cleanup; > - uintptr_t private_1; > - uintptr_t private_2; > -#if __SIZEOF_POINTER__ == 4 > - uint32_t reserved[3]; > -#endif > - } __attribute__((__aligned__)); > + unsigned long private_1; > + unsigned long private_2; > + } ; Shouldn't these definitions be the same as the ones in GCC? From owner-dev-commits-src-all@freebsd.org Sat Mar 13 18:32:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF73A57ED25; Sat, 13 Mar 2021 18:32: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 4DyWWV6SL0z3Cb8; Sat, 13 Mar 2021 18:32: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 D0A0A7635; Sat, 13 Mar 2021 18:32: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 12DIWc8l034222; Sat, 13 Mar 2021 18:32:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DIWcZi034221; Sat, 13 Mar 2021 18:32:38 GMT (envelope-from git) Date: Sat, 13 Mar 2021 18:32:38 GMT Message-Id: <202103131832.12DIWcZi034221@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: a9275d996c22 - main - ls(1): Refine the HISTORY within the manual page. 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: a9275d996c229a30879baa42a6d02d24663ac43b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 18:32:39 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a9275d996c229a30879baa42a6d02d24663ac43b commit a9275d996c229a30879baa42a6d02d24663ac43b Author: Gordon Bergling AuthorDate: 2021-03-13 18:28:26 +0000 Commit: Gordon Bergling CommitDate: 2021-03-13 18:28:26 +0000 ls(1): Refine the HISTORY within the manual page. A simple find command appeared in Version 1 AT&T UNIX and was removed in Version 3 AT&T UNIX. It was rewritten for Version 5 AT&T UNIX and later be enhanced for the Programmer's Workbench (PWB). These changes were later incorporated in AT&T UNIX v7. Reviewed by: imp MFC after: 1 week --- usr.bin/find/find.1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1 index 43b1262352a6..0c5c113479a3 100644 --- a/usr.bin/find/find.1 +++ b/usr.bin/find/find.1 @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd February 23, 2021 +.Dd March 13, 2021 .Dt FIND 1 .Os .Sh NAME @@ -1071,10 +1071,17 @@ and .Xr sed 1 options. .Sh HISTORY -A +A simple .Nm command appeared in -.At v1 . +.At v1 +and was removed in +.At v3 . +It was rewritten for +.At v5 +and later be enhanced for the Programmer's Workbench (PWB). +These changes were later incorporated in +.At v7. .Sh BUGS The special characters used by .Nm From owner-dev-commits-src-all@freebsd.org Sat Mar 13 18:36:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F07A57EF0A; Sat, 13 Mar 2021 18:36:52 +0000 (UTC) (envelope-from gbe@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 4DyWcN1L4Zz3DBR; Sat, 13 Mar 2021 18:36:52 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d740b96020afcfec3802e2f2.dip0.t-ipconnect.de [IPv6:2003:d5:d740:b960:20af:cfec:3802:e2f2]) (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 BBC2B6416; Sat, 13 Mar 2021 18:36:51 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Sat, 13 Mar 2021 19:36:50 +0100 From: Gordon Bergling To: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: a9275d996c22 - main - ls(1): Refine the HISTORY within the manual page. Message-ID: References: <202103131832.12DIWcZi034221@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202103131832.12DIWcZi034221@gitrepo.freebsd.org> X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 7:34PM up 3 days, 23:56, 5 users, load averages: 0.37, 0.28, 0.20 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 18:36:52 -0000 Sorry, this has to be read as, find(1): Refine the HISTORY within the manual page. --Gordon On Sat, Mar 13, 2021 at 06:32:38PM +0000, Gordon Bergling wrote: > The branch main has been updated by gbe (doc committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=a9275d996c229a30879baa42a6d02d24663ac43b > > commit a9275d996c229a30879baa42a6d02d24663ac43b > Author: Gordon Bergling > AuthorDate: 2021-03-13 18:28:26 +0000 > Commit: Gordon Bergling > CommitDate: 2021-03-13 18:28:26 +0000 > > ls(1): Refine the HISTORY within the manual page. > > A simple find command appeared in Version 1 AT&T UNIX and was removed in > Version 3 AT&T UNIX. It was rewritten for Version 5 AT&T UNIX and later > be enhanced for the Programmer's Workbench (PWB). These changes were > later incorporated in AT&T UNIX v7. > > Reviewed by: imp > MFC after: 1 week > --- > usr.bin/find/find.1 | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1 > index 43b1262352a6..0c5c113479a3 100644 > --- a/usr.bin/find/find.1 > +++ b/usr.bin/find/find.1 > @@ -31,7 +31,7 @@ > .\" @(#)find.1 8.7 (Berkeley) 5/9/95 > .\" $FreeBSD$ > .\" > -.Dd February 23, 2021 > +.Dd March 13, 2021 > .Dt FIND 1 > .Os > .Sh NAME > @@ -1071,10 +1071,17 @@ and > .Xr sed 1 > options. > .Sh HISTORY > -A > +A simple > .Nm > command appeared in > -.At v1 . > +.At v1 > +and was removed in > +.At v3 . > +It was rewritten for > +.At v5 > +and later be enhanced for the Programmer's Workbench (PWB). > +These changes were later incorporated in > +.At v7. > .Sh BUGS > The special characters used by > .Nm > _______________________________________________ > 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-all@freebsd.org Sat Mar 13 20:26:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FD6F5AA5A0; Sat, 13 Mar 2021 20:26: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 4DyZ2R488pz3MXL; Sat, 13 Mar 2021 20:26: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 80F1A111AE; Sat, 13 Mar 2021 20:26: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 12DKQ7gV079621; Sat, 13 Mar 2021 20:26:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DKQ704079620; Sat, 13 Mar 2021 20:26:07 GMT (envelope-from git) Date: Sat, 13 Mar 2021 20:26:07 GMT Message-Id: <202103132026.12DKQ704079620@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 3489286a5f36 - stable/13 - Fix blackhole/reject routes. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3489286a5f368e7fcf11a9691f9bb5df77abe9a3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 20:26:07 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=3489286a5f368e7fcf11a9691f9bb5df77abe9a3 commit 3489286a5f368e7fcf11a9691f9bb5df77abe9a3 Author: Alexander V. Chernikov AuthorDate: 2021-02-08 23:29:05 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-13 20:18:17 +0000 Fix blackhole/reject routes. Traditionally *BSD routing stack required to supply some interface data for blackhole/reject routes. This lead to varieties of hacks in routing daemons when inserting such routes. With the recent routeing stack changes, gateway sockaddr without RTF_GATEWAY started to be treated differently, purely as link identifier. This change broke net/bird, which installs blackhole routes with 127.0.0.1 gateway without RTF_GATEWAY flags. Fix this by automatically constructing necessary gateway data at rtsock level if RTF_REJECT/RTF_BLACKHOLE is set. Reported by: Marek Zarychta Reviewed by: donner (cherry picked from commit 145bf6c0af48b89f13465e145f4516de37c31d85) --- sys/net/rtsock.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 09d31f8f8076..8230ae5618e3 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -564,6 +564,50 @@ rtm_get_jailed(struct rt_addrinfo *info, struct ifnet *ifp, return (0); } +static int +fill_blackholeinfo(struct rt_addrinfo *info, union sockaddr_union *saun) +{ + struct ifaddr *ifa; + sa_family_t saf; + + if (V_loif == NULL) { + printf("Unable to add blackhole/reject nhop without loopback"); + return (ENOTSUP); + } + info->rti_ifp = V_loif; + + saf = info->rti_info[RTAX_DST]->sa_family; + + CK_STAILQ_FOREACH(ifa, &info->rti_ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family == saf) { + info->rti_ifa = ifa; + break; + } + } + if (info->rti_ifa == NULL) + return (ENOTSUP); + + bzero(saun, sizeof(union sockaddr_union)); + switch (saf) { + case AF_INET: + saun->sin.sin_family = AF_INET; + saun->sin.sin_len = sizeof(struct sockaddr_in); + saun->sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + break; + case AF_INET6: + saun->sin6.sin6_family = AF_INET6; + saun->sin6.sin6_len = sizeof(struct sockaddr_in6); + saun->sin6.sin6_addr = in6addr_loopback; + break; + default: + return (ENOTSUP); + } + info->rti_info[RTAX_GATEWAY] = &saun->sa; + info->rti_flags |= RTF_GATEWAY; + + return (0); +} + /* * Fills in @info based on userland-provided @rtm message. * @@ -949,7 +993,6 @@ route_output(struct mbuf *m, struct socket *so, ...) #endif int alloc_len = 0, len, error = 0, fibnum; sa_family_t saf = AF_UNSPEC; - struct walkarg w; struct rib_cmd_info rc; struct nhop_object *nh; @@ -977,7 +1020,6 @@ route_output(struct mbuf *m, struct socket *so, ...) m_copydata(m, 0, len, (caddr_t)rtm); bzero(&info, sizeof(info)); - bzero(&w, sizeof(w)); nh = NULL; if (rtm->rtm_version != RTM_VERSION) { @@ -1009,6 +1051,18 @@ route_output(struct mbuf *m, struct socket *so, ...) goto flush; } + union sockaddr_union gw_saun; + int blackhole_flags = rtm->rtm_flags & (RTF_BLACKHOLE|RTF_REJECT); + if (blackhole_flags != 0) { + if (blackhole_flags != (RTF_BLACKHOLE | RTF_REJECT)) + error = fill_blackholeinfo(&info, &gw_saun); + else + error = EINVAL; + if (error != 0) + senderr(error); + /* TODO: rebuild rtm from scratch */ + } + switch (rtm->rtm_type) { case RTM_ADD: case RTM_CHANGE: From owner-dev-commits-src-all@freebsd.org Sat Mar 13 20:26:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C17275AA254; Sat, 13 Mar 2021 20:26: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 4DyZ2S50vqz3MMJ; Sat, 13 Mar 2021 20:26: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 9F3FC10D7C; Sat, 13 Mar 2021 20:26: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 12DKQ8vA079644; Sat, 13 Mar 2021 20:26:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DKQ8gs079643; Sat, 13 Mar 2021 20:26:08 GMT (envelope-from git) Date: Sat, 13 Mar 2021 20:26:08 GMT Message-Id: <202103132026.12DKQ8gs079643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: d81b3bb4b19d - stable/13 - Fix various NOINET* builds broken by 145bf6c0af48. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d81b3bb4b19dd1df5b77c825532fde1f7325fa8a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 20:26:08 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=d81b3bb4b19dd1df5b77c825532fde1f7325fa8a commit d81b3bb4b19dd1df5b77c825532fde1f7325fa8a Author: Alexander V. Chernikov AuthorDate: 2021-02-12 20:36:20 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-13 20:18:50 +0000 Fix various NOINET* builds broken by 145bf6c0af48. Reported by: mjg, bdragon (cherry picked from commit 8ca99aecf749dd088310f81f3c5364a462f1e332) --- sys/net/rtsock.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 8230ae5618e3..12e485f917c8 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -589,16 +589,20 @@ fill_blackholeinfo(struct rt_addrinfo *info, union sockaddr_union *saun) bzero(saun, sizeof(union sockaddr_union)); switch (saf) { +#ifdef INET case AF_INET: saun->sin.sin_family = AF_INET; saun->sin.sin_len = sizeof(struct sockaddr_in); saun->sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); break; +#endif +#ifdef INET6 case AF_INET6: saun->sin6.sin6_family = AF_INET6; saun->sin6.sin6_len = sizeof(struct sockaddr_in6); saun->sin6.sin6_addr = in6addr_loopback; break; +#endif default: return (ENOTSUP); } From owner-dev-commits-src-all@freebsd.org Sat Mar 13 20:26:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C41F15AA255; Sat, 13 Mar 2021 20:26: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 4DyZ2V0H9tz3MMP; Sat, 13 Mar 2021 20:26: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 C555610D7D; Sat, 13 Mar 2021 20:26: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 12DKQ9pb079664; Sat, 13 Mar 2021 20:26:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12DKQ9DG079663; Sat, 13 Mar 2021 20:26:09 GMT (envelope-from git) Date: Sat, 13 Mar 2021 20:26:09 GMT Message-Id: <202103132026.12DKQ9DG079663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 8aafa7a02763 - stable/13 - Flush remaining routes from the routing table during VNET shutdown. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8aafa7a0276302a0dcc3d0bd78b4d3842dfd1640 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Mar 2021 20:26:14 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=8aafa7a0276302a0dcc3d0bd78b4d3842dfd1640 commit 8aafa7a0276302a0dcc3d0bd78b4d3842dfd1640 Author: Alexander V. Chernikov AuthorDate: 2021-03-08 21:35:41 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-13 20:19:17 +0000 Flush remaining routes from the routing table during VNET shutdown. Summary: This fixes rtentry leak for the cloned interfaces created inside the VNET. Loopback teardown order is `SI_SUB_INIT_IF`, which happens after `SI_SUB_PROTO_DOMAIN` (route table teardown). Thus, any route table operations are too late to schedule. As the intent of the vnet teardown procedures to minimise the amount of effort by doing global cleanups instead of per-interface ones, address this by adding a relatively light-weight routing table cleanup function, `rib_flush_routes()`. It removes all remaining routes from the routing table and schedules the deletion, which will happen later, when `rtables_destroy()` waits for the current epoch to finish. Test Plan: ``` set_skip:set_skip_group_lo -> passed [0.053s] tail -n 200 /var/log/messages | grep rtentry ``` PR: 253998 Reported by: rashey at superbox.pl Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D29116 (cherry picked from commit b1d63265ac399112b3bca36c3d75df1a3c2c8102) --- sys/net/route.c | 15 --------------- sys/net/route.h | 2 +- sys/net/route/route_ctl.c | 36 ++++++++++++++++++++++++++++++++++++ sys/netinet/ip_input.c | 6 +----- sys/netinet6/ip6_input.c | 5 +++-- 5 files changed, 41 insertions(+), 23 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index a68e46c37861..f07cb3f6581a 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -495,21 +495,6 @@ rt_ifdelroute(const struct rtentry *rt, const struct nhop_object *nh, void *arg) return (1); } -/* - * Delete all remaining routes using this interface - * Unfortuneatly the only way to do this is to slog through - * the entire routing table looking for routes which point - * to this interface...oh well... - */ -void -rt_flushifroutes_af(struct ifnet *ifp, int af) -{ - KASSERT((af >= 1 && af <= AF_MAX), ("%s: af %d not >= 1 and <= %d", - __func__, af, AF_MAX)); - - rib_foreach_table_walk_del(af, rt_ifdelroute, ifp); -} - void rt_flushifroutes(struct ifnet *ifp) { diff --git a/sys/net/route.h b/sys/net/route.h index ab6e1aabc5ae..3fdca303596e 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -429,7 +429,6 @@ struct sockaddr *rtsock_fix_netmask(const struct sockaddr *dst, void rt_updatemtu(struct ifnet *); -void rt_flushifroutes_af(struct ifnet *, int); void rt_flushifroutes(struct ifnet *ifp); /* XXX MRT NEW VERSIONS THAT USE FIBs @@ -442,6 +441,7 @@ int rib_lookup_info(uint32_t, const struct sockaddr *, uint32_t, uint32_t, void rib_free_info(struct rt_addrinfo *info); /* New API */ +void rib_flush_routes_family(int family); struct nhop_object *rib_lookup(uint32_t fibnum, const struct sockaddr *dst, uint32_t flags, uint32_t flowid); #endif diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 9aedfb9d5855..46e0bcfee6b7 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -1341,6 +1341,42 @@ rib_walk_del(u_int fibnum, int family, rib_filter_f_t *filter_f, void *arg, bool NET_EPOCH_EXIT(et); } +static int +rt_delete_unconditional(struct radix_node *rn, void *arg) +{ + struct rtentry *rt = RNTORT(rn); + struct rib_head *rnh = (struct rib_head *)arg; + + rn = rnh->rnh_deladdr(rt_key(rt), rt_mask(rt), &rnh->head); + if (RNTORT(rn) == rt) + rtfree(rt); + + return (0); +} + +/* + * Removes all routes from the routing table without executing notifications. + * rtentres will be removed after the end of a current epoch. + */ +static void +rib_flush_routes(struct rib_head *rnh) +{ + RIB_WLOCK(rnh); + rnh->rnh_walktree(&rnh->head, rt_delete_unconditional, rnh); + RIB_WUNLOCK(rnh); +} + +void +rib_flush_routes_family(int family) +{ + struct rib_head *rnh; + + for (uint32_t fibnum = 0; fibnum < rt_numfibs; fibnum++) { + if ((rnh = rt_tables_get_rnh(fibnum, family)) != NULL) + rib_flush_routes(rnh); + } +} + static void rib_notify(struct rib_head *rnh, enum rib_subscription_type type, struct rib_cmd_info *rc) diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index be21decff6cb..a85f8ac7b567 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -379,7 +379,6 @@ ip_init(void) static void ip_destroy(void *unused __unused) { - struct ifnet *ifp; int error; #ifdef RSS @@ -405,10 +404,7 @@ ip_destroy(void *unused __unused) in_ifscrub_all(); /* Make sure the IPv4 routes are gone as well. */ - IFNET_RLOCK(); - CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) - rt_flushifroutes_af(ifp, AF_INET); - IFNET_RUNLOCK(); + rib_flush_routes_family(AF_INET); /* Destroy IP reassembly queue. */ ipreass_destroy(); diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 80e5acc62548..9ea578f88417 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -386,11 +386,12 @@ ip6_destroy(void *unused __unused) /* IF_ADDR_UNLOCK(ifp); */ in6_ifdetach_destroy(ifp); mld_domifdetach(ifp); - /* Make sure any routes are gone as well. */ - rt_flushifroutes_af(ifp, AF_INET6); } IFNET_RUNLOCK(); + /* Make sure any routes are gone as well. */ + rib_flush_routes_family(AF_INET6); + frag6_destroy(); nd6_destroy(); in6_ifattach_destroy(); From owner-dev-commits-src-all@freebsd.org Sun Mar 14 00:15:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF26F568676; Sun, 14 Mar 2021 00:15:23 +0000 (UTC) (envelope-from dim@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 4Dyg6z5RzFz3sk9; Sun, 14 Mar 2021 00:15:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "R3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 9522B88A1; Sun, 14 Mar 2021 00:15:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58:0:57d:7ad7:3c94:1ec3] (unknown [IPv6:2001:470:7a58:0:57d:7ad7:3c94:1ec3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 10B643E7CC; Sun, 14 Mar 2021 01:15:21 +0100 (CET) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_A3542C0C-E7BF-4613-9BA6-36B2CE593D92"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 9097e3cbcac4 - main - Partially revert libcxxrt changes to avoid _Unwind_Exception change Date: Sun, 14 Mar 2021 01:15:11 +0100 In-Reply-To: <20210313183812.77b74819@FreeBSD.org> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: =?utf-8?Q?T=C4=B3l_Coosemans?= References: <202103131354.12DDsnKR065154@gitrepo.freebsd.org> <20210313183812.77b74819@FreeBSD.org> X-Mailer: Apple Mail (2.3654.60.0.2.21) X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 00:15:23 -0000 --Apple-Mail=_A3542C0C-E7BF-4613-9BA6-36B2CE593D92 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On 13 Mar 2021, at 18:38, T=C4=B3l Coosemans wrote: >=20 > On Sat, 13 Mar 2021 13:54:49 GMT Dimitry Andric = wrote: >> The branch main has been updated by dim: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D9097e3cbcac455eb0dedd097d8d5548c= 72568d0a >>=20 >> commit 9097e3cbcac455eb0dedd097d8d5548c72568d0a >> Author: Dimitry Andric >> AuthorDate: 2021-03-13 13:54:24 +0000 >> Commit: Dimitry Andric >> CommitDate: 2021-03-13 13:54:24 +0000 >>=20 >> Partially revert libcxxrt changes to avoid _Unwind_Exception = change ... >> --- a/contrib/libcxxrt/unwind-itanium.h >> +++ b/contrib/libcxxrt/unwind-itanium.h >> @@ -79,12 +79,9 @@ struct _Unwind_Exception >> { >> uint64_t exception_class; >> _Unwind_Exception_Cleanup_Fn exception_cleanup; >> - uintptr_t private_1; >> - uintptr_t private_2; >> -#if __SIZEOF_POINTER__ =3D=3D 4 >> - uint32_t reserved[3]; >> -#endif >> - } __attribute__((__aligned__)); >> + unsigned long private_1; >> + unsigned long private_2; >> + } ; >=20 > Shouldn't these definitions be the same as the ones in GCC? If you want to keep the ABI compatible with what it was, no. Otherwise, = you could consider it. But for what gain? -Dimitry --Apple-Mail=_A3542C0C-E7BF-4613-9BA6-36B2CE593D92 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCYE1VjwAKCRCwXqMKLiCW oxCsAKDfhglHmT2HK4yRHyDVK+2BULydnACfZDbJyxWu/MG/O2RUPa0VNoRBhKo= =jJXN -----END PGP SIGNATURE----- --Apple-Mail=_A3542C0C-E7BF-4613-9BA6-36B2CE593D92-- From owner-dev-commits-src-all@freebsd.org Sun Mar 14 01:09:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A980456BE26; Sun, 14 Mar 2021 01:09: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 4DyhKZ4MmHz4RMk; Sun, 14 Mar 2021 01:09: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 8915F14876; Sun, 14 Mar 2021 01:09: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 12E19cKc048997; Sun, 14 Mar 2021 01:09:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E19c4E048996; Sun, 14 Mar 2021 01:09:38 GMT (envelope-from git) Date: Sun, 14 Mar 2021 01:09:38 GMT Message-Id: <202103140109.12E19c4E048996@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: cec3990d3479 - stable/13 - vm_reserv: Fix list locking in vm_reserv_reclaim_contig() 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/stable/13 X-Git-Reftype: branch X-Git-Commit: cec3990d347972c30558b135b1bc9954184fb5fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 01:09:38 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cec3990d347972c30558b135b1bc9954184fb5fe commit cec3990d347972c30558b135b1bc9954184fb5fe Author: Mark Johnston AuthorDate: 2021-03-11 15:34:28 +0000 Commit: Mark Johnston CommitDate: 2021-03-14 01:09:29 +0000 vm_reserv: Fix list locking in vm_reserv_reclaim_contig() The per-domain partpop queue is locked by the combination of the per-domain lock and individual reservation mutexes. vm_reserv_reclaim_contig() scans the queue looking for partially populated reservations that can be reclaimed in order to satisfy the caller's allocation. During the scan, we drop the per-domain lock. At this point, the rvn pointer may be invalidated. Take care to load rvn after re-acquiring the per-domain lock. While here, simplify the condition used to check whether a reservation was dequeued while the per-domain lock was dropped. Reviewed by: alc, kib Reported by: gallatin Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29203 (cherry picked from commit 968079f253c11433d47bece4b41b46fcbf985903) --- sys/vm/vm_reserv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index e7f542a66fdb..a9602c3977df 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -1344,8 +1344,8 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, TAILQ_INSERT_AFTER(queue, rv, marker, partpopq); vm_reserv_domain_unlock(domain); vm_reserv_lock(rv); - if (!rv->inpartpopq || - TAILQ_NEXT(rv, partpopq) != marker) { + if (TAILQ_PREV(marker, vm_reserv_queue, partpopq) != + rv) { vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); rvn = TAILQ_NEXT(marker, partpopq); @@ -1363,8 +1363,9 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, vm_reserv_unlock(rv); return (true); } - vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); + rvn = TAILQ_NEXT(rv, partpopq); + vm_reserv_unlock(rv); } vm_reserv_domain_unlock(domain); vm_reserv_domain_scan_unlock(domain); From owner-dev-commits-src-all@freebsd.org Sun Mar 14 01:38:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E99056DB8D; Sun, 14 Mar 2021 01:38: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 4Dyhyt2lHfz4Tjg; Sun, 14 Mar 2021 01:38: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 50D41150E8; Sun, 14 Mar 2021 01:38: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 12E1cUqh088128; Sun, 14 Mar 2021 01:38:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E1cUAJ088126; Sun, 14 Mar 2021 01:38:30 GMT (envelope-from git) Date: Sun, 14 Mar 2021 01:38:30 GMT Message-Id: <202103140138.12E1cUAJ088126@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 9db44a8e5da9 - main - zfs: merge OpenZFS master-9305ff2ed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9db44a8e5da9bf1ce6dd1c0f1468ddafed6d6c91 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 01:38:30 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=9db44a8e5da9bf1ce6dd1c0f1468ddafed6d6c91 commit 9db44a8e5da9bf1ce6dd1c0f1468ddafed6d6c91 Merge: a9275d996c22 9162a1ce3ae9 Author: Martin Matuska AuthorDate: 2021-03-14 01:23:51 +0000 Commit: Martin Matuska CommitDate: 2021-03-14 01:32:14 +0000 zfs: merge OpenZFS master-9305ff2ed Notable upstream pull request merges: #11153 Scalable teardown lock for FreeBSD #11651 Don't bomb out when using keylocation=file:// #11667 zvol: call zil_replaying() during replay #11683 abd_get_offset_struct() may allocate new abd #11693 Intentionally allow ZFS_READONLY in zfs_write #11716 zpool import cachefile improvements #11720 FreeBSD: Clean up zfsdev_close to match Linux #11730 FreeBSD: bring back possibility to rewind the checkpoint from bootloader Obtained from: OpenZFS MFC after: 2 weeks .../openzfs/.github/workflows/checkstyle.yaml | 2 +- sys/contrib/openzfs/cmd/vdev_id/vdev_id | 9 +- sys/contrib/openzfs/cmd/zpool/zpool_main.c | 307 +++++++++++++-------- sys/contrib/openzfs/cmd/zstream/zstream_redup.c | 1 + sys/contrib/openzfs/config/zfs-build.m4 | 36 +++ sys/contrib/openzfs/configure.ac | 1 + .../openzfs/include/os/freebsd/spl/sys/Makefile.am | 3 + .../openzfs/include/os/freebsd/spl/sys/debug.h | 80 +++--- .../include/os/freebsd/zfs/sys/zfs_vfsops_os.h | 2 +- .../openzfs/include/os/linux/spl/sys/debug.h | 78 +++--- .../include/os/linux/zfs/sys/zfs_vfsops_os.h | 33 +++ .../include/os/linux/zfs/sys/zfs_znode_impl.h | 4 +- sys/contrib/openzfs/include/sys/dmu_redact.h | 2 + sys/contrib/openzfs/include/sys/zfs_ioctl.h | 1 - sys/contrib/openzfs/lib/libzfs/libzfs_crypto.c | 10 +- sys/contrib/openzfs/lib/libzfs/libzfs_mount.c | 25 +- .../openzfs/lib/libzfs/os/freebsd/libzfs_zmount.c | 5 +- .../openzfs/lib/libzfs/os/linux/libzfs_mount_os.c | 6 +- sys/contrib/openzfs/lib/libzutil/zutil_import.c | 177 +++++++++--- sys/contrib/openzfs/man/man8/zfs-receive.8 | 10 + sys/contrib/openzfs/man/man8/zfs-send.8 | 7 +- sys/contrib/openzfs/module/Makefile.in | 5 + .../openzfs/module/os/freebsd/zfs/kmod_core.c | 18 +- .../openzfs/module/os/freebsd/zfs/zfs_dir.c | 2 - .../openzfs/module/os/freebsd/zfs/zvol_os.c | 9 +- sys/contrib/openzfs/module/os/linux/zfs/zfs_acl.c | 26 +- .../openzfs/module/os/linux/zfs/zio_crypt.c | 1 + sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c | 102 +++++-- sys/contrib/openzfs/module/zcommon/zfs_prop.c | 2 +- sys/contrib/openzfs/module/zfs/abd.c | 6 +- sys/contrib/openzfs/module/zfs/spa_misc.c | 4 +- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 6 +- sys/contrib/openzfs/module/zfs/zvol.c | 15 +- sys/contrib/openzfs/tests/runfiles/common.run | 1 + .../openzfs/tests/zfs-tests/include/commands.cfg | 2 +- .../openzfs/tests/zfs-tests/include/libtest.shlib | 19 +- .../openzfs/tests/zfs-tests/include/tunables.cfg | 8 +- .../functional/cli_root/zpool/zpool_002_pos.ksh | 37 ++- .../functional/cli_root/zpool/zpool_003_pos.ksh | 39 ++- .../functional/cli_root/zpool_import/Makefile.am | 1 + .../import_cachefile_paths_changed.ksh | 117 ++++++++ .../tests/functional/events/events_002_pos.ksh | 7 +- .../tests/functional/xattr/xattr_003_neg.ksh | 44 +-- sys/modules/zfs/zfs_config.h | 4 +- 44 files changed, 896 insertions(+), 378 deletions(-) diff --cc sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c index 2389b1a06355,000000000000..ba315f104738 mode 100644,000000..100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c @@@ -1,1525 -1,0 +1,1532 @@@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * + * Copyright (c) 2006-2010 Pawel Jakub Dawidek + * All rights reserved. + * + * Portions Copyright 2010 Robert Milkowski + * + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012, 2017 by Delphix. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright (c) 2014 Integros [integros.com] + */ + +/* Portions Copyright 2011 Martin Matuska */ + +/* + * ZFS volume emulation driver. + * + * Makes a DMU object look like a volume of arbitrary size, up to 2^64 bytes. + * Volumes are accessed through the symbolic links named: + * + * /dev/zvol// + * + * Volumes are persistent through reboot. No user command needs to be + * run before opening and using a device. + * + * On FreeBSD ZVOLs are simply GEOM providers like any other storage device + * in the system. Except when they're simply character devices (volmode=dev). + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "zfs_namecheck.h" + +#define ZVOL_DUMPSIZE "dumpsize" + +#ifdef ZVOL_LOCK_DEBUG +#define ZVOL_RW_READER RW_WRITER +#define ZVOL_RW_READ_HELD RW_WRITE_HELD +#else +#define ZVOL_RW_READER RW_READER +#define ZVOL_RW_READ_HELD RW_READ_HELD +#endif + +enum zvol_geom_state { + ZVOL_GEOM_UNINIT, + ZVOL_GEOM_STOPPED, + ZVOL_GEOM_RUNNING, +}; + +struct zvol_state_os { +#define zso_dev _zso_state._zso_dev +#define zso_geom _zso_state._zso_geom + union { + /* volmode=dev */ + struct zvol_state_dev { + struct cdev *zsd_cdev; + uint64_t zsd_sync_cnt; + } _zso_dev; + + /* volmode=geom */ + struct zvol_state_geom { + struct g_provider *zsg_provider; + struct bio_queue_head zsg_queue; + struct mtx zsg_queue_mtx; + enum zvol_geom_state zsg_state; + } _zso_geom; + } _zso_state; + int zso_dying; +}; + +static uint32_t zvol_minors; + +SYSCTL_DECL(_vfs_zfs); +SYSCTL_NODE(_vfs_zfs, OID_AUTO, vol, CTLFLAG_RW, 0, "ZFS VOLUME"); +SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, mode, CTLFLAG_RWTUN, &zvol_volmode, 0, + "Expose as GEOM providers (1), device files (2) or neither"); +static boolean_t zpool_on_zvol = B_FALSE; +SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, recursive, CTLFLAG_RWTUN, &zpool_on_zvol, 0, + "Allow zpools to use zvols as vdevs (DANGEROUS)"); + +/* + * Toggle unmap functionality. + */ +boolean_t zvol_unmap_enabled = B_TRUE; + +SYSCTL_INT(_vfs_zfs_vol, OID_AUTO, unmap_enabled, CTLFLAG_RWTUN, + &zvol_unmap_enabled, 0, "Enable UNMAP functionality"); + +/* + * zvol maximum transfer in one DMU tx. + */ +int zvol_maxphys = DMU_MAX_ACCESS / 2; + +static void zvol_ensure_zilog(zvol_state_t *zv); + +static d_open_t zvol_cdev_open; +static d_close_t zvol_cdev_close; +static d_ioctl_t zvol_cdev_ioctl; +static d_read_t zvol_cdev_read; +static d_write_t zvol_cdev_write; +static d_strategy_t zvol_geom_bio_strategy; + +static struct cdevsw zvol_cdevsw = { + .d_name = "zvol", + .d_version = D_VERSION, + .d_flags = D_DISK | D_TRACKCLOSE, + .d_open = zvol_cdev_open, + .d_close = zvol_cdev_close, + .d_ioctl = zvol_cdev_ioctl, + .d_read = zvol_cdev_read, + .d_write = zvol_cdev_write, + .d_strategy = zvol_geom_bio_strategy, +}; + +extern uint_t zfs_geom_probe_vdev_key; + +struct g_class zfs_zvol_class = { + .name = "ZFS::ZVOL", + .version = G_VERSION, +}; + +DECLARE_GEOM_CLASS(zfs_zvol_class, zfs_zvol); + +static int zvol_geom_open(struct g_provider *pp, int flag, int count); +static int zvol_geom_close(struct g_provider *pp, int flag, int count); +static void zvol_geom_run(zvol_state_t *zv); +static void zvol_geom_destroy(zvol_state_t *zv); +static int zvol_geom_access(struct g_provider *pp, int acr, int acw, int ace); +static void zvol_geom_worker(void *arg); +static void zvol_geom_bio_start(struct bio *bp); +static int zvol_geom_bio_getattr(struct bio *bp); +/* static d_strategy_t zvol_geom_bio_strategy; (declared elsewhere) */ + +/* + * GEOM mode implementation + */ + +/*ARGSUSED*/ +static int +zvol_geom_open(struct g_provider *pp, int flag, int count) +{ + zvol_state_t *zv; + int err = 0; + boolean_t drop_suspend = B_FALSE; + boolean_t drop_namespace = B_FALSE; + + if (!zpool_on_zvol && tsd_get(zfs_geom_probe_vdev_key) != NULL) { + /* + * if zfs_geom_probe_vdev_key is set, that means that zfs is + * attempting to probe geom providers while looking for a + * replacement for a missing VDEV. In this case, the + * spa_namespace_lock will not be held, but it is still illegal + * to use a zvol as a vdev. Deadlocks can result if another + * thread has spa_namespace_lock + */ + return (SET_ERROR(EOPNOTSUPP)); + } + +retry: + rw_enter(&zvol_state_lock, ZVOL_RW_READER); + zv = pp->private; + if (zv == NULL) { + rw_exit(&zvol_state_lock); + err = SET_ERROR(ENXIO); + goto out_locked; + } + + if (zv->zv_open_count == 0 && !mutex_owned(&spa_namespace_lock)) { + /* + * We need to guarantee that the namespace lock is held + * to avoid spurious failures in zvol_first_open. + */ + drop_namespace = B_TRUE; + if (!mutex_tryenter(&spa_namespace_lock)) { + rw_exit(&zvol_state_lock); + mutex_enter(&spa_namespace_lock); + goto retry; + } + } + mutex_enter(&zv->zv_state_lock); + if (zv->zv_zso->zso_dying) { + rw_exit(&zvol_state_lock); + err = SET_ERROR(ENXIO); + goto out_zv_locked; + } + ASSERT3S(zv->zv_volmode, ==, ZFS_VOLMODE_GEOM); + + /* + * make sure zvol is not suspended during first open + * (hold zv_suspend_lock) and respect proper lock acquisition + * ordering - zv_suspend_lock before zv_state_lock + */ + if (zv->zv_open_count == 0) { + drop_suspend = B_TRUE; + if (!rw_tryenter(&zv->zv_suspend_lock, ZVOL_RW_READER)) { + mutex_exit(&zv->zv_state_lock); + rw_enter(&zv->zv_suspend_lock, ZVOL_RW_READER); + mutex_enter(&zv->zv_state_lock); + /* check to see if zv_suspend_lock is needed */ + if (zv->zv_open_count != 0) { + rw_exit(&zv->zv_suspend_lock); + drop_suspend = B_FALSE; + } + } + } + rw_exit(&zvol_state_lock); + + ASSERT(MUTEX_HELD(&zv->zv_state_lock)); + + if (zv->zv_open_count == 0) { + ASSERT(ZVOL_RW_READ_HELD(&zv->zv_suspend_lock)); + err = zvol_first_open(zv, !(flag & FWRITE)); + if (err) + goto out_zv_locked; + pp->mediasize = zv->zv_volsize; + pp->stripeoffset = 0; + pp->stripesize = zv->zv_volblocksize; + } + + /* + * Check for a bad on-disk format version now since we + * lied about owning the dataset readonly before. + */ + if ((flag & FWRITE) && ((zv->zv_flags & ZVOL_RDONLY) || + dmu_objset_incompatible_encryption_version(zv->zv_objset))) { + err = SET_ERROR(EROFS); + goto out_opened; + } + if (zv->zv_flags & ZVOL_EXCL) { + err = SET_ERROR(EBUSY); + goto out_opened; + } +#ifdef FEXCL + if (flag & FEXCL) { + if (zv->zv_open_count != 0) { + err = SET_ERROR(EBUSY); + goto out_opened; + } + zv->zv_flags |= ZVOL_EXCL; + } +#endif + + zv->zv_open_count += count; +out_opened: + if (zv->zv_open_count == 0) { + zvol_last_close(zv); + wakeup(zv); + } +out_zv_locked: + mutex_exit(&zv->zv_state_lock); +out_locked: + if (drop_namespace) + mutex_exit(&spa_namespace_lock); + if (drop_suspend) + rw_exit(&zv->zv_suspend_lock); + return (err); +} + +/*ARGSUSED*/ +static int +zvol_geom_close(struct g_provider *pp, int flag, int count) +{ + zvol_state_t *zv; + boolean_t drop_suspend = B_TRUE; + int new_open_count; + + rw_enter(&zvol_state_lock, ZVOL_RW_READER); + zv = pp->private; + if (zv == NULL) { + rw_exit(&zvol_state_lock); + return (SET_ERROR(ENXIO)); + } + + mutex_enter(&zv->zv_state_lock); + if (zv->zv_flags & ZVOL_EXCL) { + ASSERT3U(zv->zv_open_count, ==, 1); + zv->zv_flags &= ~ZVOL_EXCL; + } + + ASSERT3S(zv->zv_volmode, ==, ZFS_VOLMODE_GEOM); + + /* + * If the open count is zero, this is a spurious close. + * That indicates a bug in the kernel / DDI framework. + */ + ASSERT3U(zv->zv_open_count, >, 0); + + /* + * make sure zvol is not suspended during last close + * (hold zv_suspend_lock) and respect proper lock acquisition + * ordering - zv_suspend_lock before zv_state_lock + */ + new_open_count = zv->zv_open_count - count; + if (new_open_count == 0) { + if (!rw_tryenter(&zv->zv_suspend_lock, ZVOL_RW_READER)) { + mutex_exit(&zv->zv_state_lock); + rw_enter(&zv->zv_suspend_lock, ZVOL_RW_READER); + mutex_enter(&zv->zv_state_lock); + /* check to see if zv_suspend_lock is needed */ + new_open_count = zv->zv_open_count - count; + if (new_open_count != 0) { + rw_exit(&zv->zv_suspend_lock); + drop_suspend = B_FALSE; + } + } + } else { + drop_suspend = B_FALSE; + } + rw_exit(&zvol_state_lock); + + ASSERT(MUTEX_HELD(&zv->zv_state_lock)); + + /* + * You may get multiple opens, but only one close. + */ + zv->zv_open_count = new_open_count; + if (zv->zv_open_count == 0) { + ASSERT(ZVOL_RW_READ_HELD(&zv->zv_suspend_lock)); + zvol_last_close(zv); + wakeup(zv); + } + + mutex_exit(&zv->zv_state_lock); + + if (drop_suspend) + rw_exit(&zv->zv_suspend_lock); + return (0); +} + +static void +zvol_geom_run(zvol_state_t *zv) +{ + struct zvol_state_geom *zsg = &zv->zv_zso->zso_geom; + struct g_provider *pp = zsg->zsg_provider; + + ASSERT3S(zv->zv_volmode, ==, ZFS_VOLMODE_GEOM); + + g_error_provider(pp, 0); + + kproc_kthread_add(zvol_geom_worker, zv, &system_proc, NULL, 0, 0, + "zfskern", "zvol %s", pp->name + sizeof (ZVOL_DRIVER)); +} + +static void +zvol_geom_destroy(zvol_state_t *zv) +{ + struct zvol_state_geom *zsg = &zv->zv_zso->zso_geom; + struct g_provider *pp = zsg->zsg_provider; + + ASSERT3S(zv->zv_volmode, ==, ZFS_VOLMODE_GEOM); + + g_topology_assert(); + + mutex_enter(&zv->zv_state_lock); + VERIFY(zsg->zsg_state == ZVOL_GEOM_RUNNING); + mutex_exit(&zv->zv_state_lock); + zsg->zsg_provider = NULL; + g_wither_geom(pp->geom, ENXIO); +} + +void +zvol_wait_close(zvol_state_t *zv) +{ + + if (zv->zv_volmode != ZFS_VOLMODE_GEOM) + return; + mutex_enter(&zv->zv_state_lock); + zv->zv_zso->zso_dying = B_TRUE; + + if (zv->zv_open_count) + msleep(zv, &zv->zv_state_lock, + PRIBIO, "zvol:dying", 10*hz); + mutex_exit(&zv->zv_state_lock); +} + + +static int +zvol_geom_access(struct g_provider *pp, int acr, int acw, int ace) +{ + int count, error, flags; + + g_topology_assert(); + + /* + * To make it easier we expect either open or close, but not both + * at the same time. + */ + KASSERT((acr >= 0 && acw >= 0 && ace >= 0) || + (acr <= 0 && acw <= 0 && ace <= 0), + ("Unsupported access request to %s (acr=%d, acw=%d, ace=%d).", + pp->name, acr, acw, ace)); + + if (pp->private == NULL) { + if (acr <= 0 && acw <= 0 && ace <= 0) + return (0); + return (pp->error); + } + + /* + * We don't pass FEXCL flag to zvol_geom_open()/zvol_geom_close() if + * ace != 0, because GEOM already handles that and handles it a bit + * differently. GEOM allows for multiple read/exclusive consumers and + * ZFS allows only one exclusive consumer, no matter if it is reader or + * writer. I like better the way GEOM works so I'll leave it for GEOM + * to decide what to do. + */ + + count = acr + acw + ace; + if (count == 0) + return (0); + + flags = 0; + if (acr != 0 || ace != 0) + flags |= FREAD; + if (acw != 0) + flags |= FWRITE; + + g_topology_unlock(); + if (count > 0) + error = zvol_geom_open(pp, flags, count); + else + error = zvol_geom_close(pp, flags, -count); + g_topology_lock(); + return (error); +} + +static void +zvol_geom_worker(void *arg) +{ + zvol_state_t *zv = arg; + struct zvol_state_geom *zsg = &zv->zv_zso->zso_geom; + struct bio *bp; + + ASSERT3S(zv->zv_volmode, ==, ZFS_VOLMODE_GEOM); + + thread_lock(curthread); + sched_prio(curthread, PRIBIO); + thread_unlock(curthread); + + for (;;) { + mtx_lock(&zsg->zsg_queue_mtx); + bp = bioq_takefirst(&zsg->zsg_queue); + if (bp == NULL) { + if (zsg->zsg_state == ZVOL_GEOM_STOPPED) { + zsg->zsg_state = ZVOL_GEOM_RUNNING; + wakeup(&zsg->zsg_state); + mtx_unlock(&zsg->zsg_queue_mtx); + kthread_exit(); + } + msleep(&zsg->zsg_queue, &zsg->zsg_queue_mtx, + PRIBIO | PDROP, "zvol:io", 0); + continue; + } + mtx_unlock(&zsg->zsg_queue_mtx); + zvol_geom_bio_strategy(bp); + } +} + +static void +zvol_geom_bio_start(struct bio *bp) +{ + zvol_state_t *zv = bp->bio_to->private; + struct zvol_state_geom *zsg; + boolean_t first; + + if (zv == NULL) { + g_io_deliver(bp, ENXIO); + return; + } + if (bp->bio_cmd == BIO_GETATTR) { + if (zvol_geom_bio_getattr(bp)) + g_io_deliver(bp, EOPNOTSUPP); + return; + } + + if (!THREAD_CAN_SLEEP()) { + zsg = &zv->zv_zso->zso_geom; + mtx_lock(&zsg->zsg_queue_mtx); + first = (bioq_first(&zsg->zsg_queue) == NULL); + bioq_insert_tail(&zsg->zsg_queue, bp); + mtx_unlock(&zsg->zsg_queue_mtx); + if (first) + wakeup_one(&zsg->zsg_queue); + return; + } + + zvol_geom_bio_strategy(bp); +} + +static int +zvol_geom_bio_getattr(struct bio *bp) +{ + zvol_state_t *zv; + + zv = bp->bio_to->private; + ASSERT3P(zv, !=, NULL); + + spa_t *spa = dmu_objset_spa(zv->zv_objset); + uint64_t refd, avail, usedobjs, availobjs; + + if (g_handleattr_int(bp, "GEOM::candelete", 1)) + return (0); + if (strcmp(bp->bio_attribute, "blocksavail") == 0) { + dmu_objset_space(zv->zv_objset, &refd, &avail, + &usedobjs, &availobjs); + if (g_handleattr_off_t(bp, "blocksavail", avail / DEV_BSIZE)) + return (0); + } else if (strcmp(bp->bio_attribute, "blocksused") == 0) { + dmu_objset_space(zv->zv_objset, &refd, &avail, + &usedobjs, &availobjs); + if (g_handleattr_off_t(bp, "blocksused", refd / DEV_BSIZE)) + return (0); + } else if (strcmp(bp->bio_attribute, "poolblocksavail") == 0) { + avail = metaslab_class_get_space(spa_normal_class(spa)); + avail -= metaslab_class_get_alloc(spa_normal_class(spa)); + if (g_handleattr_off_t(bp, "poolblocksavail", + avail / DEV_BSIZE)) + return (0); + } else if (strcmp(bp->bio_attribute, "poolblocksused") == 0) { + refd = metaslab_class_get_alloc(spa_normal_class(spa)); + if (g_handleattr_off_t(bp, "poolblocksused", refd / DEV_BSIZE)) + return (0); + } + return (1); +} + +static void +zvol_geom_bio_strategy(struct bio *bp) +{ + zvol_state_t *zv; + uint64_t off, volsize; + size_t resid; + char *addr; + objset_t *os; + zfs_locked_range_t *lr; + int error = 0; + boolean_t doread = B_FALSE; + boolean_t is_dumpified; + boolean_t sync; + + if (bp->bio_to) + zv = bp->bio_to->private; + else + zv = bp->bio_dev->si_drv2; + + if (zv == NULL) { + error = SET_ERROR(ENXIO); + goto out; + } + + rw_enter(&zv->zv_suspend_lock, ZVOL_RW_READER); + + switch (bp->bio_cmd) { + case BIO_READ: + doread = B_TRUE; + break; + case BIO_WRITE: + case BIO_FLUSH: + case BIO_DELETE: + if (zv->zv_flags & ZVOL_RDONLY) { + error = SET_ERROR(EROFS); + goto resume; + } + zvol_ensure_zilog(zv); + if (bp->bio_cmd == BIO_FLUSH) + goto sync; + break; + default: + error = SET_ERROR(EOPNOTSUPP); + goto resume; + } + + off = bp->bio_offset; + volsize = zv->zv_volsize; + + os = zv->zv_objset; + ASSERT3P(os, !=, NULL); + + addr = bp->bio_data; + resid = bp->bio_length; + + if (resid > 0 && off >= volsize) { + error = SET_ERROR(EIO); + goto resume; + } + + is_dumpified = B_FALSE; + sync = !doread && !is_dumpified && + zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS; + + /* + * There must be no buffer changes when doing a dmu_sync() because + * we can't change the data whilst calculating the checksum. + */ + lr = zfs_rangelock_enter(&zv->zv_rangelock, off, resid, + doread ? RL_READER : RL_WRITER); + + if (bp->bio_cmd == BIO_DELETE) { + dmu_tx_t *tx = dmu_tx_create(zv->zv_objset); + error = dmu_tx_assign(tx, TXG_WAIT); + if (error != 0) { + dmu_tx_abort(tx); + } else { + zvol_log_truncate(zv, tx, off, resid, sync); + dmu_tx_commit(tx); + error = dmu_free_long_range(zv->zv_objset, ZVOL_OBJ, + off, resid); + resid = 0; + } + goto unlock; + } + while (resid != 0 && off < volsize) { + size_t size = MIN(resid, zvol_maxphys); + if (doread) { + error = dmu_read(os, ZVOL_OBJ, off, size, addr, + DMU_READ_PREFETCH); + } else { + dmu_tx_t *tx = dmu_tx_create(os); + dmu_tx_hold_write_by_dnode(tx, zv->zv_dn, off, size); + error = dmu_tx_assign(tx, TXG_WAIT); + if (error) { + dmu_tx_abort(tx); + } else { + dmu_write(os, ZVOL_OBJ, off, size, addr, tx); + zvol_log_write(zv, tx, off, size, sync); + dmu_tx_commit(tx); + } + } + if (error) { + /* convert checksum errors into IO errors */ + if (error == ECKSUM) + error = SET_ERROR(EIO); + break; + } + off += size; + addr += size; + resid -= size; + } +unlock: + zfs_rangelock_exit(lr); + + bp->bio_completed = bp->bio_length - resid; + if (bp->bio_completed < bp->bio_length && off > volsize) + error = SET_ERROR(EINVAL); + + switch (bp->bio_cmd) { + case BIO_FLUSH: + break; + case BIO_READ: + dataset_kstats_update_read_kstats(&zv->zv_kstat, + bp->bio_completed); + break; + case BIO_WRITE: + dataset_kstats_update_write_kstats(&zv->zv_kstat, + bp->bio_completed); + break; + case BIO_DELETE: + break; + default: + break; + } + + if (sync) { +sync: + zil_commit(zv->zv_zilog, ZVOL_OBJ); + } +resume: + rw_exit(&zv->zv_suspend_lock); +out: + if (bp->bio_to) + g_io_deliver(bp, error); + else + biofinish(bp, NULL, error); +} + +/* + * Character device mode implementation + */ + +static int +zvol_cdev_read(struct cdev *dev, struct uio *uio_s, int ioflag) +{ + zvol_state_t *zv; + uint64_t volsize; + zfs_locked_range_t *lr; + int error = 0; + zfs_uio_t uio; + + zfs_uio_init(&uio, uio_s); + + zv = dev->si_drv2; + + volsize = zv->zv_volsize; + /* + * uio_loffset == volsize isn't an error as + * its required for EOF processing. + */ + if (zfs_uio_resid(&uio) > 0 && + (zfs_uio_offset(&uio) < 0 || zfs_uio_offset(&uio) > volsize)) + return (SET_ERROR(EIO)); + + lr = zfs_rangelock_enter(&zv->zv_rangelock, zfs_uio_offset(&uio), + zfs_uio_resid(&uio), RL_READER); + while (zfs_uio_resid(&uio) > 0 && zfs_uio_offset(&uio) < volsize) { + uint64_t bytes = MIN(zfs_uio_resid(&uio), DMU_MAX_ACCESS >> 1); + + /* don't read past the end */ + if (bytes > volsize - zfs_uio_offset(&uio)) + bytes = volsize - zfs_uio_offset(&uio); + + error = dmu_read_uio_dnode(zv->zv_dn, &uio, bytes); + if (error) { + /* convert checksum errors into IO errors */ + if (error == ECKSUM) + error = SET_ERROR(EIO); + break; + } + } + zfs_rangelock_exit(lr); + + return (error); +} + +static int +zvol_cdev_write(struct cdev *dev, struct uio *uio_s, int ioflag) +{ + zvol_state_t *zv; + uint64_t volsize; + zfs_locked_range_t *lr; + int error = 0; + boolean_t sync; + zfs_uio_t uio; + + zv = dev->si_drv2; + + volsize = zv->zv_volsize; + + zfs_uio_init(&uio, uio_s); + + if (zfs_uio_resid(&uio) > 0 && + (zfs_uio_offset(&uio) < 0 || zfs_uio_offset(&uio) > volsize)) + return (SET_ERROR(EIO)); + + sync = (ioflag & IO_SYNC) || + (zv->zv_objset->os_sync == ZFS_SYNC_ALWAYS); + + rw_enter(&zv->zv_suspend_lock, ZVOL_RW_READER); + zvol_ensure_zilog(zv); + + lr = zfs_rangelock_enter(&zv->zv_rangelock, zfs_uio_offset(&uio), + zfs_uio_resid(&uio), RL_WRITER); + while (zfs_uio_resid(&uio) > 0 && zfs_uio_offset(&uio) < volsize) { + uint64_t bytes = MIN(zfs_uio_resid(&uio), DMU_MAX_ACCESS >> 1); + uint64_t off = zfs_uio_offset(&uio); + dmu_tx_t *tx = dmu_tx_create(zv->zv_objset); + + if (bytes > volsize - off) /* don't write past the end */ + bytes = volsize - off; + + dmu_tx_hold_write_by_dnode(tx, zv->zv_dn, off, bytes); + error = dmu_tx_assign(tx, TXG_WAIT); + if (error) { + dmu_tx_abort(tx); + break; + } + error = dmu_write_uio_dnode(zv->zv_dn, &uio, bytes, tx); + if (error == 0) + zvol_log_write(zv, tx, off, bytes, sync); + dmu_tx_commit(tx); + + if (error) + break; + } + zfs_rangelock_exit(lr); + if (sync) + zil_commit(zv->zv_zilog, ZVOL_OBJ); + rw_exit(&zv->zv_suspend_lock); + return (error); +} + +static int +zvol_cdev_open(struct cdev *dev, int flags, int fmt, struct thread *td) +{ + zvol_state_t *zv; + struct zvol_state_dev *zsd; + int err = 0; + boolean_t drop_suspend = B_FALSE; + boolean_t drop_namespace = B_FALSE; + +retry: + rw_enter(&zvol_state_lock, ZVOL_RW_READER); + zv = dev->si_drv2; + if (zv == NULL) { + rw_exit(&zvol_state_lock); + err = SET_ERROR(ENXIO); + goto out_locked; + } + + if (zv->zv_open_count == 0 && !mutex_owned(&spa_namespace_lock)) { + /* + * We need to guarantee that the namespace lock is held + * to avoid spurious failures in zvol_first_open. + */ + drop_namespace = B_TRUE; + if (!mutex_tryenter(&spa_namespace_lock)) { + rw_exit(&zvol_state_lock); + mutex_enter(&spa_namespace_lock); + goto retry; + } + } + mutex_enter(&zv->zv_state_lock); + + ASSERT3S(zv->zv_volmode, ==, ZFS_VOLMODE_DEV); + + /* + * make sure zvol is not suspended during first open + * (hold zv_suspend_lock) and respect proper lock acquisition + * ordering - zv_suspend_lock before zv_state_lock + */ + if (zv->zv_open_count == 0) { + drop_suspend = B_TRUE; + if (!rw_tryenter(&zv->zv_suspend_lock, ZVOL_RW_READER)) { + mutex_exit(&zv->zv_state_lock); + rw_enter(&zv->zv_suspend_lock, ZVOL_RW_READER); + mutex_enter(&zv->zv_state_lock); + /* check to see if zv_suspend_lock is needed */ + if (zv->zv_open_count != 0) { + rw_exit(&zv->zv_suspend_lock); + drop_suspend = B_FALSE; + } + } + } + rw_exit(&zvol_state_lock); + + ASSERT(MUTEX_HELD(&zv->zv_state_lock)); + + if (zv->zv_open_count == 0) { + ASSERT(ZVOL_RW_READ_HELD(&zv->zv_suspend_lock)); + err = zvol_first_open(zv, !(flags & FWRITE)); + if (err) *** 1412 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85A4E5786F9; Sun, 14 Mar 2021 09:09: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 4DytzV2XFyz3FhP; Sun, 14 Mar 2021 09:09: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 45C031AC65; Sun, 14 Mar 2021 09:09: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 12E99guG078252; Sun, 14 Mar 2021 09:09:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99gcm078251; Sun, 14 Mar 2021 09:09:42 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:42 GMT Message-Id: <202103140909.12E99gcm078251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 0fed2239730f - stable/13 - libifconfig: Set error in ifconfig_get_groups MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0fed2239730f3bfa7ea71b6468565b8266019526 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:42 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=0fed2239730f3bfa7ea71b6468565b8266019526 commit 0fed2239730f3bfa7ea71b6468565b8266019526 Author: Ryan Moeller AuthorDate: 2021-02-27 08:07:21 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:05:01 +0000 libifconfig: Set error in ifconfig_get_groups This should return -1 with OTHER/ENOMEM set in the handle when malloc fails, like everywhere else in libifconfig. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D28964 (cherry picked from commit 1d9ba697f99a88b321a7d8b96fa142ea774cd3be) --- lib/libifconfig/libifconfig.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libifconfig/libifconfig.c b/lib/libifconfig/libifconfig.c index e67c4e4de04e..1733239132a0 100644 --- a/lib/libifconfig/libifconfig.c +++ b/lib/libifconfig/libifconfig.c @@ -511,7 +511,9 @@ ifconfig_get_groups(ifconfig_handle_t *h, const char *name, len = ifgr->ifgr_len; ifgr->ifgr_groups = (struct ifg_req *)malloc(len); if (ifgr->ifgr_groups == NULL) { - return (1); + h->error.errtype = OTHER; + h->error.errcode = ENOMEM; + return (-1); } bzero(ifgr->ifgr_groups, len); if (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFGROUP, ifgr) == -1) { From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CB2D578A91; Sun, 14 Mar 2021 09:09: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 4DytzX3pcNz3Fy3; Sun, 14 Mar 2021 09:09: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 732241AAF2; Sun, 14 Mar 2021 09:09: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 12E99i4R078293; Sun, 14 Mar 2021 09:09:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99iVk078292; Sun, 14 Mar 2021 09:09:44 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:44 GMT Message-Id: <202103140909.12E99iVk078292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: d63acd26f92b - stable/13 - libifconfig: Fix typo in symbol map MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d63acd26f92bdd6bb0f0ee481881c054d98de357 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:44 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=d63acd26f92bdd6bb0f0ee481881c054d98de357 commit d63acd26f92bdd6bb0f0ee481881c054d98de357 Author: Ryan Moeller AuthorDate: 2021-03-03 01:55:18 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:06:30 +0000 libifconfig: Fix typo in symbol map (cherry picked from commit 80545a16df95263781b3422695527b6238f4bd2c) --- lib/libifconfig/Symbol.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index fd147554f085..ec1ccec7f95c 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -10,7 +10,7 @@ FBSD_1.6 { ifconfig_err_errtype; ifconfig_err_ioctlreq; ifconfig_foreach_ifaddr; - ifconfig_foreach_interface; + ifconfig_foreach_iface; ifconfig_get_capability; ifconfig_get_description; ifconfig_get_fib; From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 718195789A1; Sun, 14 Mar 2021 09:09: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 4DytzW2fMdz3Fxw; Sun, 14 Mar 2021 09:09: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 4DBA91B009; Sun, 14 Mar 2021 09:09: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 12E99hK1078274; Sun, 14 Mar 2021 09:09:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99hBE078273; Sun, 14 Mar 2021 09:09:43 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:43 GMT Message-Id: <202103140909.12E99hBE078273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: dc4fae442b86 - stable/13 - sbin/ifconfig: Drop local name var in sfp_status MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dc4fae442b86cb1c2ffc4732e22392e1832197f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:43 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=dc4fae442b86cb1c2ffc4732e22392e1832197f4 commit dc4fae442b86cb1c2ffc4732e22392e1832197f4 Author: Ryan Moeller AuthorDate: 2021-02-28 02:15:11 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:05:42 +0000 sbin/ifconfig: Drop local name var in sfp_status There is already a globally defined name variable. (cherry picked from commit 9995455218ff19df9cf0dcaf0198269dc76eeb2d) --- sbin/ifconfig/sfp.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sbin/ifconfig/sfp.c b/sbin/ifconfig/sfp.c index b7bdc74d42e8..15ff22639060 100644 --- a/sbin/ifconfig/sfp.c +++ b/sbin/ifconfig/sfp.c @@ -62,15 +62,12 @@ sfp_status(int s, struct ifreq *ifr, int verbose) struct ifconfig_sfp_vendor_info vendor_info; struct ifconfig_sfp_status status; ifconfig_handle_t *lifh; - const char *name; size_t channel_count; lifh = ifconfig_open(); if (lifh == NULL) return; - name = ifr->ifr_name; - if (ifconfig_sfp_get_sfp_info(lifh, name, &info) == -1) goto close; From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F8CA578664; Sun, 14 Mar 2021 09:09: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 4DytzZ49FMz3FnS; Sun, 14 Mar 2021 09:09: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 B6F561AAF3; Sun, 14 Mar 2021 09:09: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 12E99jeO078315; Sun, 14 Mar 2021 09:09:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99jFd078314; Sun, 14 Mar 2021 09:09:45 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:45 GMT Message-Id: <202103140909.12E99jFd078314@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: caab2f4c89ba - stable/13 - sbin/ifconfig: Minor housekeeping MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: caab2f4c89bae2c44dc056d82e445cc71c183406 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:47 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=caab2f4c89bae2c44dc056d82e445cc71c183406 commit caab2f4c89bae2c44dc056d82e445cc71c183406 Author: Ryan Moeller AuthorDate: 2021-02-28 02:08:43 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:07:06 +0000 sbin/ifconfig: Minor housekeeping Coalesce adjacent lint ifdefs. Fix spelling of nitems. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D29022 (cherry picked from commit 88832d59dec10e97dd64b44391606776b20e782b) --- sbin/ifconfig/ifconfig.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 451532246d40..c99602dd0d84 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -33,9 +33,6 @@ static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint #if 0 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #endif @@ -211,8 +208,6 @@ ioctl_ifcreate(int s, struct ifreq *ifr) } } -#define ORDERS_SIZE(x) sizeof(x) / sizeof(x[0]) - static int calcorders(struct ifaddrs *ifa, struct ifa_queue *q) { @@ -242,7 +237,7 @@ calcorders(struct ifaddrs *ifa, struct ifa_queue *q) if (ifa->ifa_addr) { af = ifa->ifa_addr->sa_family; - if (af < ORDERS_SIZE(cur->af_orders) && + if (af < nitems(cur->af_orders) && cur->af_orders[af] == 0) cur->af_orders[af] = ++ord; } @@ -293,8 +288,7 @@ cmpifaddrs(struct ifaddrs *a, struct ifaddrs *b, struct ifa_queue *q) af1 = a->ifa_addr->sa_family; af2 = b->ifa_addr->sa_family; - if (af1 < ORDERS_SIZE(e1->af_orders) && - af2 < ORDERS_SIZE(e1->af_orders)) + if (af1 < nitems(e1->af_orders) && af2 < nitems(e1->af_orders)) return (e1->af_orders[af1] - e1->af_orders[af2]); } @@ -343,8 +337,6 @@ static void setformat(char *input) free(formatstr); } -#undef ORDERS_SIZE - static struct ifaddrs * sortifaddrs(struct ifaddrs *list, int (*compare)(struct ifaddrs *, struct ifaddrs *, struct ifa_queue *), From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7C375789A8; Sun, 14 Mar 2021 09:09: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 4Dytzb4HBqz3Fsk; Sun, 14 Mar 2021 09:09: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 C29BD1AF1C; Sun, 14 Mar 2021 09:09: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 12E99kR4078335; Sun, 14 Mar 2021 09:09:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99k6g078334; Sun, 14 Mar 2021 09:09:46 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:46 GMT Message-Id: <202103140909.12E99k6g078334@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: f42188552c77 - stable/13 - sbin/ifconfig: Get carp status with libifconfig MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f42188552c7784b6a0e14d591d0e3951164b5326 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:49 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=f42188552c7784b6a0e14d591d0e3951164b5326 commit f42188552c7784b6a0e14d591d0e3951164b5326 Author: Ryan Moeller AuthorDate: 2021-02-26 23:40:58 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:07:35 +0000 sbin/ifconfig: Get carp status with libifconfig A trivial change now that ifconfig is already using libifconfig. Reviewed by: kp (earlier version) Differential Revision: https://reviews.freebsd.org/D28955 (cherry picked from commit da393346ac47b22b5f8af4040a59971faadd2c5c) --- sbin/ifconfig/carp.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c index dcf966d873ee..d6f8d78ba920 100644 --- a/sbin/ifconfig/carp.c +++ b/sbin/ifconfig/carp.c @@ -50,6 +50,8 @@ #include #include +#include + #include "ifconfig.h" static const char *carp_states[] = { CARP_STATES }; @@ -71,16 +73,16 @@ static void carp_status(int s) { struct carpreq carpr[CARP_MAXVHID]; - int i; + ifconfig_handle_t *lifh; - bzero(carpr, sizeof(struct carpreq) * CARP_MAXVHID); - carpr[0].carpr_count = CARP_MAXVHID; - ifr.ifr_data = (caddr_t)&carpr; - - if (ioctl(s, SIOCGVH, (caddr_t)&ifr) == -1) + lifh = ifconfig_open(); + if (lifh == NULL) return; - for (i = 0; i < carpr[0].carpr_count; i++) { + if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1) + goto close; + + for (size_t i = 0; i < carpr[0].carpr_count; i++) { printf("\tcarp: %s vhid %d advbase %d advskew %d", carp_states[carpr[i].carpr_state], carpr[i].carpr_vhid, carpr[i].carpr_advbase, carpr[i].carpr_advskew); @@ -89,6 +91,8 @@ carp_status(int s) else printf("\n"); } +close: + ifconfig_close(lifh); } static void From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 475A7578A97; Sun, 14 Mar 2021 09:09: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 4Dytzc4vPqz3FYM; Sun, 14 Mar 2021 09:09: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 E83C51AAF4; Sun, 14 Mar 2021 09:09: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 12E99leb078355; Sun, 14 Mar 2021 09:09:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99lnS078354; Sun, 14 Mar 2021 09:09:47 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:47 GMT Message-Id: <202103140909.12E99lnS078354@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 8eb38ceffef8 - stable/13 - sbin/ifconfig: Get groups with libifconfig MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8eb38ceffef8ee54f65fb914b941742f718e85ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:49 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=8eb38ceffef8ee54f65fb914b941742f718e85ab commit 8eb38ceffef8ee54f65fb914b941742f718e85ab Author: Ryan Moeller AuthorDate: 2021-02-27 08:17:04 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:07:55 +0000 sbin/ifconfig: Get groups with libifconfig Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D28965 (cherry picked from commit 64bacab177f7c743af3268a3e1ffcddaf77a68d0) --- sbin/ifconfig/ifgroup.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/sbin/ifconfig/ifgroup.c b/sbin/ifconfig/ifgroup.c index 50d17ca6429e..2b13227af4f3 100644 --- a/sbin/ifconfig/ifgroup.c +++ b/sbin/ifconfig/ifgroup.c @@ -43,6 +43,8 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" /* ARGSUSED */ @@ -84,33 +86,21 @@ unsetifgroup(const char *group_name, int d, int s, const struct afswtch *rafp) static void getifgroups(int s) { - int len, cnt; - struct ifgroupreq ifgr; - struct ifg_req *ifg; - - memset(&ifgr, 0, sizeof(ifgr)); - strlcpy(ifgr.ifgr_name, name, IFNAMSIZ); + ifconfig_handle_t *lifh; + struct ifgroupreq ifgr; + size_t cnt; - if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) { - if (errno == EINVAL || errno == ENOTTY) - return; - else - err(1, "SIOCGIFGROUP"); - } + lifh = ifconfig_open(); + if (lifh == NULL) + return; - len = ifgr.ifgr_len; - ifgr.ifgr_groups = - (struct ifg_req *)calloc(len / sizeof(struct ifg_req), - sizeof(struct ifg_req)); - if (ifgr.ifgr_groups == NULL) - err(1, "getifgroups"); - if (ioctl(s, SIOCGIFGROUP, (caddr_t)&ifgr) == -1) - err(1, "SIOCGIFGROUP"); + if (ifconfig_get_groups(lifh, name, &ifgr) == -1) + goto close; cnt = 0; - ifg = ifgr.ifgr_groups; - for (; ifg && len >= sizeof(struct ifg_req); ifg++) { - len -= sizeof(struct ifg_req); + for (size_t i = 0; i < ifgr.ifgr_len / sizeof(struct ifg_req); ++i) { + struct ifg_req *ifg = &ifgr.ifgr_groups[i]; + if (strcmp(ifg->ifgrq_group, "all")) { if (cnt == 0) printf("\tgroups:"); @@ -122,6 +112,8 @@ getifgroups(int s) printf("\n"); free(ifgr.ifgr_groups); +close: + ifconfig_close(lifh); } static void From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CFB45788D2; Sun, 14 Mar 2021 09:09: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 4Dytzg1rThz3Fnp; Sun, 14 Mar 2021 09:09: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 1C9B91AAF5; Sun, 14 Mar 2021 09:09: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 12E99m93078377; Sun, 14 Mar 2021 09:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99mDW078376; Sun, 14 Mar 2021 09:09:48 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:48 GMT Message-Id: <202103140909.12E99mDW078376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 3dfbda3401ab - stable/13 - sbin/ifconfig: Get bridge status with libifconfig MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3dfbda3401abea84da9fd637c1b950fd954f2514 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:53 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=3dfbda3401abea84da9fd637c1b950fd954f2514 commit 3dfbda3401abea84da9fd637c1b950fd954f2514 Author: Ryan Moeller AuthorDate: 2021-02-26 23:04:38 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:08:13 +0000 sbin/ifconfig: Get bridge status with libifconfig Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D28954 (cherry picked from commit 6f497e47e925f6886f444a8e31e2e939fca264f2) --- sbin/ifconfig/ifbridge.c | 169 +++++++++++++++++++---------------------------- 1 file changed, 69 insertions(+), 100 deletions(-) diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c index f4c51632bc98..cc1520a2e3f0 100644 --- a/sbin/ifconfig/ifbridge.c +++ b/sbin/ifconfig/ifbridge.c @@ -61,6 +61,8 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" static const char *stpstates[] = { STP_STATES }; @@ -116,74 +118,6 @@ do_bridgeflag(int sock, const char *ifs, int flag, int set) err(1, "unable to set bridge flags"); } -static void -bridge_interfaces(int s, const char *prefix) -{ - struct ifbifconf bifc; - struct ifbreq *req; - char *inbuf = NULL, *ninbuf; - char *p, *pad; - int i, len = 8192; - - pad = strdup(prefix); - if (pad == NULL) - err(1, "strdup"); - /* replace the prefix with whitespace */ - for (p = pad; *p != '\0'; p++) { - if(isprint(*p)) - *p = ' '; - } - - for (;;) { - ninbuf = realloc(inbuf, len); - if (ninbuf == NULL) - err(1, "unable to allocate interface buffer"); - bifc.ifbic_len = len; - bifc.ifbic_buf = inbuf = ninbuf; - if (do_cmd(s, BRDGGIFS, &bifc, sizeof(bifc), 0) < 0) - err(1, "unable to get interface list"); - if ((bifc.ifbic_len + sizeof(*req)) < len) - break; - len *= 2; - } - - for (i = 0; i < bifc.ifbic_len / sizeof(*req); i++) { - req = bifc.ifbic_req + i; - printf("%s%s ", prefix, req->ifbr_ifsname); - printb("flags", req->ifbr_ifsflags, IFBIFBITS); - printf("\n"); - - printf("%s", pad); - printf("ifmaxaddr %u", req->ifbr_addrmax); - printf(" port %u priority %u", req->ifbr_portno, - req->ifbr_priority); - printf(" path cost %u", req->ifbr_path_cost); - - if (req->ifbr_ifsflags & IFBIF_STP) { - if (req->ifbr_proto < nitems(stpproto)) - printf(" proto %s", stpproto[req->ifbr_proto]); - else - printf(" ", - req->ifbr_proto); - - printf("\n%s", pad); - if (req->ifbr_role < nitems(stproles)) - printf("role %s", stproles[req->ifbr_role]); - else - printf("", - req->ifbr_role); - if (req->ifbr_state < nitems(stpstates)) - printf(" state %s", stpstates[req->ifbr_state]); - else - printf(" ", - req->ifbr_state); - } - printf("\n"); - } - free(pad); - free(inbuf); -} - static void bridge_addresses(int s, const char *prefix) { @@ -222,44 +156,79 @@ bridge_addresses(int s, const char *prefix) static void bridge_status(int s) { - struct ifbropreq ifbp; - struct ifbrparam param; - u_int16_t pri; - u_int8_t ht, fd, ma, hc, pro; - u_int8_t lladdr[ETHER_ADDR_LEN]; - u_int16_t bprio; - u_int32_t csize, ctime; + ifconfig_handle_t *lifh; + struct ifconfig_bridge_status *bridge; + struct ifbropreq *params; + const char *pad, *prefix; + uint8_t lladdr[ETHER_ADDR_LEN]; + uint16_t bprio; - if (do_cmd(s, BRDGGCACHE, ¶m, sizeof(param), 0) < 0) - return; - csize = param.ifbrp_csize; - if (do_cmd(s, BRDGGTO, ¶m, sizeof(param), 0) < 0) - return; - ctime = param.ifbrp_ctime; - if (do_cmd(s, BRDGPARAM, &ifbp, sizeof(ifbp), 0) < 0) + lifh = ifconfig_open(); + if (lifh == NULL) return; - pri = ifbp.ifbop_priority; - pro = ifbp.ifbop_protocol; - ht = ifbp.ifbop_hellotime; - fd = ifbp.ifbop_fwddelay; - hc = ifbp.ifbop_holdcount; - ma = ifbp.ifbop_maxage; - - PV2ID(ifbp.ifbop_bridgeid, bprio, lladdr); - printf("\tid %s priority %u hellotime %u fwddelay %u\n", - ether_ntoa((struct ether_addr *)lladdr), pri, ht, fd); - printf("\tmaxage %u holdcnt %u proto %s maxaddr %u timeout %u\n", - ma, hc, stpproto[pro], csize, ctime); - PV2ID(ifbp.ifbop_designated_root, bprio, lladdr); - printf("\troot id %s priority %d ifcost %u port %u\n", - ether_ntoa((struct ether_addr *)lladdr), bprio, - ifbp.ifbop_root_path_cost, ifbp.ifbop_root_port & 0xfff); + if (ifconfig_bridge_get_bridge_status(lifh, name, &bridge) == -1) + goto close; - bridge_interfaces(s, "\tmember: "); + params = bridge->params; - return; + PV2ID(params->ifbop_bridgeid, bprio, lladdr); + printf("\tid %s priority %u hellotime %u fwddelay %u\n", + ether_ntoa((struct ether_addr *)lladdr), + params->ifbop_priority, + params->ifbop_hellotime, + params->ifbop_fwddelay); + printf("\tmaxage %u holdcnt %u proto %s maxaddr %u timeout %u\n", + params->ifbop_maxage, + params->ifbop_holdcount, + stpproto[params->ifbop_protocol], + bridge->cache_size, + bridge->cache_lifetime); + PV2ID(params->ifbop_designated_root, bprio, lladdr); + printf("\troot id %s priority %d ifcost %u port %u\n", + ether_ntoa((struct ether_addr *)lladdr), + bprio, + params->ifbop_root_path_cost, + params->ifbop_root_port & 0xfff); + + prefix = "\tmember: "; + pad = "\t "; + for (size_t i = 0; i < bridge->members_count; ++i) { + struct ifbreq *member = &bridge->members[i]; + + printf("%s%s ", prefix, member->ifbr_ifsname); + printb("flags", member->ifbr_ifsflags, IFBIFBITS); + printf("\n%s", pad); + printf("ifmaxaddr %u port %u priority %u path cost %u", + member->ifbr_addrmax, + member->ifbr_portno, + member->ifbr_priority, + member->ifbr_path_cost); + if (member->ifbr_ifsflags & IFBIF_STP) { + uint8_t proto = member->ifbr_proto; + uint8_t role = member->ifbr_role; + uint8_t state = member->ifbr_state; + + if (proto < nitems(stpproto)) + printf(" proto %s", stpproto[proto]); + else + printf(" ", proto); + printf("\n%s", pad); + if (role < nitems(stproles)) + printf("role %s", stproles[role]); + else + printf("", role); + if (state < nitems(stpstates)) + printf(" state %s", stpstates[state]); + else + printf(" ", state); + } + printf("\n"); + } + ifconfig_bridge_free_bridge_status(bridge); +close: + ifconfig_close(lifh); } static void From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFE845788D9; Sun, 14 Mar 2021 09:09: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 4Dytzl3FXpz3FwS; Sun, 14 Mar 2021 09:09: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 4AB921AF1E; Sun, 14 Mar 2021 09:09: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 12E99pfn078417; Sun, 14 Mar 2021 09:09:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99ppC078416; Sun, 14 Mar 2021 09:09:51 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:51 GMT Message-Id: <202103140909.12E99ppC078416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 137544502b05 - stable/13 - sbin/ifconfig: Get lagg status with libifconfig MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 137544502b0511eef36e2dc78a563d8d803cd2da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:55 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=137544502b0511eef36e2dc78a563d8d803cd2da commit 137544502b0511eef36e2dc78a563d8d803cd2da Author: Ryan Moeller AuthorDate: 2021-02-27 03:05:31 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:08:51 +0000 sbin/ifconfig: Get lagg status with libifconfig Also trimmed an unused block of code that never prints out LAGG_PROTOS. Reviewed by: kp (earlier version) Differential Revision: https://reviews.freebsd.org/D28961 (cherry picked from commit a0ebb915045ed0056decec5f001471af4e999f61) --- sbin/ifconfig/iflagg.c | 144 ++++++++++++++++++++++++------------------------- 1 file changed, 70 insertions(+), 74 deletions(-) diff --git a/sbin/ifconfig/iflagg.c b/sbin/ifconfig/iflagg.c index 5be8c67cd72a..5e726115662a 100644 --- a/sbin/ifconfig/iflagg.c +++ b/sbin/ifconfig/iflagg.c @@ -28,6 +28,8 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" static struct iflaggparam params = { @@ -216,93 +218,87 @@ lacp_format_peer(struct lacp_opreq *req, const char *sep) static void lagg_status(int s) { - struct lagg_protos lpr[] = LAGG_PROTOS; - struct lagg_reqport rpbuf[LAGG_MAX_PORTS]; - struct lagg_reqall ra; - struct lagg_reqopts ro; - struct lagg_reqflags rf; + struct lagg_protos protos[] = LAGG_PROTOS; + ifconfig_handle_t *lifh; + struct ifconfig_lagg_status *lagg; + struct lagg_reqall *ra; + struct lagg_reqflags *rf; + struct lagg_reqopts *ro; + struct lagg_reqport *ports; struct lacp_opreq *lp; - const char *proto = ""; - int i; + const char *proto; - bzero(&ra, sizeof(ra)); - bzero(&ro, sizeof(ro)); + lifh = ifconfig_open(); + if (lifh == NULL) + return; - strlcpy(ra.ra_ifname, name, sizeof(ra.ra_ifname)); - ra.ra_size = sizeof(rpbuf); - ra.ra_port = rpbuf; + if (ifconfig_lagg_get_lagg_status(lifh, name, &lagg) == -1) + goto close; - strlcpy(ro.ro_ifname, name, sizeof(ro.ro_ifname)); - ioctl(s, SIOCGLAGGOPTS, &ro); + ra = lagg->ra; + rf = lagg->rf; + ro = lagg->ro; + ports = ra->ra_port; - strlcpy(rf.rf_ifname, name, sizeof(rf.rf_ifname)); - if (ioctl(s, SIOCGLAGGFLAGS, &rf) != 0) - rf.rf_flags = 0; + proto = ""; + for (size_t i = 0; i < nitems(protos); ++i) { + if (ra->ra_proto == protos[i].lpr_proto) { + proto = protos[i].lpr_name; + break; + } + } + printf("\tlaggproto %s", proto); - if (ioctl(s, SIOCGLAGG, &ra) == 0) { - lp = (struct lacp_opreq *)&ra.ra_lacpreq; + if (rf->rf_flags & LAGG_F_HASHMASK) { + const char *sep = ""; - for (i = 0; i < nitems(lpr); i++) { - if (ra.ra_proto == lpr[i].lpr_proto) { - proto = lpr[i].lpr_name; - break; - } + printf(" lagghash "); + if (rf->rf_flags & LAGG_F_HASHL2) { + printf("%sl2", sep); + sep = ","; } - - printf("\tlaggproto %s", proto); - if (rf.rf_flags & LAGG_F_HASHMASK) { - const char *sep = ""; - - printf(" lagghash "); - if (rf.rf_flags & LAGG_F_HASHL2) { - printf("%sl2", sep); - sep = ","; - } - if (rf.rf_flags & LAGG_F_HASHL3) { - printf("%sl3", sep); - sep = ","; - } - if (rf.rf_flags & LAGG_F_HASHL4) { - printf("%sl4", sep); - sep = ","; - } + if (rf->rf_flags & LAGG_F_HASHL3) { + printf("%sl3", sep); + sep = ","; } - putchar('\n'); - if (verbose) { - printf("\tlagg options:\n"); - printb("\t\tflags", ro.ro_opts, LAGG_OPT_BITS); - putchar('\n'); - printf("\t\tflowid_shift: %d\n", ro.ro_flowid_shift); - if (ra.ra_proto == LAGG_PROTO_ROUNDROBIN) - printf("\t\trr_limit: %d\n", ro.ro_bkt); - printf("\tlagg statistics:\n"); - printf("\t\tactive ports: %d\n", ro.ro_active); - printf("\t\tflapping: %u\n", ro.ro_flapping); - if (ra.ra_proto == LAGG_PROTO_LACP) { - printf("\tlag id: %s\n", - lacp_format_peer(lp, "\n\t\t ")); - } + if (rf->rf_flags & LAGG_F_HASHL4) { + printf("%sl4", sep); + sep = ","; } - - for (i = 0; i < ra.ra_ports; i++) { - lp = (struct lacp_opreq *)&rpbuf[i].rp_lacpreq; - printf("\tlaggport: %s ", rpbuf[i].rp_portname); - printb("flags", rpbuf[i].rp_flags, LAGG_PORT_BITS); - if (verbose && ra.ra_proto == LAGG_PROTO_LACP) - printb(" state", lp->actor_state, - LACP_STATE_BITS); - putchar('\n'); - if (verbose && ra.ra_proto == LAGG_PROTO_LACP) - printf("\t\t%s\n", - lacp_format_peer(lp, "\n\t\t ")); + } + putchar('\n'); + if (verbose) { + printf("\tlagg options:\n"); + printb("\t\tflags", ro->ro_opts, LAGG_OPT_BITS); + putchar('\n'); + printf("\t\tflowid_shift: %d\n", ro->ro_flowid_shift); + if (ra->ra_proto == LAGG_PROTO_ROUNDROBIN) + printf("\t\trr_limit: %d\n", ro->ro_bkt); + printf("\tlagg statistics:\n"); + printf("\t\tactive ports: %d\n", ro->ro_active); + printf("\t\tflapping: %u\n", ro->ro_flapping); + if (ra->ra_proto == LAGG_PROTO_LACP) { + lp = &ra->ra_lacpreq; + printf("\tlag id: %s\n", + lacp_format_peer(lp, "\n\t\t ")); } + } - if (0 /* XXX */) { - printf("\tsupported aggregation protocols:\n"); - for (i = 0; i < nitems(lpr); i++) - printf("\t\tlaggproto %s\n", lpr[i].lpr_name); - } + for (size_t i = 0; i < ra->ra_ports; ++i) { + lp = &ports[i].rp_lacpreq; + printf("\tlaggport: %s ", ports[i].rp_portname); + printb("flags", ports[i].rp_flags, LAGG_PORT_BITS); + if (verbose && ra->ra_proto == LAGG_PROTO_LACP) + printb(" state", lp->actor_state, LACP_STATE_BITS); + putchar('\n'); + if (verbose && ra->ra_proto == LAGG_PROTO_LACP) + printf("\t\t%s\n", + lacp_format_peer(lp, "\n\t\t ")); } + + ifconfig_lagg_free_lagg_status(lagg); +close: + ifconfig_close(lifh); } static From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25E335786FE; Sun, 14 Mar 2021 09:09: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 4Dytzj4WjSz3Fq6; Sun, 14 Mar 2021 09:09: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 360C71AF1D; Sun, 14 Mar 2021 09:09: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 12E99oaD078397; Sun, 14 Mar 2021 09:09:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99oEo078396; Sun, 14 Mar 2021 09:09:50 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:50 GMT Message-Id: <202103140909.12E99oEo078396@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: ca459d253fa3 - stable/13 - libifconfig: Add a function to get down reason MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ca459d253fa3128426383b13b7a51e9a05c09bcb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:55 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=ca459d253fa3128426383b13b7a51e9a05c09bcb commit ca459d253fa3128426383b13b7a51e9a05c09bcb Author: Ryan Moeller AuthorDate: 2021-02-28 09:34:30 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:08:29 +0000 libifconfig: Add a function to get down reason For use in ifconfig. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D28991 (cherry picked from commit b12a960e4274926171dc7a4f9887a0d0a5195b44) --- lib/libifconfig/Symbol.map | 1 + lib/libifconfig/libifconfig.h | 9 +++++++++ lib/libifconfig/libifconfig_media.c | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index ec1ccec7f95c..782f78ec5e34 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -31,6 +31,7 @@ FBSD_1.6 { ifconfig_media_get_status; ifconfig_media_get_subtype; ifconfig_media_get_type; + ifconfig_media_get_downreason; ifconfig_open; ifconfig_set_capability; ifconfig_set_description; diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h index 46a13ae27d69..d8245ea13b23 100644 --- a/lib/libifconfig/libifconfig.h +++ b/lib/libifconfig/libifconfig.h @@ -207,6 +207,15 @@ const char *ifconfig_media_get_subtype(int ifmw); const char *ifconfig_media_get_status(const struct ifmediareq *ifmr); void ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen); +/** Retrieve the reason the interface is down + * @param h An open ifconfig state object + * @param name The interface name + * @param ifdr Return argument. + * @return 0 on success, nonzero on failure + */ +int ifconfig_media_get_downreason(ifconfig_handle_t *h, const char *name, + struct ifdownreason *ifdr); + int ifconfig_carp_get_info(ifconfig_handle_t *h, const char *name, struct carpreq *carpr, int ncarpr); diff --git a/lib/libifconfig/libifconfig_media.c b/lib/libifconfig/libifconfig_media.c index f7302d8a9b24..d7ef507604be 100644 --- a/lib/libifconfig/libifconfig_media.c +++ b/lib/libifconfig/libifconfig_media.c @@ -392,3 +392,13 @@ ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen) } } } + +int +ifconfig_media_get_downreason(ifconfig_handle_t *h, const char *name, + struct ifdownreason *ifdr) +{ + + (void)memset(ifdr, 0, sizeof(*ifdr)); + (void)strlcpy(ifdr->ifdr_name, name, sizeof(ifdr->ifdr_name)); + return (ifconfig_ioctlwrap(h, AF_LOCAL, SIOCGIFDOWNREASON, ifdr)); +} From owner-dev-commits-src-all@freebsd.org Sun Mar 14 09:09:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22024578AA9; Sun, 14 Mar 2021 09:09: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 4Dytzm00gtz3FwW; Sun, 14 Mar 2021 09:09: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 6D69A1AF98; Sun, 14 Mar 2021 09:09: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 12E99qxe078439; Sun, 14 Mar 2021 09:09:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12E99qPr078438; Sun, 14 Mar 2021 09:09:52 GMT (envelope-from git) Date: Sun, 14 Mar 2021 09:09:52 GMT Message-Id: <202103140909.12E99qPr078438@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 4e535a1ba72e - stable/13 - lib/flua/libjail: Allow empty params table MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4e535a1ba72e1f751f9cf869ab8c9d06514d6c59 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 09:09:56 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=4e535a1ba72e1f751f9cf869ab8c9d06514d6c59 commit 4e535a1ba72e1f751f9cf869ab8c9d06514d6c59 Author: Ryan Moeller AuthorDate: 2021-02-25 05:16:52 +0000 Commit: Ryan Moeller CommitDate: 2021-03-14 08:09:20 +0000 lib/flua/libjail: Allow empty params table The name or jid always gets added to the params, and that's enough to avoid allocating a 0 length params array. Reported by: kevans Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D28778 (cherry picked from commit e175b519a6fb83889fb3ca679b73d11ea5bea7ad) --- lib/flua/libjail/lua_jail.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/flua/libjail/lua_jail.c b/lib/flua/libjail/lua_jail.c index 9981fd5421c6..b66c60b43bc8 100644 --- a/lib/flua/libjail/lua_jail.c +++ b/lib/flua/libjail/lua_jail.c @@ -113,7 +113,6 @@ l_getparams(lua_State *L) "expected a jail name (string) or id (integer)"); luaL_checktype(L, 2, LUA_TTABLE); params_count = 1 + lua_rawlen(L, 2); - luaL_argcheck(L, params_count > 1, 2, "expected #params > 0"); flags = luaL_optinteger(L, 3, 0); params = malloc(params_count * sizeof(struct jailparam)); @@ -236,7 +235,6 @@ l_setparams(lua_State *L) lua_pushnil(L); for (params_count = 1; lua_next(L, 2) != 0; ++params_count) lua_pop(L, 1); - luaL_argcheck(L, params_count > 1, 2, "expected #params > 0"); flags = luaL_optinteger(L, 3, 0); From owner-dev-commits-src-all@freebsd.org Sun Mar 14 16:27:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A21605AB554; Sun, 14 Mar 2021 16:27: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 4Dz4hH402fz4Rht; Sun, 14 Mar 2021 16:27: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 7BE952084C; Sun, 14 Mar 2021 16:27: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 12EGRBT1057292; Sun, 14 Mar 2021 16:27:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12EGRBu4057291; Sun, 14 Mar 2021 16:27:11 GMT (envelope-from git) Date: Sun, 14 Mar 2021 16:27:11 GMT Message-Id: <202103141627.12EGRBu4057291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 9ac43bb7470b - releng/13.0 - gic_v3: Use 64-bit writes to GICD_IROUTERn 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 9ac43bb7470b94ca249d091017bab29363a7ed65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 16:27:11 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9ac43bb7470b94ca249d091017bab29363a7ed65 commit 9ac43bb7470b94ca249d091017bab29363a7ed65 Author: Cyprien Laplace AuthorDate: 2020-11-26 01:17:04 +0000 Commit: Ed Maste CommitDate: 2021-03-14 16:25:25 +0000 gic_v3: Use 64-bit writes to GICD_IROUTERn While 32-bit accesses to GICD_IROUTERn are allowed, this is a 64-bit register. Pull Request: https://github.com/freebsd/freebsd-src/pull/451 (cherry picked from commit 46ca0b903cad8955574a2c61bed41c2b92aa2273) (cherry picked from commit 40f283b038015b5b750267a26402098418fd1fb3) Approved by: re (gjb) --- sys/arm64/arm64/gic_v3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index f230eb6bbd06..8630a27102e3 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -844,7 +844,7 @@ gic_v3_bind_intr(device_t dev, struct intr_irqsrc *isrc) if (CPU_EMPTY(&isrc->isrc_cpu)) { gic_irq_cpu = intr_irq_next_cpu(gic_irq_cpu, &all_cpus); CPU_SETOF(gic_irq_cpu, &isrc->isrc_cpu); - gic_d_write(sc, 4, GICD_IROUTER(gi->gi_irq), + gic_d_write(sc, 8, GICD_IROUTER(gi->gi_irq), CPU_AFFINITY(gic_irq_cpu)); } else { /* @@ -852,7 +852,7 @@ gic_v3_bind_intr(device_t dev, struct intr_irqsrc *isrc) * the first CPU found. */ cpu = CPU_FFS(&isrc->isrc_cpu) - 1; - gic_d_write(sc, 4, GICD_IROUTER(gi->gi_irq), CPU_AFFINITY(cpu)); + gic_d_write(sc, 8, GICD_IROUTER(gi->gi_irq), CPU_AFFINITY(cpu)); } return (0); @@ -1114,7 +1114,7 @@ gic_v3_dist_init(struct gic_v3_softc *sc) */ aff = CPU_AFFINITY(0); for (i = GIC_FIRST_SPI; i < sc->gic_nirqs; i++) - gic_d_write(sc, 4, GICD_IROUTER(i), aff); + gic_d_write(sc, 8, GICD_IROUTER(i), aff); return (0); } From owner-dev-commits-src-all@freebsd.org Sun Mar 14 16:27:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7D785AB452; Sun, 14 Mar 2021 16:27: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 4Dz4hJ4rBHz4RlY; Sun, 14 Mar 2021 16:27: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 9912220B86; Sun, 14 Mar 2021 16:27: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 12EGRCdF057312; Sun, 14 Mar 2021 16:27:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12EGRCh2057311; Sun, 14 Mar 2021 16:27:12 GMT (envelope-from git) Date: Sun, 14 Mar 2021 16:27:12 GMT Message-Id: <202103141627.12EGRCh2057311@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: e6e8762dff59 - releng/13.0 - gic_v3: add message based interrupts support 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: e6e8762dff593cbd1da4cc5a3b8f75b183c23837 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 16:27:12 -0000 The branch releng/13.0 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=e6e8762dff593cbd1da4cc5a3b8f75b183c23837 commit e6e8762dff593cbd1da4cc5a3b8f75b183c23837 Author: Cyprien Laplace AuthorDate: 2020-12-05 15:47:33 +0000 Commit: Ed Maste CommitDate: 2021-03-14 16:26:06 +0000 gic_v3: add message based interrupts support Pull Request: https://github.com/freebsd/freebsd-src/pull/451 (cherry picked from commit 35ebd8d33ad2f7c2038f6bf9aa02eab21252f689) (cherry picked from commit acd69b070403e12742ccea7b19d251320ed788d5) Approved by: re (gjb) --- sys/arm64/arm64/gic_v3.c | 204 ++++++++++++++++++++++++++++++++++++++++++- sys/arm64/arm64/gic_v3_fdt.c | 20 +++++ sys/arm64/arm64/gic_v3_var.h | 5 ++ 3 files changed, 226 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index 8630a27102e3..954ed3cd878a 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #endif #include "pic_if.h" +#include "msi_if.h" #include #include "gic_v3_reg.h" @@ -94,6 +95,12 @@ static pic_ipi_send_t gic_v3_ipi_send; static pic_ipi_setup_t gic_v3_ipi_setup; #endif +static msi_alloc_msi_t gic_v3_alloc_msi; +static msi_release_msi_t gic_v3_release_msi; +static msi_alloc_msix_t gic_v3_alloc_msix; +static msi_release_msix_t gic_v3_release_msix; +static msi_map_msi_t gic_v3_map_msi; + static u_int gic_irq_cpu; #ifdef SMP static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1]; @@ -124,6 +131,13 @@ static device_method_t gic_v3_methods[] = { DEVMETHOD(pic_ipi_setup, gic_v3_ipi_setup), #endif + /* MSI/MSI-X */ + DEVMETHOD(msi_alloc_msi, gic_v3_alloc_msi), + DEVMETHOD(msi_release_msi, gic_v3_release_msi), + DEVMETHOD(msi_alloc_msix, gic_v3_alloc_msix), + DEVMETHOD(msi_release_msix, gic_v3_release_msix), + DEVMETHOD(msi_map_msi, gic_v3_map_msi), + /* End */ DEVMETHOD_END }; @@ -150,6 +164,11 @@ struct gic_v3_irqsrc { uint32_t gi_irq; enum intr_polarity gi_pol; enum intr_trigger gi_trig; +#define GI_FLAG_MSI (1 << 1) /* This interrupt source should only */ + /* be used for MSI/MSI-X interrupts */ +#define GI_FLAG_MSI_USED (1 << 2) /* This irq is already allocated */ + /* for a MSI/MSI-X interrupt */ + u_int gi_flags; }; /* Helper routines starting with gic_v3_ */ @@ -314,6 +333,22 @@ gic_v3_attach(device_t dev) } } + if (sc->gic_mbi_start > 0) { + /* Reserve these interrupts for MSI/MSI-X use */ + for (irq = sc->gic_mbi_start; irq <= sc->gic_mbi_end; irq++) { + sc->gic_irqs[irq].gi_pol = INTR_POLARITY_HIGH; + sc->gic_irqs[irq].gi_trig = INTR_TRIGGER_EDGE; + sc->gic_irqs[irq].gi_flags |= GI_FLAG_MSI; + } + + mtx_init(&sc->gic_mbi_mtx, "GICv3 mbi lock", NULL, MTX_DEF); + + if (bootverbose) { + device_printf(dev, "using spi %u to %u\n", sc->gic_mbi_start, + sc->gic_mbi_end); + } + } + /* * Read the Peripheral ID2 register. This is an implementation * defined register, but seems to be implemented in all GICv3 @@ -692,8 +727,11 @@ gic_v3_setup_intr(device_t dev, struct intr_irqsrc *isrc, return (0); } - gi->gi_pol = pol; - gi->gi_trig = trig; + /* For MSI/MSI-X we should have already configured these */ + if ((gi->gi_flags & GI_FLAG_MSI) == 0) { + gi->gi_pol = pol; + gi->gi_trig = trig; + } /* * XXX - In case that per CPU interrupt is going to be enabled in time @@ -742,7 +780,7 @@ gic_v3_teardown_intr(device_t dev, struct intr_irqsrc *isrc, { struct gic_v3_irqsrc *gi = (struct gic_v3_irqsrc *)isrc; - if (isrc->isrc_handlers == 0) { + if (isrc->isrc_handlers == 0 && (gi->gi_flags & GI_FLAG_MSI) == 0) { gi->gi_pol = INTR_POLARITY_CONFORM; gi->gi_trig = INTR_TRIGGER_CONFORM; } @@ -1270,3 +1308,163 @@ gic_v3_redist_init(struct gic_v3_softc *sc) return (0); } + +/* + * SPI-mapped Message Based Interrupts -- a GICv3 MSI/MSI-X controller. + */ + +static int +gic_v3_alloc_msi(device_t dev, device_t child, int count, int maxcount, + device_t *pic, struct intr_irqsrc **srcs) +{ + struct gic_v3_softc *sc; + int i, irq, end_irq; + bool found; + + KASSERT(powerof2(count), ("%s: bad count", __func__)); + KASSERT(powerof2(maxcount), ("%s: bad maxcount", __func__)); + + sc = device_get_softc(dev); + + mtx_lock(&sc->gic_mbi_mtx); + + found = false; + for (irq = sc->gic_mbi_start; irq < sc->gic_mbi_end; irq++) { + /* Start on an aligned interrupt */ + if ((irq & (maxcount - 1)) != 0) + continue; + + /* Assume we found a valid range until shown otherwise */ + found = true; + + /* Check this range is valid */ + for (end_irq = irq; end_irq != irq + count; end_irq++) { + /* No free interrupts */ + if (end_irq == sc->gic_mbi_end) { + found = false; + break; + } + + KASSERT((sc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI)!= 0, + ("%s: Non-MSI interrupt found", __func__)); + + /* This is already used */ + if ((sc->gic_irqs[end_irq].gi_flags & GI_FLAG_MSI_USED) == + GI_FLAG_MSI_USED) { + found = false; + break; + } + } + if (found) + break; + } + + /* Not enough interrupts were found */ + if (!found || irq == sc->gic_mbi_end) { + mtx_unlock(&sc->gic_mbi_mtx); + return (ENXIO); + } + + for (i = 0; i < count; i++) { + /* Mark the interrupt as used */ + sc->gic_irqs[irq + i].gi_flags |= GI_FLAG_MSI_USED; + } + mtx_unlock(&sc->gic_mbi_mtx); + + for (i = 0; i < count; i++) + srcs[i] = (struct intr_irqsrc *)&sc->gic_irqs[irq + i]; + *pic = dev; + + return (0); +} + +static int +gic_v3_release_msi(device_t dev, device_t child, int count, + struct intr_irqsrc **isrc) +{ + struct gic_v3_softc *sc; + struct gic_v3_irqsrc *gi; + int i; + + sc = device_get_softc(dev); + + mtx_lock(&sc->gic_mbi_mtx); + for (i = 0; i < count; i++) { + gi = (struct gic_v3_irqsrc *)isrc[i]; + + KASSERT((gi->gi_flags & GI_FLAG_MSI_USED) == GI_FLAG_MSI_USED, + ("%s: Trying to release an unused MSI-X interrupt", + __func__)); + + gi->gi_flags &= ~GI_FLAG_MSI_USED; + } + mtx_unlock(&sc->gic_mbi_mtx); + + return (0); +} + +static int +gic_v3_alloc_msix(device_t dev, device_t child, device_t *pic, + struct intr_irqsrc **isrcp) +{ + struct gic_v3_softc *sc; + int irq; + + sc = device_get_softc(dev); + + mtx_lock(&sc->gic_mbi_mtx); + /* Find an unused interrupt */ + for (irq = sc->gic_mbi_start; irq < sc->gic_mbi_end; irq++) { + KASSERT((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI) != 0, + ("%s: Non-MSI interrupt found", __func__)); + if ((sc->gic_irqs[irq].gi_flags & GI_FLAG_MSI_USED) == 0) + break; + } + /* No free interrupt was found */ + if (irq == sc->gic_mbi_end) { + mtx_unlock(&sc->gic_mbi_mtx); + return (ENXIO); + } + + /* Mark the interrupt as used */ + sc->gic_irqs[irq].gi_flags |= GI_FLAG_MSI_USED; + mtx_unlock(&sc->gic_mbi_mtx); + + *isrcp = (struct intr_irqsrc *)&sc->gic_irqs[irq]; + *pic = dev; + + return (0); +} + +static int +gic_v3_release_msix(device_t dev, device_t child, struct intr_irqsrc *isrc) +{ + struct gic_v3_softc *sc; + struct gic_v3_irqsrc *gi; + + sc = device_get_softc(dev); + gi = (struct gic_v3_irqsrc *)isrc; + + KASSERT((gi->gi_flags & GI_FLAG_MSI_USED) == GI_FLAG_MSI_USED, + ("%s: Trying to release an unused MSI-X interrupt", __func__)); + + mtx_lock(&sc->gic_mbi_mtx); + gi->gi_flags &= ~GI_FLAG_MSI_USED; + mtx_unlock(&sc->gic_mbi_mtx); + + return (0); +} + +static int +gic_v3_map_msi(device_t dev, device_t child, struct intr_irqsrc *isrc, + uint64_t *addr, uint32_t *data) +{ + struct gic_v3_softc *sc = device_get_softc(dev); + struct gic_v3_irqsrc *gi = (struct gic_v3_irqsrc *)isrc; + +#define GICD_SETSPI_NSR 0x40 + *addr = vtophys(rman_get_virtual(sc->gic_dist)) + GICD_SETSPI_NSR; + *data = gi->gi_irq; + + return (0); +} diff --git a/sys/arm64/arm64/gic_v3_fdt.c b/sys/arm64/arm64/gic_v3_fdt.c index c8a9615a8a5f..483d67ba6deb 100644 --- a/sys/arm64/arm64/gic_v3_fdt.c +++ b/sys/arm64/arm64/gic_v3_fdt.c @@ -121,6 +121,8 @@ gic_v3_fdt_attach(device_t dev) pcell_t redist_regions; intptr_t xref; int err; + uint32_t *mbi_ranges; + ssize_t ret; sc = device_get_softc(dev); sc->dev = dev; @@ -135,6 +137,21 @@ gic_v3_fdt_attach(device_t dev) else sc->gic_redists.nregions = redist_regions; + /* Add Message Based Interrupts using SPIs. */ + ret = OF_getencprop_alloc_multi(ofw_bus_get_node(dev), "mbi-ranges", + sizeof(*mbi_ranges), (void **)&mbi_ranges); + if (ret > 0) { + if (ret % 2 == 0) { + /* Limit to a single range for now. */ + sc->gic_mbi_start = mbi_ranges[0]; + sc->gic_mbi_end = mbi_ranges[0] + mbi_ranges[1] - 1; + } else { + if (bootverbose) + device_printf(dev, "Malformed mbi-ranges property\n"); + } + free(mbi_ranges, M_OFWPROP); + } + err = gic_v3_attach(dev); if (err != 0) goto error; @@ -147,6 +164,9 @@ gic_v3_fdt_attach(device_t dev) goto error; } + if (sc->gic_mbi_start > 0) + intr_msi_register(dev, xref); + /* Register xref */ OF_device_register_xref(xref, dev); diff --git a/sys/arm64/arm64/gic_v3_var.h b/sys/arm64/arm64/gic_v3_var.h index f855e425d66d..1645c417fd8d 100644 --- a/sys/arm64/arm64/gic_v3_var.h +++ b/sys/arm64/arm64/gic_v3_var.h @@ -68,6 +68,11 @@ struct gic_v3_softc { /* Re-Distributors */ struct gic_redists gic_redists; + /* Message Based Interrupts */ + u_int gic_mbi_start; + u_int gic_mbi_end; + struct mtx gic_mbi_mtx; + uint32_t gic_pidr2; u_int gic_bus; From owner-dev-commits-src-all@freebsd.org Sun Mar 14 16:30:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 476775AB92A for ; Sun, 14 Mar 2021 16:30: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 4Dz4ll1XRCz4RxW; Sun, 14 Mar 2021 16:30: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 273A420A96; Sun, 14 Mar 2021 16:30: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 12EGUBQd060805; Sun, 14 Mar 2021 16:30:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12EGUBXc060761; Sun, 14 Mar 2021 16:30:11 GMT (envelope-from git) Date: Sun, 14 Mar 2021 16:30:11 GMT Message-Id: <202103141630.12EGUBXc060761@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dmitry Chagin Subject: git: 1b174d6cdff5 - vendor/tcsh - Import 6.22.03-ceccc7f MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/vendor/tcsh X-Git-Reftype: branch X-Git-Commit: 1b174d6cdff5276d6dad729c6fe9352d9ee5da7d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 16:30:11 -0000 The branch vendor/tcsh has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=1b174d6cdff5276d6dad729c6fe9352d9ee5da7d commit 1b174d6cdff5276d6dad729c6fe9352d9ee5da7d Author: Dmitry Chagin AuthorDate: 2021-03-14 16:28:29 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-14 16:28:29 +0000 Import 6.22.03-ceccc7f --- FAQ | 339 ++--- Fixes | 23 + Imakefile | 14 +- Makefile.ADMIN | 24 + Makefile.in | 11 +- Makefile.std | 2 +- Makefile.vms | 2 +- README.md | 9 +- aclocal.m4 | 1025 ++++++++++++-- config/linux | 7 + configure | 3803 +++++++++++++++++++++++++++++++--------------------- configure.ac | 5 +- dot.login | 12 + dot.tcshrc | 110 ++ ed.chared.c | 18 +- ed.inputl.c | 2 +- ed.screen.c | 2 +- ed.xmap.c | 2 +- host.defs | 2 +- patchlevel.h | 6 +- sh.c | 17 +- sh.dir.c | 41 +- sh.dol.c | 132 +- sh.exp.c | 2 +- sh.func.c | 5 +- sh.glob.c | 11 +- sh.h | 6 +- sh.hist.c | 10 +- sh.lex.c | 47 +- sh.misc.c | 21 +- sh.set.c | 14 +- tc.alloc.c | 10 + tc.disc.c | 4 + tc.os.c | 2 +- tc.prompt.c | 2 +- tcsh.man | 21 +- tcsh.man.new | 64 +- tests/lexical.at | 107 ++ tests/subst.at | 28 +- tests/variables.at | 26 +- tw.parse.c | 4 +- 41 files changed, 3900 insertions(+), 2092 deletions(-) diff --git a/FAQ b/FAQ index 92aadc726683..93773c52433a 100644 --- a/FAQ +++ b/FAQ @@ -1,237 +1,190 @@ + * Home + * FAQ + * Y2K + __________________________________________________________________ - [Home] FAQ +FAQ - Home | RecentChanges | Preferences - _________________________________________________________________ + For the people who do not read the manual! - This is for people who do not read the manual! + Why is the meta key broken in tcsh-5.20 and up? - So far people who don't read manuals don't read this either... I may - call it README.*PLEASE* in the future, but then the same people won't - be able to get ftp it... :-) - _________________________________________________________________ - - 1. Where can I find tcsh sources? - - See http://www.tcsh.org/MostRecentRelease for download locations. - _________________________________________________________________ - - 2. Why is the meta key broken in tcsh-5.20 and up? - - On some machines the tty is not set up to pass 8 bit characters by - default. Tcsh 5.19 used to try to determine if pass8 should be set by + On some machines the tty is not set up to pass 8 bit characters by + default. Tcsh 5.19 used to try to determine if pass8 should be set by looking at the terminal's meta key. Unfortunately there is no good way - of determining if the terminal can really pass 8 characters or not. - Consider if you are logged in through a modem line with 7 bits and - parity and your terminal has a meta key. Then tcsh 5.19 would set + of determining if the terminal can really pass 8 characters or not. + Consider if you are logged in through a modem line with 7 bits and + parity and your terminal has a meta key. Then tcsh 5.19 would set wrongly set pass8. - If you did like the previous behavior you can add in /etc/csh.login, - or in .login: - + If you did like the previous behavior you can add in /etc/csh.login, or + in .login: if ( $?tcsh && $?prompt ) then if ( "`echotc meta`" == "yes" ) then stty pass8 endif endif - If you don't have pass8, maybe one of these would work.. - + If you don't have pass8, maybe one of these would work: stty -parity -evenp -oddp cs8 -istrip (rs6000) stty -parenb -istrip cs8 - Finally, tcsh will bind all printable meta characters to the self - insert command. If you don't want that to happen (i.e. use the + Finally, tcsh will bind all printable meta characters to the self + insert command. If you don't want that to happen (i.e. use the printable meta characters for commands) setenv NOREBIND. - _________________________________________________________________ - 3. I ran 'dbxtool &' and 'shelltool &' from tcsh, and they end up in - cbreak and no echo mode? - - These programs are broken. Background jobs should not try to look at - the tty. What happens is that dbxtool looks in stderr to inherit the - tty setups, but tcsh sets up the tty in cbreak and -echo modes, so - that it can do line editing. This cannot be fixed because tcsh cannot - give away the tty. Pick one of the following as a workaround: + I ran dbxtool & and shelltool & from tcsh, and they end up in cbreak and no + echo mode? + These programs are broken. Background jobs should not try to look at + the tty. What happens is that dbxtool looks in stderr to inherit the + tty setups, but tcsh sets up the tty in cbreak and -echo modes, so that + it can do line editing. This cannot be fixed because tcsh cannot give + away the tty. Pick one of the following as a workaround: dbxtool < /dev/null >& /dev/null & /usr/etc/setsid dbxtool & - If that does not work, for dbxtool at least you can add "sh stty sane" - in your .dbxinit - _________________________________________________________________ + If that does not work, for dbxtool at least you can add sh stty sane in + your .dbxinit file. - 4. I tried to compile tcsh and it cannot find ? + I tried to compile tcsh and it cannot find ? - Your system does not support NLS. Undefine NLS in config_f.h and it + Your system does not support NLS. Undefine NLS in config_f.h and it should work fine. - _________________________________________________________________ - - 5. Where can I get csh sources? - - Csh sources are now available with the 4.4BSD networking - distributions. You don't need csh sources to compile tcsh-6.0x. - _________________________________________________________________ - - 6. I just made tcsh my login shell, and I cannot ftp any more? - - Newer versions of the ftp daemon check for the validity of the user's - shell before they allow logins. The list of valid login shells is - either hardcoded or it is usually in a file called /etc/shells. If it - is hard-coded, then you are out of luck and your best bet is to get a - newer version of ftpd. Otherwise add tcsh to the list of shells. [For - AIX this file is called /etc/security/login.cfg.] Remember that the - full path is required. If there is no /etc/shells, and you are - creating one, remember to add /bin/csh, /bin/sh, and any other valid - shells for your system, so that other people can ftp too :-) - _________________________________________________________________ - - 7. I am using SunView or OpenWindows and editing is screwed up. In - particular my arrow keys and backspace don't work right. What am I - doing wrong? - - Well, cmdtool tries to do its own command line editing and the effect - you get is one of using an editor inside an editor. Both try to - interpret the arrow key sequences and cmdtool wins since it gets them - first. The solutions are in my order of preference: - 1. Don't use suntools - 2. Use shelltool instead of cmdtool. - 3. Unset edit in tcsh. - _________________________________________________________________ + Where can I get csh sources? + + Csh sources are now available with the 4.4BSD networking distributions. + You don't need csh sources to compile tcsh-6.0x. + + I just made tcsh my login shell, and I cannot ftp any more? + + Newer versions of the ftp daemon check for the validity of the user's + shell before they allow logins. The list of valid login shells is + either hardcoded or it is usually in a file called /etc/shells. If it + is hard-coded, then you are out of luck and your best bet is to get a + newer version of ftpd. Otherwise add tcsh to the list of shells. (For + AIX this file is called /etc/security/login.cfg.) Remember that the + full path is required. If there is no /etc/shells, and you are creating + one, remember to add /bin/csh, /bin/sh, and any other valid shells for + your system, so that other people can ftp too. - 8. On a SPARCstation running Solaris 2.x and OpenWindows 3.1, inside a - cmdtool, the short-cut key sequence to clear log (i.e. Meta-e or - Diamond-e) doesn't work: it just echos 'e'; or + I am using SunView or OpenWindows and editing is screwed up. In particular my + arrow keys and backspace don't work right. What am I doing wrong? + + Well, cmdtool tries to do its own command line editing and the effect + you get is one of using an editor inside an editor. Both try to + interpret the arrow key sequences and cmdtool wins since it gets them + first. The solutions are in my order of preference: + * Don't use suntools + * Use shelltool instead of cmdtool. + * Unset edit in tcsh. + + On a SPARCstation running Solaris 2.x and OpenWindows 3.1, inside a cmdtool, + the short-cut key sequence to clear log (i.e. Meta-e or Diamond-e) doesn't + work: it just echos ‘e’; or Unset edit in tcsh. - _________________________________________________________________ - 9. On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool - (within SPARCworks) doesn't work: it just does a `cd' to the working - directory then stops. + On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool (within + SPARCworks) doesn't work: it just does a `cd’ to the working directory then + stops. - Unset edit in tcsh. Using shelltool instead of cmdtool does not fix + Unset edit in tcsh. Using shelltool instead of cmdtool does not fix this. - _________________________________________________________________ - 10. I rlogin to another machine, and then no matter what I tell 'stty' - I cannot get it to pass 8 bit characters? + I rlogin to another machine, and then no matter what I tell stty I cannot get + it to pass 8 bit characters? - Maybe you need to use 'rlogin -8' to tell rlogin to pass 8 bit + Maybe you need to use rlogin -8 to tell rlogin to pass 8 bit characters. - _________________________________________________________________ - 11. Where do I get the public domain directory library? + Where do I get the public domain directory library? - Anonymous ftp to prep.ai.mit.edu:/pub/gnu/dirent.tar.Z - _________________________________________________________________ + Anonymous ftp to ftp://prep.ai.mit.edu/pub/gnu/dirent.tar.Z - 12. I compiled tcsh using gcc, and when I start up it says: tcsh: - Warning no access to tty (Invalid Argument). Thus no job control in - this shell + I compiled tcsh using gcc, and when I start up it says: tcsh: Warning no + access to tty (Invalid Argument). Thus no job control in this shell - Your file is not ansi compliant. You have one of 3 + Your file is not ansi compliant. You have one of 3 choices: + * Run fixincludes from the gcc distribution. + * Add -traditional to the gcc flags. + * Compile with cc. - 1. Run fixincludes from the gcc distribution. - 2. Add -traditional to the gcc flags. - 3. Compile with cc. - _________________________________________________________________ - - 13. I compiled tcsh with the SunOS unbundled compiler and now things - get echo'ed twice. + I compiled tcsh with the SunOS unbundled compiler and now things get echoed + twice. It is a bug in the unbundled optimizer. Lower the optimization level. - _________________________________________________________________ - 14. How can I use the arrow keys with hpterm? + How can I use the arrow keys with hpterm? Hp terminals use the arrow keys internally. You can tell hpterm not to do that, by sending it the termcap sequence smkx. Since this has to be - done all the time, the easiest thing is to put it as an alias for + done all the time, the easiest thing is to put it as an alias for precmd, or inside the prompt: - if ($term == "hp") then set prompt="%{`echotc smkx`%}$prompt" endif - Note that by doing that you cannot use pgup and pgdn to scroll... Also - if you are using termcap, replace "smkx" with "ks"... - _________________________________________________________________ + Note that by doing that you cannot use pgup and pgdn to scroll… Also if + you are using termcap, replace smkx with ks. - 15. On POSIX machines ^C and ^Z will do not work when tcsh is a login - shell? + On POSIX machines ^C and ^Z do not work when tcsh is a login shell? Make sure that the interrupt character is set to ^C and suspend is set - to ^Z; 'stty -a' will show you the current stty settings; 'stty intr - ^C susp ^Z' will set them to ^C and ^Z respectively. - _________________________________________________________________ + to ^Z; stty -a will show you the current stty settings; stty intr ^C + susp ^Z will set them to ^C and ^Z respectively. - 16. I am trying to compile tcsh and I am getting compile errors that - look like: + I am trying to compile tcsh and I am getting compile errors that look like: - >sh.c:???: `STR???' undeclared, outside of functions [gcc] - >"sh.c", line ???: STR??? undefined [cc] + sh.c:???: `STR???' undeclared, outside of functions [gcc] + "sh.c", line ???: STR??? undefined [cc] - You interrupted make, while it was making the automatically generated - headers. Type 'make clean; make' - _________________________________________________________________ + You interrupted make, while it was making the automatically generated + headers. Type make clean; make - 17. On the cray, sometimes the CR/LF mapping gets screwed up. + On the cray, sometimes the CR/LF mapping gets screwed up. - You are probably logged in to the cray via telnet. Cray's telnetd - implements line mode selection the telnet client you are using does - not implement telnet line mode. This cause the Cray's telnetd to try - to use KLUDGELINEMODE. You can turn off telnet line mode from the cray - side by doing a "stty -extproc", or you can get the Cray AIC to build - a telnetd without KLUDGELINEMODE, or you can compile a new telnet - client (from the BSD net2 tape), or at least on the suns use: 'mode - character'. - _________________________________________________________________ + You are probably logged in to the cray via telnet. Cray's telnetd + implements line mode selection the telnet client you are using does not + implement telnet line mode. This cause the Cray's telnetd to try to use + KLUDGELINEMODE. You can turn off telnet line mode from the cray side by + doing a stty -extproc, or you can get the Cray AIC to build a telnetd + without KLUDGELINEMODE, or you can compile a new telnet client (from + the BSD net2 tape), or at least on the suns use: mode character. - 18. On AU/X, I made tcsh my startup shell, but the mac desktop is not - starting up (no X11 or Finder), and I only get console emulation. + On AU/X, I made tcsh my startup shell, but the mac desktop is not starting up + (no X11 or Finder), and I only get console emulation. - This is another manifestation of item 5. Just add the pathname to tcsh - in /etc/shells and everything should work fine. - _________________________________________________________________ + Add the pathname to tcsh in /etc/shells and everything should work + fine. - 19. On machines that use YP (NIS) tilde expansion might end up in - /dev/null + On machines that use YP (NIS) tilde expansion might end up in /dev/null - If this happens complain to your vendor, to get a new version of NIS. + If this happens complain to your vendor, to get a new version of NIS. You can fix that in tcsh by defining YPBUGS in config.h - _________________________________________________________________ - 20. Script on SGI 4.0.5 does not give us a tty, so we cannot have job - control. + Script on SGI 4.0.5 does not give us a tty, so we cannot have job control. Their csh does not have job control either. Try: - % script % cat > /dev/tty - _________________________________________________________________ - 21. I start tcsh and it takes a couple of minutes to get the prompt. + I start tcsh and it takes a couple of minutes to get the prompt. - You have defined REMOTEHOST and your DNS is not responding. Either + You have defined REMOTEHOST and your DNS is not responding. Either undefine REMOTEHOST and recompile or fix your DNS. - _________________________________________________________________ - - 22. If you need help generating your .cshrc file, check out: - http://www.imada.sdu.dk/~blackie/dotfile/ + If you need help generating your .cshrc file, check out: - or - http://www.dotfiles.com - _________________________________________________________________ + * https://github.com/tcsh-org/tcsh/blob/master/dot.tcshrc + * https://github.com/tcsh-org/tcsh/blob/master/dot.login - 23. On POSIX systems the kernel will send hup signals to all the - processes in the foreground process group if 'stty hupcl' is set. + On POSIX systems the kernel will send hup signals to all the processes in the + foreground process group if ‘stty hupcl’ is set. For example - ./tcsh echo $$ 591 @@ -240,65 +193,51 @@ Will kill everything, since hup will be sent to all tcsh processes. To avoid that you can set stty -hupcl, but it is not recommended. - _________________________________________________________________ - 24. When I rsh the meta key stops working on the remote machine. + When I rsh the meta key stops working on the remote machine. - Try using rsh -8; this option is undocumented on some systems, but it - works. If that does not work, get and use ssh/sshd. You'll be better + Try using rsh -8; this option is undocumented on some systems, but it + works. If that does not work, get and use ssh/sshd. You'll be better off from a security point of view anyway. - _________________________________________________________________ - 25. Tcsh compiled under hp/ux-10.x does not pass resource limits - correctly when ran on hp/ux-11.x systems. + Tcsh compiled under hp/ux-10.x does not pass resource limits correctly when + ran on hp/ux-11.x systems. - This is a problem with lack of ABI compatibility between the two + This is a problem with lack of ABI compatibility between the two systems. The only solution is to recompile. - _________________________________________________________________ - 26. Refreshing in command line editing can appear broken on some OS's + Refreshing in command line editing can appear broken on some OS's - This is because the termcap/terminfo description lies about the - ability of the terminal to use tabs. At least on Compaq/DEC Alpha - OSF/1 3.x and 4.x systems, stty -tabs will cause problems. - _________________________________________________________________ + This is because the termcap/terminfo description lies about the ability + of the terminal to use tabs. At least on Compaq/DEC Alpha OSF/1 3.x and + 4.x systems, stty -tabs will cause problems. - 27. Where can I learn the merits of tcsh vs. bash vs. csh vs. sh etc? + Where can I learn the merits of tcsh vs. bash vs. csh vs. sh etc? - You can read the manual page section titled [NEW FEATURES] listing + You can read the manual page section titled [NEW FEATURES] listing features that tcsh adds to csh. - You can read Tom Christiansen's [Csh Programming Considered Harmful], - a document advocating that csh (and by extension, tcsh) should not be + You can read Tom Christiansen's Csh Programming Considered Harmful, a + document advocating that csh (and by extension, tcsh) should not be used for writing shell scripts. - XXX: Need to find something about [bash], but bash is sh-compatible - and has many of the same interactive features of tcsh (command - completion does not appear to be as flexible, though). - - [Curtains up: introducing the Z shell] has a pretty good rundown on - zsh. Aside from the arguments about csh being evil, tcsh appears to - compare well with zsh [zsh]. Zsh is sh and ksh compatible, with many - of the interactive features of tcsh. - _________________________________________________________________ - - 28. Why does FreeBSD's tcsh do history browsing differently than I - expect? + XXX: Need to find something about bash, but bash is sh-compatible and + has many of the same interactive features of tcsh (command completion + does not appear to be as flexible, though). - On FreeBSD, by default, the up arrow is set to - "history-search-backward", rather than the default "up-history". As a - result, if you type (part of) a word and press up arrow, you'll see - previous commands that match the prefix. Pretty useful, actually, - although it takes some getting used to. You can use bindkey to see - your settings, and to rebind up & down differently if desired. - _________________________________________________________________ + Curtains up: introducing the Z shell has a pretty good rundown on zsh. + Aside from the arguments about csh being evil, tcsh appears to compare + well with zsh. Zsh is sh and ksh compatible, with many of the + interactive features of tcsh. - Everything else is a bug :-( + Why does FreeBSD's tcsh do history browsing differently than I expect? - Christos - _________________________________________________________________ + On FreeBSD, by default, the up arrow is set to history-search-backward, + rather than the default up-history. As a result, if you type (part of) + a word and press up arrow, you'll see previous commands that match the + prefix. Pretty useful, actually, although it takes some getting used + to. You can use bindkey to see your settings, and to rebind up & down + differently if desired. + __________________________________________________________________ - Home | RecentChanges | Preferences - Edit text of this page | View other revisions - Last edited April 29, 2004 15:02 (diff) - Search: ____________________ + Page content last updated on 2019-12-31 diff --git a/Fixes b/Fixes index db401f23fad0..e539c8241a86 100644 --- a/Fixes +++ b/Fixes @@ -1,3 +1,25 @@ + 14. Don't crash with 'bindkey "^0" clear-screen' (Karl Jeacle) + 13. Fix $x:q:h and $x:q:t return the whole string for strings not containing / + 12. V6.22.03 - 20201118 + 11. Fix $x:q:h and $x:q:t to not crash (alzwded) with strings containing / + 10. Block SIGHUP while writing history/directory stack (Brett Frankenberger) + 9. Fixed reversed test that broke history merging (Brett Frankenberger) + 8. Prevent recursive entry for writing history (Brett Frankenberger) + 7. alxwded@github, keep track of the :g and :a modifiers per modifier they + affect. + 6. alzwded@github, fix infinite loop with :gas variable modifier + 5. PR/88: Add a Q: modifier that preserves empty arguments leaving :q + alone. + 4. V6.22.02 - 20191204 + 3. Fix version in configure.ac + 2. V6.22.01 - 20191201 + 1. undo PR/88: Preserve empty arguments in :q, since it breaks + $ set x="" + $ alias test "echo "\""$x:q"\"" is working." + $ alias test + echo " + + 6. V6.22.00 - 20191128 5. PR/113: Sobomax: avoid infinite loops for -c commands when stdout is not a tty. 4. Avoid infinite loops during history loads when merging, print a better @@ -6,6 +28,7 @@ 2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE) 1. PR/81: Fix range matching issue where we were comparing with the range character instead of the start of range. [l-z]* would match foo + 12. V6.21.00 - 20190508 11. Abort history loading on words and lines too long https://bugzilla.redhat.com/show_bug.cgi?id=1598502 diff --git a/Imakefile b/Imakefile index be2bebe17ca9..bd1b43b1a24e 100644 --- a/Imakefile +++ b/Imakefile @@ -492,14 +492,15 @@ SHSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c \ sh.char.c sh.exp.c sh.file.c sh.func.c \ sh.glob.c sh.hist.c sh.init.c sh.lex.c \ sh.misc.c sh.parse.c sh.print.c sh.proc.c \ - sh.sem.c sh.set.c sh.time.c glob.c \ + sh.sem.c sh.set.c sh.time.c dotlock.c dotlock.h glob.c \ sh.char.h sh.dir.h sh.proc.h sh.h \ sh.decls.h glob.h ${SYSSRCS} SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \ sh.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \ sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} \ sh.misc.${SUF} sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} \ - sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} ${SYSOBJS} + sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} dotlock.${SUF} glob.${SUF} \ + ${SYSOBJS} TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \ tw.comp.c tw.color.c @@ -512,9 +513,10 @@ EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \ ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF} TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \ - tc.func.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \ - tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \ - tc.who.c tc.h + tc.func.c tc.nls.c tc.nls.h tc.os.c tc.os.h tc.printf.c tc.prompt.c \ + tc.disc.${SUF} tc.func.${SUF} tc.nls.${SUF} tc.os.${SUF} \ + tc.printf.${SUF} tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h \ + tc.vers.c tc.wait.h tc.who.c tc.h TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \ tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.printf.${SUF} \ tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \ @@ -524,7 +526,7 @@ MISCF = Makefile.std BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md \ FAQ WishList config_f.h eight-bit.me glob.3 patchlevel.h pathnames.h \ tcsh.man Ported src.desc Imakefile imake.config complete.tcsh \ Makefile.vms termcap.vms snames.h host.defs gethost.c tcsh.man2html \ - Makefile.in configure.ac Makefile.win32 aclocal.m4 + Makefile.in configure.ac Makefile.win32 aclocal.m4 dot.login dot.tcshrc CONFSRCS=config/[a-z]* diff --git a/Makefile.ADMIN b/Makefile.ADMIN new file mode 100644 index 000000000000..5ad3bb8fb3c5 --- /dev/null +++ b/Makefile.ADMIN @@ -0,0 +1,24 @@ +# +# Makefile.ADMIN +# +# Maintenance tasks +# +# You can refetch files from the website, then run "git diff" to +# sanity check any changes before committing. +# + +LYNX= lynx -dump -nolist +TRIM= expand | sed -e 's/^ *$$//' | cat -s +WEB= https://www.tcsh.org + +PAGES= FAQ + +all: ${PAGES} + +.for i in ${PAGES} +$i: force + ${LYNX} ${WEB}/${i:tl}/ | ${TRIM} > ${.TARGET} +.endfor + +.DUMMY: force +force: diff --git a/Makefile.in b/Makefile.in index 210b7de72dfe..c6b5f2554cc0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -6,6 +6,7 @@ # things; Paul Placeway, CIS Dept., Ohio State University # SHELL=/bin/sh +ENVCMD=/usr/bin/env VERSION=@PACKAGE_VERSION@ BUILD=tcsh$(EXEEXT) VPATH=@srcdir@ @@ -410,7 +411,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ gethost.c tcsh.man2html configure.ac configure config.h.in \ - tests/testsuite.at aclocal.m4 + tests/testsuite.at aclocal.m4 dot.login dot.tcshrc TESTFILES= tests/aliases.at tests/arguments.at tests/commands.at \ tests/expr.at tests/lexical.at tests/mb-eucjp.at \ tests/mb-utf8.at tests/noexec.at tests/parenthesis.at tests/syntax.at \ @@ -634,6 +635,8 @@ veryclean: clean ${RM} -f Makefile config.h config_p.h ${RM} -f config.status config.cache config.log tcsh.ps ${RM} -f missing + ${RM} -f testsuite.log + ${RM} -rf testsuite.dir ${RM} -rf autom4te.cache ${RM} -f *~ #* @@ -735,8 +738,10 @@ $(srcdir)/stamp-h.in: $(srcdir)/configure.ac cd $(srcdir) && autoheader @echo timestamp > $(srcdir)/stamp-h.in -check: atconfig $(srcdir)/tests/testsuite - $(SHELL) $(srcdir)/tests/testsuite +check test: atconfig $(srcdir)/tests/testsuite + $(ENVCMD) - \ + USER="$(USER)" \ + $(SHELL) $(srcdir)/tests/testsuite # # Dependencies diff --git a/Makefile.std b/Makefile.std index 3466d4ceac86..8c479fa1f213 100644 --- a/Makefile.std +++ b/Makefile.std @@ -320,7 +320,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ gethost.c tcsh.man2html configure.ac configure config.h.in \ - aclocal.m4 + aclocal.m4 dot.login dot.tcshrc VHSRCS=${PVSRCS} ${AVSRCS} diff --git a/Makefile.vms b/Makefile.vms index bc241147e253..2e3f4adbfed4 100644 --- a/Makefile.vms +++ b/Makefile.vms @@ -297,7 +297,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ WishList config_f.h eight-bit.me glob.3 patchlevel.h \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ - gethost.c tcsh.man2html configure.ac aclocal.m4 + gethost.c tcsh.man2html configure.ac aclocal.m4 dot.login dot.tcshrc VHSRCS=${PVSRCS} ${AVSRCS} diff --git a/README.md b/README.md index 58a30738daa6..df6671b0316e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ The Tcsh source code is available on GitHub as a read-only repo mirror at: -> http://github.com/tcsh-org/tcsh +> https://github.com/tcsh-org/tcsh Instructions for compiling Tcsh can be found in [BUILDING]. @@ -20,7 +20,10 @@ the tcsh mailing list: > https://mailman.astron.com/mailman/listinfo/tcsh [![Build Status][status]][travis] +[![Coverity Scan][badge]][coverity] [BUILDING]: BUILDING -[status]: https://travis-ci.org/tcsh-org/tcsh.svg?branch=master -[travis]: https://travis-ci.org/tcsh-org/tcsh +[badge]: https://scan.coverity.com/projects/20307/badge.svg +[coverity]: https://scan.coverity.com/projects/tcsh-org-tcsh +[status]: https://travis-ci.com/tcsh-org/tcsh.svg?branch=master +[travis]: https://travis-ci.com/tcsh-org/tcsh diff --git a/aclocal.m4 b/aclocal.m4 index 7a946ee1d832..b0ff2e853c42 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -12,8 +12,654 @@ # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -# iconv.m4 serial 19 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2007-2014, 2016 Free Software Foundation, Inc. +# host-cpu-c-abi.m4 serial 11 +dnl Copyright (C) 2002-2019 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible and Sam Steingold. + +dnl Sets the HOST_CPU variable to the canonical name of the CPU. +dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its +dnl C language ABI (application binary interface). +dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in +dnl config.h. +dnl +dnl This canonical name can be used to select a particular assembly language +dnl source file that will interoperate with C code on the given host. +dnl +dnl For example: +dnl * 'i386' and 'sparc' are different canonical names, because code for i386 +dnl will not run on SPARC CPUs and vice versa. They have different +dnl instruction sets. +dnl * 'sparc' and 'sparc64' are different canonical names, because code for +dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code +dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit +dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit +dnl mode, but not both. +dnl * 'mips' and 'mipsn32' are different canonical names, because they use +dnl different argument passing and return conventions for C functions, and +dnl although the instruction set of 'mips' is a large subset of the +dnl instruction set of 'mipsn32'. +dnl * 'mipsn32' and 'mips64' are different canonical names, because they use +dnl different sizes for the C types like 'int' and 'void *', and although +dnl the instruction sets of 'mipsn32' and 'mips64' are the same. +dnl * The same canonical name is used for different endiannesses. You can +dnl determine the endianness through preprocessor symbols: +dnl - 'arm': test __ARMEL__. +dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL. +dnl - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN. +dnl * The same name 'i386' is used for CPUs of type i386, i486, i586 +dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because +dnl - Instructions that do not exist on all of these CPUs (cmpxchg, +dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your +dnl assembly language source files use such instructions, you will +dnl need to make the distinction. +dnl - Speed of execution of the common instruction set is reasonable across +dnl the entire family of CPUs. If you have assembly language source files +dnl that are optimized for particular CPU types (like GNU gmp has), you +dnl will need to make the distinction. +dnl See . +AC_DEFUN([gl_HOST_CPU_C_ABI], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_C_ASM]) + AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi], + [case "$host_cpu" in + +changequote(,)dnl + i[4567]86 ) +changequote([,])dnl + gl_cv_host_cpu_c_abi=i386 + ;; + + x86_64 ) + # On x86_64 systems, the C compiler may be generating code in one of + # these ABIs: + # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. + # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 + # with native Windows (mingw, MSVC). + # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if (defined __x86_64__ || defined __amd64__ \ + || defined _M_X64 || defined _M_AMD64) + int ok; + #else + error fail + #endif + ]])], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __ILP32__ || defined _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=x86_64-x32], + [gl_cv_host_cpu_c_abi=x86_64])], + [gl_cv_host_cpu_c_abi=i386]) + ;; + +changequote(,)dnl + alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) +changequote([,])dnl + gl_cv_host_cpu_c_abi=alpha + ;; + + arm* | aarch64 ) + # Assume arm with EABI. + # On arm64 systems, the C compiler may be generating code in one of + # these ABIs: + # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. + # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef __aarch64__ + int ok; + #else + error fail + #endif + ]])], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __ILP32__ || defined _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=arm64-ilp32], + [gl_cv_host_cpu_c_abi=arm64])], + [# Don't distinguish little-endian and big-endian arm, since they + # don't require different machine code for simple operations and + # since the user can distinguish them through the preprocessor + # defines __ARMEL__ vs. __ARMEB__. + # But distinguish arm which passes floating-point arguments and + # return values in integer registers (r0, r1, ...) - this is + # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which + # passes them in float registers (s0, s1, ...) and double registers + # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer + # sets the preprocessor defines __ARM_PCS (for the first case) and + # __ARM_PCS_VFP (for the second case), but older GCC does not. + echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c + # Look for a reference to the register d0 in the .s file. + AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 + if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then + gl_cv_host_cpu_c_abi=armhf + else + gl_cv_host_cpu_c_abi=arm + fi + rm -f conftest* + ]) + ;; + + hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) + # On hppa, the C compiler may be generating 32-bit code or 64-bit + # code. In the latter case, it defines _LP64 and __LP64__. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef __LP64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=hppa64], + [gl_cv_host_cpu_c_abi=hppa]) + ;; + + ia64* ) + # On ia64 on HP-UX, the C compiler may be generating 64-bit code or + # 32-bit code. In the latter case, it defines _ILP32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=ia64-ilp32], + [gl_cv_host_cpu_c_abi=ia64]) + ;; + + mips* ) + # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this + # at 32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=mips64], + [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but + # may later get defined by ), and _MIPS_SIM == _ABIN32. + # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but + # may later get defined by ), and _MIPS_SIM == _ABIO32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if (_MIPS_SIM == _ABIN32) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=mipsn32], + [gl_cv_host_cpu_c_abi=mips])]) + ;; + + powerpc* ) + # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. + # No need to distinguish them here; the caller may distinguish + # them based on the OS. + # On powerpc64 systems, the C compiler may still be generating + # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may + # be generating 64-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __powerpc64__ || defined _ARCH_PPC64 + int ok; + #else + error fail + #endif + ]])], + [# On powerpc64, there are two ABIs on Linux: The AIX compatible + # one and the ELFv2 one. The latter defines _CALL_ELF=2. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined _CALL_ELF && _CALL_ELF == 2 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=powerpc64-elfv2], + [gl_cv_host_cpu_c_abi=powerpc64]) + ], + [gl_cv_host_cpu_c_abi=powerpc]) + ;; + + rs6000 ) + gl_cv_host_cpu_c_abi=powerpc + ;; + + riscv32 | riscv64 ) + # There are 2 architectures (with variants): rv32* and rv64*. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if __riscv_xlen == 64 + int ok; + #else + error fail + #endif + ]])], + [cpu=riscv64], + [cpu=riscv32]) + # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. + # Size of 'long' and 'void *': + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ + int ok; + #else *** 6540 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Mar 14 16:30:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63DC95AB92C for ; Sun, 14 Mar 2021 16:30: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 4Dz4lm2PKrz4S58; Sun, 14 Mar 2021 16:30: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 4546D20A97; Sun, 14 Mar 2021 16:30: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 12EGUCci061304; Sun, 14 Mar 2021 16:30:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12EGUC4u061298; Sun, 14 Mar 2021 16:30:12 GMT (envelope-from git) Date: Sun, 14 Mar 2021 16:30:12 GMT Message-Id: <202103141630.12EGUC4u061298@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dmitry Chagin Subject: git: c8457a24adf1 - Create tag vendor/tcsh/6.22.03-ceccc7f MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/tags/vendor/tcsh/6.22.03-ceccc7f X-Git-Reftype: annotated tag X-Git-Commit: c8457a24adf18e23989828e420eb67cc84bba4c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 16:30:12 -0000 The annotated tag vendor/tcsh/6.22.03-ceccc7f has been created by dchagin: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/tcsh/6.22.03-ceccc7f tag vendor/tcsh/6.22.03-ceccc7f Tagger: Dmitry Chagin TaggerDate: 2021-03-14 16:28:49 +0000 tag tcsh 6.22.03-ceccc7f commit 1b174d6cdff5276d6dad729c6fe9352d9ee5da7d Author: Dmitry Chagin AuthorDate: 2021-03-14 16:28:29 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-14 16:28:29 +0000 Import 6.22.03-ceccc7f From owner-dev-commits-src-all@freebsd.org Sun Mar 14 16:39:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30D865ABBDD; Sun, 14 Mar 2021 16:39: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 4Dz4yf0vVPz4SZy; Sun, 14 Mar 2021 16:39: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 127F020CE2; Sun, 14 Mar 2021 16:39: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 12EGdcKD071396; Sun, 14 Mar 2021 16:39:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12EGdcCg071395; Sun, 14 Mar 2021 16:39:38 GMT (envelope-from git) Date: Sun, 14 Mar 2021 16:39:38 GMT Message-Id: <202103141639.12EGdcCg071395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 45910f663893 - releng/13.0 - vm_reserv: Fix list locking in vm_reserv_reclaim_contig() 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 45910f663893fab38eaf95c70aaeff75035334c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 16:39:38 -0000 The branch releng/13.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=45910f663893fab38eaf95c70aaeff75035334c1 commit 45910f663893fab38eaf95c70aaeff75035334c1 Author: Mark Johnston AuthorDate: 2021-03-14 16:39:23 +0000 Commit: Mark Johnston CommitDate: 2021-03-14 16:39:23 +0000 vm_reserv: Fix list locking in vm_reserv_reclaim_contig() The per-domain partpop queue is locked by the combination of the per-domain lock and individual reservation mutexes. vm_reserv_reclaim_contig() scans the queue looking for partially populated reservations that can be reclaimed in order to satisfy the caller's allocation. During the scan, we drop the per-domain lock. At this point, the rvn pointer may be invalidated. Take care to load rvn after re-acquiring the per-domain lock. While here, simplify the condition used to check whether a reservation was dequeued while the per-domain lock was dropped. Approved by: re (gjb) Reviewed by: alc, kib Reported by: gallatin Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29203 (cherry picked from commit 968079f253c11433d47bece4b41b46fcbf985903) (cherry picked from commit cec3990d347972c30558b135b1bc9954184fb5fe) --- sys/vm/vm_reserv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index e7f542a66fdb..a9602c3977df 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -1344,8 +1344,8 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, TAILQ_INSERT_AFTER(queue, rv, marker, partpopq); vm_reserv_domain_unlock(domain); vm_reserv_lock(rv); - if (!rv->inpartpopq || - TAILQ_NEXT(rv, partpopq) != marker) { + if (TAILQ_PREV(marker, vm_reserv_queue, partpopq) != + rv) { vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); rvn = TAILQ_NEXT(marker, partpopq); @@ -1363,8 +1363,9 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, vm_reserv_unlock(rv); return (true); } - vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); + rvn = TAILQ_NEXT(rv, partpopq); + vm_reserv_unlock(rv); } vm_reserv_domain_unlock(domain); vm_reserv_domain_scan_unlock(domain); From owner-dev-commits-src-all@freebsd.org Sun Mar 14 16:57:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D67DE5ABFC1; Sun, 14 Mar 2021 16:57: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 4Dz5MX5jhNz4TjQ; Sun, 14 Mar 2021 16:57: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 B6E0020EB5; Sun, 14 Mar 2021 16:57: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 12EGvilu096825; Sun, 14 Mar 2021 16:57:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12EGviQb096822; Sun, 14 Mar 2021 16:57:44 GMT (envelope-from git) Date: Sun, 14 Mar 2021 16:57:44 GMT Message-Id: <202103141657.12EGviQb096822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 5224c2a3bc95 - main - Merge tcsh 6.22.03-ceccc7f MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5224c2a3bc95b431f729f3692f264395248d8acc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 16:57:44 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=5224c2a3bc95b431f729f3692f264395248d8acc commit 5224c2a3bc95b431f729f3692f264395248d8acc Merge: 9db44a8e5da9 1b174d6cdff5 Author: Dmitry Chagin AuthorDate: 2021-03-14 16:33:13 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-14 16:33:13 +0000 Merge tcsh 6.22.03-ceccc7f PR: 252663 MFC after: 1 week contrib/tcsh/FAQ | 339 ++-- contrib/tcsh/Fixes | 23 + contrib/tcsh/Imakefile | 14 +- contrib/tcsh/Makefile.ADMIN | 24 + contrib/tcsh/Makefile.in | 11 +- contrib/tcsh/Makefile.std | 2 +- contrib/tcsh/Makefile.vms | 2 +- contrib/tcsh/README.md | 9 +- contrib/tcsh/configure | 3803 +++++++++++++++++++++++++------------------ contrib/tcsh/dot.login | 12 + contrib/tcsh/dot.tcshrc | 110 ++ contrib/tcsh/ed.chared.c | 18 +- contrib/tcsh/ed.inputl.c | 2 +- contrib/tcsh/ed.screen.c | 2 +- contrib/tcsh/ed.xmap.c | 2 +- contrib/tcsh/host.defs | 2 +- contrib/tcsh/patchlevel.h | 6 +- contrib/tcsh/sh.c | 17 +- contrib/tcsh/sh.dir.c | 41 +- contrib/tcsh/sh.dol.c | 132 +- contrib/tcsh/sh.exp.c | 2 +- contrib/tcsh/sh.func.c | 5 +- contrib/tcsh/sh.glob.c | 11 +- contrib/tcsh/sh.h | 6 +- contrib/tcsh/sh.hist.c | 10 +- contrib/tcsh/sh.lex.c | 47 +- contrib/tcsh/sh.misc.c | 21 +- contrib/tcsh/sh.set.c | 14 +- contrib/tcsh/tc.alloc.c | 10 + contrib/tcsh/tc.disc.c | 4 + contrib/tcsh/tc.os.c | 2 +- contrib/tcsh/tc.prompt.c | 2 +- contrib/tcsh/tcsh.man | 21 +- contrib/tcsh/tcsh.man.new | 64 +- contrib/tcsh/tw.parse.c | 4 +- 35 files changed, 2855 insertions(+), 1939 deletions(-) diff --cc contrib/tcsh/Makefile.ADMIN index 000000000000,5ad3bb8fb3c5..5ad3bb8fb3c5 mode 000000,100644..100644 --- a/contrib/tcsh/Makefile.ADMIN +++ b/contrib/tcsh/Makefile.ADMIN diff --cc contrib/tcsh/README.md index 58a30738daa6,000000000000..df6671b0316e mode 100644,000000..100644 --- a/contrib/tcsh/README.md +++ b/contrib/tcsh/README.md @@@ -1,26 -1,0 +1,29 @@@ +# TCSH + +*C shell with file name completion and command line editing* + +The Tcsh source code is available on GitHub as a read-only repo +mirror at: + - > http://github.com/tcsh-org/tcsh ++> https://github.com/tcsh-org/tcsh + +Instructions for compiling Tcsh can be found in [BUILDING]. + +PLEASE file any bug reports, fixes, and code for new features at: + +> https://bugs.astron.com/ + +Comments, questions, etc. (even flames) are welcome via email to +the tcsh mailing list: + +> tcsh@astron.com +> https://mailman.astron.com/mailman/listinfo/tcsh + +[![Build Status][status]][travis] ++[![Coverity Scan][badge]][coverity] + +[BUILDING]: BUILDING - [status]: https://travis-ci.org/tcsh-org/tcsh.svg?branch=master - [travis]: https://travis-ci.org/tcsh-org/tcsh ++[badge]: https://scan.coverity.com/projects/20307/badge.svg ++[coverity]: https://scan.coverity.com/projects/tcsh-org-tcsh ++[status]: https://travis-ci.com/tcsh-org/tcsh.svg?branch=master ++[travis]: https://travis-ci.com/tcsh-org/tcsh diff --cc contrib/tcsh/dot.login index 000000000000,18d6f9c9d4d3..18d6f9c9d4d3 mode 000000,100644..100644 --- a/contrib/tcsh/dot.login +++ b/contrib/tcsh/dot.login diff --cc contrib/tcsh/dot.tcshrc index 000000000000,a155ed56a932..a155ed56a932 mode 000000,100644..100644 --- a/contrib/tcsh/dot.tcshrc +++ b/contrib/tcsh/dot.tcshrc From owner-dev-commits-src-all@freebsd.org Sun Mar 14 19:44:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA8545B01D8; Sun, 14 Mar 2021 19:44: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 4Dz93l5JPWz4fSP; Sun, 14 Mar 2021 19:44: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 A8C0623138; Sun, 14 Mar 2021 19:44: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 12EJiJFr020532; Sun, 14 Mar 2021 19:44:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12EJiJDB020531; Sun, 14 Mar 2021 19:44:19 GMT (envelope-from git) Date: Sun, 14 Mar 2021 19:44:19 GMT Message-Id: <202103141944.12EJiJDB020531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 1a1592459393 - releng/13.0 - x86: tsc: deprioritize TSC on VirtualBox 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 1a15924593931b91aee31875fa75782a592a7436 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 19:44:19 -0000 The branch releng/13.0 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1a15924593931b91aee31875fa75782a592a7436 commit 1a15924593931b91aee31875fa75782a592a7436 Author: Kyle Evans AuthorDate: 2021-03-08 20:20:10 +0000 Commit: Kyle Evans CommitDate: 2021-03-14 19:44:04 +0000 x86: tsc: deprioritize TSC on VirtualBox Misbehavior has been observed with TSC under VirtualBox, where threads doing small sleeps (~1 second) may miss their wake up and hang around in a sleep state indefinitely. Switching back to ACPI-fast decidedly fixes it, so stop using TSC on VirtualBox at least for the time being. This partially reverts 84eaf2ccc6aa, applying it only to VirtualBox and increasing the quality to 0. Negative qualities can never be chosen and cannot be chosen with the tunable recently added. If we do not have a timecounter with a higher quality than 0, then TSC does at least leave the system mostly usable. PR: 253087 Approved by: re (gjb) (cherry picked from commit 8cc15b0dfc2f3299662e78f18bd6127f83c14ab4) (cherry picked from commit ec24f78e5b201ea56a69607c6e4438a2faac25c0) --- sys/x86/x86/tsc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index de0a1505c2f6..5ffbb64229e9 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -503,6 +503,14 @@ test_tsc(int adj_max_count) if ((!smp_tsc && !tsc_is_invariant)) return (-100); + /* + * Misbehavior of TSC under VirtualBox has been observed. In + * particular, threads doing small (~1 second) sleeps may miss their + * wakeup and hang around in sleep state, causing hangs on shutdown. + */ + if (vm_guest == VM_GUEST_VBOX) + return (0); + size = (mp_maxid + 1) * 3; data = malloc(sizeof(*data) * size * N, M_TEMP, M_WAITOK); adj = 0; From owner-dev-commits-src-all@freebsd.org Sun Mar 14 20:00:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EE2D5B0B01; Sun, 14 Mar 2021 20:00:55 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay105.isp.belgacom.be (mailrelay105.isp.belgacom.be [195.238.20.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign RSA OV SSL CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dz9Qt2m8lz4gJc; Sun, 14 Mar 2021 20:00:54 +0000 (UTC) (envelope-from tijl@freebsd.org) IronPort-SDR: 0Znml6+TqDqWxkPSz4oIHGk4aIzFH9yoTxxaFv86OVqplqXnQik3jYWlrZMAcI8alm1t1SpafP smFc2Rv6ZQrVcQCCOzsNOgt/onQAxSrrM5CJNeEsjCiT0Irwy5x3BHYlsVW5FFJUvJf60OlYxS nQNsvVX1doRUqyCQo9ZBZmOwll7yr0Zo/HV+2E3qNHFuZAMxkK9yRQX4FCjaj0I6l4GtIcPjeR 8uYxlVspkFGrsM1dIdgQjgvTSBTJ31iGbVXNvCFh6PopAbkJipJ2ysy/GzNjNQlS5l2UC85IZ5 zCs= X-IPAS-Result: =?us-ascii?q?A2AgAAC1ak5g/wSs8lFaGgEBAQEBAQEBAQEDAQEBARIBA?= =?us-ascii?q?QEBAgIBAQEBQAeBNQQBAQEBCwEBgwoVVgFQGoRBiQSGKIIbNwGKcIl8hTWBf?= =?us-ascii?q?AsBAQEBAQEBAQEzCgQBAYRNAoF1JjUIDgIDAQEBAwIDAQEBAQYBAQEBAQEFB?= =?us-ascii?q?AGGGDkNQwEQAQQBgV4ig2sBBSNJCgMQCw4KAgImAgJXBhOCcYMLC6xdgTKJW?= =?us-ascii?q?IEDBoEPKgGNQkKCDIQsPoFReBcEFoFHgxaCYASCQAaBO4FMgSiQGqlggwyJS?= =?us-ascii?q?pJlMaQVLYYSmgWSLYZWA4IMTTAIgyRQGQ2OVYhNhUZAAy8LLQIGAQkBAQMJg?= =?us-ascii?q?xWHY4NxAQE?= IronPort-PHdr: A9a23:xB8UAxXE9eygHZstPDMnnpeJ4gLV8Kw2UjF92vIco4ILSbyq+tHYB Gea288FpGHAUYiT0f9Yke2e6/mmBTVRp8/b7ztdIdRlbFwssY0uhQsuAcqIWwXQDcXBSGgEJ vlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfQV6Kf7oFYHMks+5y/69+4HJYwVPmTGxfa5+I A+5oAnMssQam5ZuJrgzxxfGoHZFf/ldyH91K16Ugxvy/Nq78oR58yRXtfIh9spAXrv/cq8lU 7FWDykoPn4s6sHzuhbNUQWA5n0HUmULiRVIGBTK7Av7XpjqrCT3sPd21TSAMs33SbA0Ximi7 7tuRRT1hioLKyI1/WfKgcF2kalVog+upwZnzoDaYI+bKudwcKDfctMUSmVOQslfWjddAoOld YYDE/YNMfpaooT7ulAArQG+BQ6pBO731DFKg3v21rAk3uQmFgHGxxIvH9cUv3TSt9X+KaAfU fy0zKnKyTXOdPNY2S3j54fWbx0vvP+CUah3ccrLxkkiDgXIhUifpoL5JT2azPgNs3SF4Op6U +Kik3AqpQF+rzagxMoglpfEiI0Ux13a+yt0wYY7KMC2RUB0YNOpEZ9duz2YOodrTM0vTGFlt SIkx7MIt5O2cigExZYhyhXCZfKHdI2I7QjiVOaXOTp4imhld6yhiBmp6kiv1/fwVs6u0FZFq CdOj9rCtmgV2hHQ98SLUOVx80i/1TqVygze6P9ILVo7mKfdNpUv2KQ/loAJvkTGBiL2nUL2g 7KIeUg84eio7vjnYq3hpp+BK494kgH+Pboqmsy4Gek4MRIBX2ya+eS5yrLj50r5TK9Wjv03k KnZtIrWKtgcpq6+GA9azIMj5Ay5Dze9ytgYmmMHLF1ddBKGiYjmJU3OLej7APuimVigjjhmy +7cMrH8AJjBMGLPnbj5cbZ48UFcyQ4zzd5F55JTD7EMOO7zWk7ztNzcFRI5PRa0zPj5B9pmz YMRRHiDAqiDMKPdqVOI/P4gI/GQZI8JvzbwM/sl5//1gnIil18dZ7em0oUMZ3CjA/tqOUKZY WDjgt0ZC2cFohI+TPD2iF2FSTNTaGi9X7gm6TE/FY2rFonDRpqzj7Ofxyi7BYBZanpBClCWH nfib5+EVOsUaCKOPs9hlSQJWqW/RI8/zB2hqAj6y79iLurV5i0Yrovv1MNv5+LPjB0y8CZ7D 8Wb02yWQWF0hH0HSCEt06BkvENx0FCD0bJ3g/ZAD9xc++tJUhsmNZ7b1+F1Fs79WhzYctiVT 1amR9CmATAtTtIq2tMOeFx9FMm7gh/Z2yqqB6QYl7KRBJMq7K3TxGPxKNtnx3bBzqkhgEEsQ tFTOm2+mq5/6w/TCpbSk0WDi6mmbLgT3CnI9GeGzGqOoF1YXxBqUaXeRn0faFHWosrn6UzZV L+hFK4rMgxbyc6NMqFKcMHmjU1aRPf/P9TTe3++m2a1BRuTyLOMdpTldHsG0yXGFUcIiQcT/ WyJNVt2OiD0j2PbDSB0BBrGZU/28OI2/H+6S2ca1QyHRXZNkb2v9UhGq+abTqYvObZMkyAms DhxFVCml4bKCtiEjyR7cah2Wv97501IgzGK/zdhN4CtevgxzmUVdB566huG6g== IronPort-HdrOrdr: A9a23:lX+GJa+Idjmz89phO0Ruk+Hadb1zdoIgy1knxilNYDZSddGVkN 3roeQD2XbP+VQscVwDufTFAqmPRnvA6YV4iLN6AZ6OVBTr0VHEEKhM4YfuyDXrGWnf24dmpN xdWodkDtmYNzRHpOP7+hT9L9E73NKc+rupjuu29QYIcShOa7t8qzt/EBqRCEdsRAJLQaM+Do f03LsjmxOFWVA6Kvu2HWMEWe+rnaypqLvDbQQdDxAqrCmi5AnI1JfCCBST0hoTVDlCqI1SjV TtqADy6qW9v/zT8Ha1vFP71JhOncuk990rPqOxo/IIITbhgBvAXuRccoCF1QpanMifrH4Brf nwhSEBGPle0Fv6Q0GShi3M9mDboUsTwk6n43e9uFPCj+vFdAsXYvAx/b5xQ1/840okgcFk3M twrgSknqsSNxPPmyz53cHBU1VBtmfcmwtarccjy39YWuIlGcVshL1a51peGJMYFCL17+kcYY 5TMP0= X-IronPort-Anti-Spam-Filtered: true Received: from 4.172-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.172.4]) by relay.proximus.be with ESMTP; 14 Mar 2021 21:00:51 +0100 Received: from localhost (localhost [127.0.0.1]) by kalimero.tijl.coosemans.org (8.16.1/8.16.1) with ESMTP id 12EK0oWN004071; Sun, 14 Mar 2021 21:00:51 +0100 (CET) (envelope-from tijl@FreeBSD.org) Date: Sun, 14 Mar 2021 21:00:49 +0100 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Dimitry Andric Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , gerald@FreeBSD.org, kib@FreeBSD.org Subject: Re: git: 9097e3cbcac4 - main - Partially revert libcxxrt changes to avoid _Unwind_Exception change Message-ID: <20210314210039.2da1b9ba@FreeBSD.org> In-Reply-To: References: <202103131354.12DDsnKR065154@gitrepo.freebsd.org> <20210313183812.77b74819@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4Dz9Qt2m8lz4gJc 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 20:00:55 -0000 On Sun, 14 Mar 2021 01:15:11 +0100 Dimitry Andric wrote: > On 13 Mar 2021, at 18:38, T=C4=B3l Coosemans wrote: >> On Sat, 13 Mar 2021 13:54:49 GMT Dimitry Andric wrote:= =20 >>> The branch main has been updated by dim: >>>=20 >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3D9097e3cbcac455eb0dedd097= d8d5548c72568d0a >>>=20 >>> commit 9097e3cbcac455eb0dedd097d8d5548c72568d0a >>> Author: Dimitry Andric >>> AuthorDate: 2021-03-13 13:54:24 +0000 >>> Commit: Dimitry Andric >>> CommitDate: 2021-03-13 13:54:24 +0000 >>>=20 >>> Partially revert libcxxrt changes to avoid _Unwind_Exception change = =20 > ... >>> --- a/contrib/libcxxrt/unwind-itanium.h >>> +++ b/contrib/libcxxrt/unwind-itanium.h >>> @@ -79,12 +79,9 @@ struct _Unwind_Exception >>> { >>> uint64_t exception_class; >>> _Unwind_Exception_Cleanup_Fn exception_cleanup; >>> - uintptr_t private_1; >>> - uintptr_t private_2; >>> -#if __SIZEOF_POINTER__ =3D=3D 4 >>> - uint32_t reserved[3]; >>> -#endif >>> - } __attribute__((__aligned__)); >>> + unsigned long private_1; >>> + unsigned long private_2; >>> + } ; =20 >>=20 >> Shouldn't these definitions be the same as the ones in GCC? =20 >=20 > If you want to keep the ABI compatible with what it was, no. Otherwise, > you could consider it. But for what gain? Hmm, the ABI must have been broken by the switch to libcxxrt years ago. In that case there's ABI breakage no matter which version you choose. Maybe kib can help decide which is the lesser evil. In any case I do think the definitions in GCC should match the ones in base. Sometimes libraries compiled with GCC are combined with libraries compiled with Clang in one process. So, code compiled with GCC unwind.h should work with base system libgcc_s and code compiled with libcxxrt unwind.h should work with GCC libgcc_s. Maybe the GCC ports can be patched to match the base system but I'm not sure upstream would accept such a patch, especially since upstream libcxxrt has already become compatible. From owner-dev-commits-src-all@freebsd.org Sun Mar 14 22:16:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68AEA5B4DA8; Sun, 14 Mar 2021 22:16: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 4DzDR02Vynz4qm6; Sun, 14 Mar 2021 22:16: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 443262505F; Sun, 14 Mar 2021 22:16: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 12EMGC6A018299; Sun, 14 Mar 2021 22:16:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12EMGCsA018298; Sun, 14 Mar 2021 22:16:12 GMT (envelope-from git) Date: Sun, 14 Mar 2021 22:16:12 GMT Message-Id: <202103142216.12EMGCsA018298@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 7dd29d256ff7 - stable/13 - Do not complain about incorrect cylinder group check-hashes when asked to add them to a filesystem. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7dd29d256ff7640688ff591b4a8f6379e2dbc4dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 22:16:12 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=7dd29d256ff7640688ff591b4a8f6379e2dbc4dc commit 7dd29d256ff7640688ff591b4a8f6379e2dbc4dc Author: Kirk McKusick AuthorDate: 2021-03-12 06:44:33 +0000 Commit: Kirk McKusick CommitDate: 2021-03-14 22:18:02 +0000 Do not complain about incorrect cylinder group check-hashes when asked to add them to a filesystem. Sponsored by: Netflix (cherry picked from commit 6385cabd5be627c4f395e3abf215882aaeb36320) --- sbin/fsck_ffs/fsutil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 77571deb38f4..127884400651 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -926,7 +926,8 @@ check_cgmagic(int cg, struct bufarea *cgbp, int request_rebuild) * Extended cylinder group checks. */ calchash = cgp->cg_ckhash; - if ((sblock.fs_metackhash & CK_CYLGRP) != 0) { + if ((sblock.fs_metackhash & CK_CYLGRP) != 0 && + (ckhashadd & CK_CYLGRP) == 0) { cghash = cgp->cg_ckhash; cgp->cg_ckhash = 0; calchash = calculate_crc32c(~0L, (void *)cgp, sblock.fs_cgsize); From owner-dev-commits-src-all@freebsd.org Sun Mar 14 23:20:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 100DB5B63F7; Sun, 14 Mar 2021 23:20: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 4DzFs974mCz4tVJ; Sun, 14 Mar 2021 23:20: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 E1A7125C78; Sun, 14 Mar 2021 23:20: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 12ENKTgH005639; Sun, 14 Mar 2021 23:20:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12ENKTwE005638; Sun, 14 Mar 2021 23:20:29 GMT (envelope-from git) Date: Sun, 14 Mar 2021 23:20:29 GMT Message-Id: <202103142320.12ENKTwE005638@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: 588ce1a3ac8d - main - kobj: avoid gcc -Wcast-function-type 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: 588ce1a3ac8d61c99c7827dc71191c46c2d927b7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 23:20:30 -0000 The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=588ce1a3ac8d61c99c7827dc71191c46c2d927b7 commit 588ce1a3ac8d61c99c7827dc71191c46c2d927b7 Author: Ryan Libby AuthorDate: 2021-03-14 23:04:27 +0000 Commit: Ryan Libby CommitDate: 2021-03-14 23:04:27 +0000 kobj: avoid gcc -Wcast-function-type The actual type of kobjop_t is arbitrary, it is only used as a generic function pointer type. Declare it as void (*)(void) in order to avoid gcc's -Wcast-function-type, which is included in -Wextra. Reviewed by: avg, jhb Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D28769 --- sys/sys/kobj.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/kobj.h b/sys/sys/kobj.h index da8c2d5106bb..aaf92688ca08 100644 --- a/sys/sys/kobj.h +++ b/sys/sys/kobj.h @@ -37,7 +37,7 @@ typedef struct kobj *kobj_t; typedef struct kobj_class *kobj_class_t; typedef const struct kobj_method kobj_method_t; -typedef int (*kobjop_t)(void); +typedef void (*kobjop_t)(void); typedef struct kobj_ops *kobj_ops_t; typedef struct kobjop_desc *kobjop_desc_t; struct malloc_type; From owner-dev-commits-src-all@freebsd.org Sun Mar 14 23:20:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 291705B63F8; Sun, 14 Mar 2021 23:20: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 4DzFsC0Y35z4tVK; Sun, 14 Mar 2021 23:20: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 0590E25BE6; Sun, 14 Mar 2021 23:20: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 12ENKUgD005661; Sun, 14 Mar 2021 23:20:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12ENKUxx005660; Sun, 14 Mar 2021 23:20:30 GMT (envelope-from git) Date: Sun, 14 Mar 2021 23:20:30 GMT Message-Id: <202103142320.12ENKUxx005660@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: 3e5e9939cda3 - main - ddb: enable the use of ^C and ^S/^Q 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: 3e5e9939cda3b24df37c37da5f195415a894d9fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Mar 2021 23:20:31 -0000 The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=3e5e9939cda3b24df37c37da5f195415a894d9fd commit 3e5e9939cda3b24df37c37da5f195415a894d9fd Author: Ryan Libby AuthorDate: 2021-03-14 23:04:27 +0000 Commit: Ryan Libby CommitDate: 2021-03-14 23:04:27 +0000 ddb: enable the use of ^C and ^S/^Q This lets one interrupt DDB's output, which is useful if paging is disabled and the output device is slow. This follows a previous implementation in svn r311952 / git 5fddef79998678d256ba30316353393b4d8ebb32 which was reverted because it broke DDB type-ahead. Now, try this again, but with a 512-byte type-ahead buffer. While there is buffer space, control input is handled and non-control input is buffered. When the buffer is exhausted, the default is to print a warning and drop further non-control input in order to continue handling control input. sysctl debug.ddb.prioritize_control_input can be set to 0 to instead preserve all input but lose immediate handling of control input. This could for example effect pasting of a large script into the ddb console. Suggested by: Anton Rang Reviewed by: markj Discussed with: imp Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D28676 --- share/man/man4/ddb.4 | 15 +++++- sys/ddb/db_input.c | 126 +++++++++++++++++++++++++++++++++++++++++---------- sys/ddb/db_output.c | 2 +- sys/ddb/ddb.h | 1 + 4 files changed, 119 insertions(+), 25 deletions(-) diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4 index 1fe3490edd36..4f1614d8e006 100644 --- a/share/man/man4/ddb.4 +++ b/share/man/man4/ddb.4 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 26, 2021 +.Dd March 14, 2021 .Dt DDB 4 .Os .Sh NAME @@ -1571,6 +1571,19 @@ The debugger may be entered by setting the .Xr sysctl 8 .Va debug.kdb.enter to 1. +.Pp +Output may be interrupted, paused, and resumed with the control +characters CTRL-C, CTRL-S, and CTRL-Q. +Because these control characters are received as in-band data from the +console, there is an input buffer, and once that buffer fills +.Nm +must either stop responding to control characters or drop additional +input while continuing to search for control characters. +This behavior is controlled by the tunable +.Xr sysctl 8 +.Va debug.ddb.prioritize_control_input , +which defaults to 1. +The input buffer size is 512 bytes. .Sh FILES Header files mentioned in this manual page can be found below .Pa /usr/include diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c index 41396e0a041f..a7d06e17f5c1 100644 --- a/sys/ddb/db_input.c +++ b/sys/ddb/db_input.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -54,6 +55,19 @@ static char * db_lbuf_end; /* end of input line buffer */ static char * db_lc; /* current character */ static char * db_le; /* one past last character */ +/* + * Raw input buffer, processed only for certain control characters. + */ +#define DB_RAW_SIZE 512 +static char db_raw[DB_RAW_SIZE]; +static u_int db_raw_pos; +static u_int db_raw_cnt; +static int db_raw_warned; +static int ddb_prioritize_control_input = 1; +SYSCTL_INT(_debug_ddb, OID_AUTO, prioritize_control_input, CTLFLAG_RWTUN, + &ddb_prioritize_control_input, 0, + "Drop input when the buffer fills in order to keep servicing ^C/^S/^Q"); + /* * Simple input line history support. */ @@ -65,11 +79,13 @@ static int db_lhist_nlines; #define BLANK ' ' #define BACKUP '\b' -static int cnmaygetc(void); static void db_delete(int n, int bwd); static int db_inputchar(int c); static void db_putnchars(int c, int count); static void db_putstring(char *s, int count); +static int db_raw_pop(void); +static void db_raw_push(int); +static int db_raw_space(void); static void db_putstring(s, count) @@ -307,10 +323,50 @@ db_inputchar(c) return (0); } +/* Get a character from the console, first checking the raw input buffer. */ +int +db_getc(void) +{ + int c; + + if (db_raw_cnt == 0) { + c = cngetc(); + } else { + c = db_raw_pop(); + if (c == '\r') + c = '\n'; + } + return (c); +} + +/* Whether the raw input buffer has space to accept another character. */ static int -cnmaygetc() +db_raw_space(void) +{ + + return (db_raw_cnt < DB_RAW_SIZE); +} + +/* Un-get a character from the console by buffering it. */ +static void +db_raw_push(int c) { - return (-1); + + if (!db_raw_space()) + db_error(NULL); + db_raw[(db_raw_pos + db_raw_cnt++) % DB_RAW_SIZE] = c; +} + +/* Drain a character from the raw input buffer. */ +static int +db_raw_pop(void) +{ + + if (db_raw_cnt == 0) + return (-1); + db_raw_cnt--; + db_raw_warned = 0; + return (db_raw[db_raw_pos++ % DB_RAW_SIZE]); } int @@ -339,7 +395,7 @@ db_readline(lstart, lsize) db_lc = lstart; db_le = lstart; - while (!db_inputchar(cngetc())) + while (!db_inputchar(db_getc())) continue; db_capture_write(lstart, db_le - db_lbuf_start); @@ -361,30 +417,54 @@ db_readline(lstart, lsize) return (db_le - db_lbuf_start); } +static void +db_do_interrupt(const char *reason) +{ + + /* Do a pager quit too because some commands have jmpbuf handling. */ + db_disable_pager(); + db_pager_quit = 1; + db_error(reason); +} + void db_check_interrupt(void) { int c; - c = cnmaygetc(); - switch (c) { - case -1: /* no character */ - return; - - case CTRL('c'): - db_error((char *)0); - /*NOTREACHED*/ - - case CTRL('s'): - do { - c = cnmaygetc(); - if (c == CTRL('c')) - db_error((char *)0); - } while (c != CTRL('q')); - break; + /* + * Check console input for control characters. Non-control input is + * buffered. When buffer space is exhausted, either stop responding to + * control input or drop further non-control input on the floor. + */ + for (;;) { + if (!ddb_prioritize_control_input && !db_raw_space()) + return; + c = cncheckc(); + switch (c) { + case -1: /* no character */ + return; + + case CTRL('c'): + db_do_interrupt("^C"); + /*NOTREACHED*/ + + case CTRL('s'): + do { + c = cncheckc(); + if (c == CTRL('c')) + db_do_interrupt("^C"); + } while (c != CTRL('q')); + break; - default: - /* drop on floor */ - break; + default: + if (db_raw_space()) { + db_raw_push(c); + } else if (!db_raw_warned) { + db_raw_warned = 1; + db_printf("\n--Exceeded input buffer--\n"); + } + break; + } } } diff --git a/sys/ddb/db_output.c b/sys/ddb/db_output.c index 3517187f8206..41a8c7128359 100644 --- a/sys/ddb/db_output.c +++ b/sys/ddb/db_output.c @@ -260,7 +260,7 @@ db_pager(void) db_printf("--More--\r"); done = 0; while (!done) { - c = cngetc(); + c = db_getc(); switch (c) { case 'e': case 'j': diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h index 81448474c514..5ae48d21fda9 100644 --- a/sys/ddb/ddb.h +++ b/sys/ddb/ddb.h @@ -197,6 +197,7 @@ db_addr_t db_disasm(db_addr_t loc, bool altfmt); /* instruction disassembler */ void db_error(const char *s); int db_expression(db_expr_t *valuep); +int db_getc(void); int db_get_variable(db_expr_t *valuep); void db_iprintf(const char *,...) __printflike(1, 2); struct proc *db_lookup_proc(db_expr_t addr);